8 retrieveLog
: async
function() {
10 L
.resolveDefault(fs
.stat('/sbin/logread'), null),
11 L
.resolveDefault(fs
.stat('/usr/sbin/logread'), null)
12 ]).then(function(stat
) {
13 var logger
= stat
[0] ? stat
[0].path
: stat
[1] ? stat
[1].path
: null;
15 return fs
.exec_direct(logger
, [ '-e', '^' ]).then(logdata
=> {
16 const loglines
= logdata
.trim().split(/\n/);
17 return { value
: loglines
.join('\n'), rows
: loglines
.length
+ 1 };
18 }).catch(function(err
) {
19 ui
.addNotification(null, E('p', {}, _('Unable to load log data: ' + err
.message
)));
25 pollLog
: async
function() {
26 const element
= document
.getElementById('syslog');
28 const log
= await
this.retrieveLog();
29 element
.value
= log
.value
;
30 element
.rows
= log
.rows
;
34 load
: async
function() {
35 poll
.add(this.pollLog
.bind(this));
36 return await
this.retrieveLog();
39 render: function(loglines
) {
40 var scrollDownButton
= E('button', {
41 'id': 'scrollDownButton',
42 'class': 'cbi-button cbi-button-neutral'
43 }, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
45 scrollDownButton
.addEventListener('click', function() {
46 scrollUpButton
.focus();
49 var scrollUpButton
= E('button', {
50 'id' : 'scrollUpButton',
51 'class': 'cbi-button cbi-button-neutral'
52 }, _('Scroll to head', 'scroll to top (the head) of the log file')
54 scrollUpButton
.addEventListener('click', function() {
55 scrollDownButton
.focus();
59 E('h2', {}, [ _('System Log') ]),
60 E('div', { 'id': 'content_syslog' }, [
61 E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton
]),
64 'style': 'font-size:12px',
65 'readonly': 'readonly',
67 'rows': loglines
.rows
,
68 }, [ loglines
.value
]),
69 E('div', {'style': 'padding-bottom: 20px'}, [scrollUpButton
])
74 handleSaveApply
: null,