summaryrefslogtreecommitdiffstats
path: root/qos-details-html.lsp
blob: 8592ff85a48366e54429a5c1b4515bd04a3602ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<% local data, viewlibrary, page_info, session = ... 
htmlviewfunctions = require("htmlviewfunctions")
html = require("acf.html")
%>

<script type="text/javascript">
	if (typeof jQuery == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
	}
</script>

<script type="text/javascript">
	if (typeof $.tablesorter == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
	}
</script>

<script type="text/javascript">
	$(document).ready(function() {
		$("#list").tablesorter({widgets: ['zebra']});
	});
</script>

<% htmlviewfunctions.displaycommandresults({"enable","config","expert","startstopinterface"}, session) %>

<% viewlibrary.dispatch_component("status") %>

<h2><%= html.html_escape(data.label) %></h2>
<table id="list" class="tablesorter"><thead>
	<tr>
		<th>Action</th>
		<th>Interface</th>
		<th>Status</th>
	</tr>
</thead><tbody>
<% for i,intf in ipairs(data.value) do %>
	<tr>
		<td>
		<% if intf.enabled then %>
			<% io.write(html.link{value = "config?DEV="..intf.interface.."&redir="..page_info.orig_action, label="Edit " }) %>
			<% io.write(html.link{value = "expert?filename="..intf.filename.."&redir="..page_info.orig_action, label="Expert " }) %>
			<% io.write(html.link{value = page_info.script .. "/alpine-baselayout/rc/edit?servicename="..intf.init.."&redir=".. page_info.orig_action, label="Autostart " }) %>
		<% else %>
			<% io.write(html.link{value = "enable?submit=true&interface="..intf.interface, label="Enable " }) %>
		<% end %>
		</td>
		<td><%= html.html_escape(intf.interface) %></td>
		<td><%= html.html_escape(intf.status) %></td>
		<% if intf.enabled then %>
			<td><form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/startstopinterface") %>" method="post">
			<input type="hidden" name="init" value="<%= intf.init %>">
			<input class="submit" type="submit" name="submit" value="Start">
			<input class="submit" type="submit" name="submit" value="Stop">
			<input class="submit" type="submit" name="submit" value="Restart">
			</form></td>
		<% end %>
	</tr>
<% end %>
</tbody></table>