summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-apinger/htdocs/luci-static/resources/view/apinger/overview.js
diff options
context:
space:
mode:
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.js66
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
+});