Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
luci-mod-status: reimplement log pages as client side views
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
- Loading branch information
Showing
7 changed files
with
74 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
modules/luci-mod-status/htdocs/luci-static/resources/view/status/dmesg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
'use strict'; | ||
'require fs'; | ||
'require ui'; | ||
|
||
return L.view.extend({ | ||
load: function() { | ||
return fs.exec_direct('/bin/dmesg', [ '-r' ]).catch(function(err) { | ||
ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); | ||
return ''; | ||
}); | ||
}, | ||
|
||
render: function(logdata) { | ||
var loglines = logdata.trim().split(/\n/).map(function(line) { | ||
return line.replace(/^<\d+>/, ''); | ||
}); | ||
|
||
return E([], [ | ||
E('h2', {}, [ _('Kernel Log') ]), | ||
E('div', { 'id': 'content_syslog' }, [ | ||
E('textarea', { | ||
'id': 'syslog', | ||
'style': 'font-size:12px', | ||
'readonly': 'readonly', | ||
'wrap': 'off', | ||
'rows': loglines.length + 1 | ||
}, [ loglines.join('\n') ]) | ||
]) | ||
]); | ||
}, | ||
|
||
handleSaveApply: null, | ||
handleSave: null, | ||
handleReset: null | ||
}); |
33 changes: 33 additions & 0 deletions
33
modules/luci-mod-status/htdocs/luci-static/resources/view/status/syslog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
'require fs'; | ||
'require ui'; | ||
|
||
return L.view.extend({ | ||
load: function() { | ||
return fs.exec_direct('/sbin/logread', [ '-e', '^' ]).catch(function(err) { | ||
ui.addNotification(null, E('p', {}, _('Unable to load log data: ' + err.message))); | ||
return ''; | ||
}); | ||
}, | ||
|
||
render: function(logdata) { | ||
var loglines = logdata.trim().split(/\n/); | ||
|
||
return E([], [ | ||
E('h2', {}, [ _('System Log') ]), | ||
E('div', { 'id': 'content_syslog' }, [ | ||
E('textarea', { | ||
'id': 'syslog', | ||
'style': 'font-size:12px', | ||
'readonly': 'readonly', | ||
'wrap': 'off', | ||
'rows': loglines.length + 1 | ||
}, [ loglines.join('\n') ]) | ||
]) | ||
]); | ||
}, | ||
|
||
handleSaveApply: null, | ||
handleSave: null, | ||
handleReset: null | ||
}); |
15 changes: 0 additions & 15 deletions
15
modules/luci-mod-status/luasrc/controller/admin/status.lua
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
modules/luci-mod-status/luasrc/view/admin_status/dmesg.htm
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
modules/luci-mod-status/luasrc/view/admin_status/syslog.htm
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters