45b483962d5f1a4e6b0a2e597de4801fa704a83e
8 retrieveLog
: async
function() {
9 return fs
.exec_direct('/bin/dmesg', [ '-r' ]).then(logdata
=> {
10 const loglines
= logdata
.trim().split(/\n/).map(function(line
) {
11 return line
.replace(/^<\d+>/, '');
13 return { value
: loglines
.join('\n'), rows
: loglines
.length
+ 1 };
14 }).catch(function(err
) {
15 ui
.addNotification(null, E('p', {}, _('Unable to load log data: ' + err
.message
)));
20 pollLog
: async
function() {
21 const element
= document
.getElementById('syslog');
23 const log
= await
this.retrieveLog();
24 element
.value
= log
.value
;
25 element
.rows
= log
.rows
;
29 load
: async
function() {
30 poll
.add(this.pollLog
.bind(this));
31 return await
this.retrieveLog();
34 render: function(loglines
) {
35 var scrollDownButton
= E('button', {
36 'id': 'scrollDownButton',
37 'class': 'cbi-button cbi-button-neutral',
38 }, _('Scroll to tail', 'scroll to bottom (the tail) of the log file')
40 scrollDownButton
.addEventListener('click', function() {
41 scrollUpButton
.focus();
44 var scrollUpButton
= E('button', {
45 'id' : 'scrollUpButton',
46 'class': 'cbi-button cbi-button-neutral',
47 }, _('Scroll to head', 'scroll to top (the head) of the log file')
49 scrollUpButton
.addEventListener('click', function() {
50 scrollDownButton
.focus();
54 E('h2', {}, [ _('Kernel Log') ]),
55 E('div', { 'id': 'content_syslog' }, [
56 E('div', {'style': 'padding-bottom: 20px'}, [scrollDownButton
]),
59 'style': 'font-size:12px',
60 'readonly': 'readonly',
63 }, [ loglines
.value
]),
64 E('div', {'style': 'padding-bottom: 20px'}, [scrollUpButton
])
69 handleSaveApply
: null,