3b9428eaf1144530d627ad65fecb703d1f5ace89
[project/luci.git] / modules / luci-mod-status / htdocs / luci-static / resources / view / status / dmesg.js
1 'use strict';
2 'require fs';
3 'require ui';
4
5 return L.view.extend({
6 load: function() {
7 return fs.exec_direct('/bin/dmesg', [ '-r' ]).catch(function(err) {
8 ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message)));
9 return '';
10 });
11 },
12
13 render: function(logdata) {
14 var loglines = logdata.trim().split(/\n/).map(function(line) {
15 return line.replace(/^<\d+>/, '');
16 });
17
18 return E([], [
19 E('h2', {}, [ _('Kernel Log') ]),
20 E('div', { 'id': 'content_syslog' }, [
21 E('textarea', {
22 'id': 'syslog',
23 'style': 'font-size:12px',
24 'readonly': 'readonly',
25 'wrap': 'off',
26 'rows': loglines.length + 1
27 }, [ loglines.join('\n') ])
28 ])
29 ]);
30 },
31
32 handleSaveApply: null,
33 handleSave: null,
34 handleReset: null
35 });