diff options
author | Yousong Zhou <yszhou4tech@gmail.com> | 2017-07-24 13:00:37 +0800 |
---|---|---|
committer | Yousong Zhou <yszhou4tech@gmail.com> | 2017-07-24 14:53:36 +0800 |
commit | 06ad394dde572878c2a573e8ef81b94ae706b5d5 (patch) | |
tree | 23f9e8570e2eae2b608b8a6fc691656ef910dfd6 /applications/luci-app-shadowsocks-libev/luasrc/view | |
parent | 8f62b28948f8b24f1eb8239074a19d868a02cad6 (diff) |
luci-app-shadowsocks-libev: auto update instance running state
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
Diffstat (limited to 'applications/luci-app-shadowsocks-libev/luasrc/view')
-rw-r--r-- | applications/luci-app-shadowsocks-libev/luasrc/view/shadowsocks-libev/add_instance.htm | 23 |
1 files changed, 23 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 index 67e1c4f72c..219d89b074 100644 --- 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 @@ -20,3 +20,26 @@ </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> |