1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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
});
|