summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-shadowsocks-libev/luasrc/view
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-shadowsocks-libev/luasrc/view')
-rw-r--r--applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm45
1 files changed, 45 insertions, 0 deletions
diff --git a/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm b/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm
new file mode 100644
index 0000000000..219d89b074
--- /dev/null
+++ b/applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm
@@ -0,0 +1,45 @@
+<div class="cbi-section-create cbi-tblsection-create">
+ <br />
+ <table class="cbi-section-table">
+ <tr class="cbi-section-table-row">
+ <td class="cbi-section-table-cell" style="width:140px">
+ <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>
+ </td>
+ <td class="cbi-section-table-cell" style="width:110px">
+ <input type="text" class="cbi-input-text" id="_newinst.name" name="_newinst.name" placeholder="<%:Name%>"/>
+ </td>
+ <td class="cbi-section-table-cell left">
+ <input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>" value="<%:Add%>" />
+ </td>
+ </tr>
+ </table>
+</div>
+<script type="text/javascript">//<![CDATA[
+ XHR.poll(5, '<%=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>