summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js')
-rw-r--r--applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js b/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js
new file mode 100644
index 0000000000..ae28f94f78
--- /dev/null
+++ b/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/logread.js
@@ -0,0 +1,41 @@
+'use strict';
+'require view';
+'require poll';
+'require fs';
+
+return view.extend({
+ load: function() {
+ return Promise.all([
+ L.resolveDefault(fs.stat('/sbin/logread'), null),
+ L.resolveDefault(fs.stat('/usr/sbin/logread'), null)
+ ]);
+ },
+ render: function(stat) {
+ var logger = stat[0] ? stat[0].path : stat[1] ? stat[1].path : null;
+ poll.add(function() {
+ return L.resolveDefault(fs.exec_direct(logger, ['-e', 'banIP-'])).then(function(res) {
+ var log = document.getElementById("logfile");
+ if (res) {
+ log.value = res.trim();
+ } else {
+ log.value = _('No banIP related logs yet!');
+ }
+ log.scrollTop = log.scrollHeight;
+ });
+ });
+ return E('div', { class: 'cbi-map' },
+ E('div', { class: 'cbi-section' }, [
+ E('div', { class: 'cbi-section-descr' }, _('The syslog output, pre-filtered for banIP related messages only.')),
+ E('textarea', {
+ 'id': 'logfile',
+ 'style': 'width: 100% !important; padding: 5px; font-family: monospace',
+ 'readonly': 'readonly',
+ 'wrap': 'off',
+ 'rows': 25
+ })
+ ]));
+ },
+ handleSaveApply: null,
+ handleSave: null,
+ handleReset: null
+});