Merge pull request #3400 from TDT-AG/pr/20191210-luci-mk
[oweals/luci.git] / modules / luci-mod-status / htdocs / luci-static / resources / view / status / syslog.js
1 'use strict';
2 'require fs';
3 'require ui';
4
5 return L.view.extend({
6         load: function() {
7                 return fs.exec_direct('/sbin/logread', [ '-e', '^' ]).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/);
15
16                 return E([], [
17                         E('h2', {}, [ _('System Log') ]),
18                         E('div', { 'id': 'content_syslog' }, [
19                                 E('textarea', {
20                                         'id': 'syslog',
21                                         'style': 'font-size:12px',
22                                         'readonly': 'readonly',
23                                         'wrap': 'off',
24                                         'rows': loglines.length + 1
25                                 }, [ loglines.join('\n') ])
26                         ])
27                 ]);
28         },
29
30         handleSaveApply: null,
31         handleSave: null,
32         handleReset: null
33 });