7 var callLuciProcessList
= rpc
.declare({
9 method
: 'getProcessList',
10 expect
: { result
: [] }
15 return callLuciProcessList();
18 handleSignal: function(signum
, pid
, ev
) {
19 return fs
.exec('/bin/kill', ['-%d'.format(signum
), '%s'.format(pid
)]).then(L
.bind(function() {
20 return callLuciProcessList().then(L
.bind(function(processes
) {
21 this.updateTable('.table', processes
);
23 }, this)).catch(function(e
) { ui
.addNotification(null, E('p', e
.message
)) });
26 updateTable: function(table
, processes
) {
29 processes
.sort(function(a
, b
) {
30 return (a
.PID
- b
.PID
);
33 for (var i
= 0; i
< processes
.length
; i
++) {
34 var proc
= processes
[i
];
44 'class': 'btn cbi-button-action',
45 'click': ui
.createHandlerFn(this, 'handleSignal', 1, proc
.PID
)
46 }, _('Hang Up')), ' ',
48 'class': 'btn cbi-button-negative',
49 'click': ui
.createHandlerFn(this, 'handleSignal', 15, proc
.PID
)
50 }, _('Terminate')), ' ',
52 'class': 'btn cbi-button-negative',
53 'click': ui
.createHandlerFn(this, 'handleSignal', 9, proc
.PID
)
59 cbi_update_table(table
, rows
, E('em', _('No information available')));
62 render: function(processes
) {
64 E('h2', _('Processes')),
65 E('div', { 'class': 'cbi-map-descr' }, _('This list gives an overview over currently running system processes and their status.')),
67 E('table', { 'class': 'table' }, [
68 E('tr', { 'class': 'tr table-titles' }, [
69 E('th', { 'class': 'th' }, _('PID')),
70 E('th', { 'class': 'th' }, _('Owner')),
71 E('th', { 'class': 'th' }, _('Command')),
72 E('th', { 'class': 'th' }, _('CPU usage (%)')),
73 E('th', { 'class': 'th' }, _('Memory usage (%)')),
74 E('th', { 'class': 'th center nowrap cbi-section-actions' })
79 this.updateTable(v
.lastElementChild
, processes
);
84 handleSaveApply
: null,