diff options
author | Ansuel Smith <ansuelsmth@gmail.com> | 2019-11-06 01:33:53 +0100 |
---|---|---|
committer | Ansuel Smith <ansuelsmth@gmail.com> | 2019-11-11 20:47:16 +0100 |
commit | 34fa5122f98af4ac635dfc26a64f6d2d3e4fafcb (patch) | |
tree | 39183ec3b008cd16a23e3fa0a6ab544602aa4408 /applications/luci-app-ddns/htdocs/luci-static/resources/view/status | |
parent | 0731f7e5e43f490c39e364e43988a59ee2be9576 (diff) |
luci-app-ddns: convert to client side implementation
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'applications/luci-app-ddns/htdocs/luci-static/resources/view/status')
-rw-r--r-- | applications/luci-app-ddns/htdocs/luci-static/resources/view/status/include/70_ddns.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/applications/luci-app-ddns/htdocs/luci-static/resources/view/status/include/70_ddns.js b/applications/luci-app-ddns/htdocs/luci-static/resources/view/status/include/70_ddns.js new file mode 100644 index 0000000000..698cf8d254 --- /dev/null +++ b/applications/luci-app-ddns/htdocs/luci-static/resources/view/status/include/70_ddns.js @@ -0,0 +1,46 @@ +'use strict'; +'require rpc'; +'require uci'; + +return L.Class.extend({ + title: _('Dynamic DNS'), + + callDDnsGetServicesStatus: rpc.declare({ + object: 'luci.ddns', + method: 'get_services_status', + expect: { } + }), + + load: function() { + return Promise.all([ + this.callDDnsGetServicesStatus(), + uci.load('ddns') + ]); + }, + + render: function(data) { + var services = data[0]; + + var table = E('div', { 'class': 'table' }, [ + E('div', { 'class': 'tr table-titles' }, [ + E('div', { 'class': 'th' }, _('Configuration')), + E('div', { 'class': 'th' }, _('Next Update')), + E('div', { 'class': 'th' }, _('Lookup Hostname')), + E('div', { 'class': 'th' }, _('Registered IP')), + E('div', { 'class': 'th' }, _('Network')) + ]) + ]); + + cbi_update_table(table, Object.keys(services).map(function(key, index) { + return [ + key, + services[key].next_update ? _(services[key].next_update) : _('Unknown'), + uci.get('ddns',key,'lookup_host'), + services[key].ip ? services[key].ip : _('No Data'), + (uci.get('ddns',key,'use_ipv6') == '1' ? 'IPv6' : 'IPv4') + ' / ' + uci.get('ddns',key,'interface') + ]; + }), E('em', _('There is no service configured.'))); + + return E([table]); + } +}); |