diff options
author | Jaymin Patel <jem.patel@gmail.com> | 2022-07-16 18:42:47 +0530 |
---|---|---|
committer | Jaymin Patel <jem.patel@gmail.com> | 2022-08-01 02:24:52 +0530 |
commit | 6c151fcddbabc0fcdd9de8c5088153e84f5b0ccd (patch) | |
tree | b2a031eb04b09fc5c36c50231dd16b0aa4d4110d /applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js | |
parent | b0b9a34f8b75f9c2c91cb6a4badcc4e8e4122821 (diff) |
luci-app-apinger: Add LuCI for Apinger
LuCI Support for Apinger
Signed-off-by: Jaymin Patel <jem.patel@gmail.com>
Diffstat (limited to 'applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js')
-rw-r--r-- | applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js b/applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js new file mode 100644 index 0000000000..de74be676d --- /dev/null +++ b/applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js @@ -0,0 +1,66 @@ +'use strict'; +'require view'; +'require rpc'; +'require form'; +'require poll'; + +var callApingerStatus = rpc.declare({ + object: 'apinger', + method: 'status', + expect: { }, +}); + +return view.extend({ + render: function() { + var table = + E('table', { 'class': 'table lases' }, [ + E('tr', { 'class': 'tr table-titles' }, [ + E('th', { 'class': 'th' }, _('Interface')), + E('th', { 'class': 'th' }, _('Target')), + E('th', { 'class': 'th' }, _('Source IP')), + E('th', { 'class': 'th' }, _('Address')), + E('th', { 'class': 'th' }, _('Sent')), + E('th', { 'class': 'th' }, _('Received')), + E('th', { 'class': 'th' }, _('Latency')), + E('th', { 'class': 'th' }, _('Loss')), + E('th', { 'class': 'th' }, _('Active Alarms')), + E('th', { 'class': 'th' }, _('Time')), + E([]) + ]) + ]); + + poll.add(function() { + return callApingerStatus().then(function(targetInfo) { + var targets = Array.isArray(targetInfo.targets) ? targetInfo.targets : []; + + cbi_update_table(table, + targets.map(function(target) { + return [ + target.interface, + target.target, + target.srcip, + target.address, + target.sent, + target.received, + target.latency, + target.loss, + target.alarm, + new Date(target.timestamp * 1000), + ]; + }), + E('em', _('There are no active targets')) + ); + }); + }); + + return E([ + E('h3', _('Apinger Targets')), + E('br'), + table + ]); + }, + + handleSave: null, + handleSaveApply:null, + handleReset: null +}); |