blob: 27e101a4da8cf3199ecac6720a9f274aed0a3b8e (
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
|
<div class="cbi-section-create cbi-tblsection-create">
<div>
<select class="cbi-input-select" id="_newinst.type" name="_newinst.type">
<option value="_dummy">-- instance type --</option>
<option value="ss_local">ss-local</option>
<option value="ss_tunnel">ss-tunnel</option>
<option value="ss_redir">ss-redir</option>
<option value="ss_server">ss-server</option>
</select>
</div>
<div>
<input type="text" class="cbi-input-text" id="_newinst.name" name="_newinst.name" placeholder="<%:Name%>"/>
</div>
<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>" value="<%:Add%>" />
</div>
<script type="text/javascript">//<![CDATA[
XHR.poll(-1, '<%=url('admin/services/shadowsocks-libev/status')%>', null,
function(x, st)
{
var names = [
<%-
for _, name in ipairs(self:cfgsections()) do
write("%q," % name)
end
-%>
];
var instances = st["instances"] || {};
for (var i = 0, len = names.length; i < len; i++) {
var name = names[i];
var el = document.getElementById('cbi-table-' + name + '-running');
if (el) {
var running = instances.hasOwnProperty(name)? instances[name].running : false;
el.innerText = running ? 'yes' : 'no';
}
}
}
);
//]]></script>
|