diff options
author | Karl Palsson <karlp@etactica.com> | 2021-10-18 13:04:00 +0000 |
---|---|---|
committer | Paul Donald <newtwen@gmail.com> | 2024-03-17 01:02:19 +0100 |
commit | c5a65a839713ab7ac70e6a6b5a7331593f67a9a0 (patch) | |
tree | b0638283a3ae449f006011dbea8fd706c3b92a9e /applications/luci-app-nextdns/htdocs/luci-static/resources | |
parent | 97ebdcbddb9cad76dc551086fcb887e55886a069 (diff) |
widgets: add a re-useable filtered logread view
Multiple apps introduced their own implementation of a syslog view,
filtered for just their own application logs. Pull that out as a shared
view. Some of these had _minor_ style differences, which has been
"standardized" now. A full "widget" conversion would allow more end app
tuning of that, but is not implemented.
Signed-off-by: Karl Palsson <karlp@etactica.com>
app-nextdns: fix Logs title
Minor typo, introduced in 625abbf (convert simple controllers to
menu.json)
Signed-off-by: Karl Palsson <karlp@etactica.com>
luci-base: implement shared log reader view
Closes #5452
Signed-off-by: Paul Donald <newtwen@gmail.com>
Diffstat (limited to 'applications/luci-app-nextdns/htdocs/luci-static/resources')
-rw-r--r-- | applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js index 0ad4a79825..13b22476f7 100644 --- a/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js +++ b/applications/luci-app-nextdns/htdocs/luci-static/resources/view/nextdns/logread.js @@ -1,45 +1,4 @@ 'use strict'; -'require view'; -'require poll'; -'require fs'; +'require tools.views as views'; -return view.extend({ - render: function() { - poll.add(function() { - return L.resolveDefault(fs.exec('/sbin/logread', ['-e', 'nextdns']), { code: 1 }) - .then(function(res) { - var content; - if (res.code === 0) - content = res.stdout.trim(); - if (!content) - content = _('No nextdns related logs yet!'); - var view = document.getElementById("view_id"); - view.value = content; - view.scrollTop = view.scrollHeight; - }); - }); - return E('div', { class: 'cbi-map' }, - E('div', { class: 'cbi-section' }, [ - E('div', { class: 'cbi-section-descr' }, - _('The syslog output, pre-filtered for nextdns related messages only.')), - E('textarea', { - id: 'view_id', - readonly: 'readonly', - wrap: 'off', - style: 'width: 100% !important;\ - height: 450px !important;\ - border: 1px solid #cccccc;\ - padding: 5px;\ - font-size: 12px;\ - font-family: monospace;\ - resize: none;\ - pointer-events: auto;\ - cursor: auto;' - }) - ]) - ); - }, - handleSaveApply: null, - handleSave: null, - handleReset: null -}); +return views.LogreadBox("nextdns", "nextdns"); |