2021-03-11 18:24:24 +03:00
|
|
|
|
'use strict';
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'require baseclass';
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'require ui';
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'require view';
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2021-03-26 23:49:38 +03:00
|
|
|
|
document.head.append(E('style', {'type': 'text/css'},
|
|
|
|
|
|
`
|
2021-10-05 20:48:58 +03:00
|
|
|
|
:root {
|
|
|
|
|
|
--app-log-dark-font-color: #2e2e2e;
|
|
|
|
|
|
--app-log-light-font-color: #fff;
|
|
|
|
|
|
--app-log-debug-font-color: #737373;
|
2022-09-20 16:33:28 +03:00
|
|
|
|
--app-log-emerg-color: #a93734;
|
|
|
|
|
|
--app-log-alert: #ff7968;
|
|
|
|
|
|
--app-log-crit: #fcc3bf;
|
|
|
|
|
|
--app-log-err: #ffe9e8;
|
|
|
|
|
|
--app-log-warn: #fff7e2;
|
|
|
|
|
|
--app-log-notice: #e3ffec;
|
|
|
|
|
|
--app-log-info: rgba(0,0,0,0);
|
|
|
|
|
|
--app-log-debug: #ebf6ff;
|
|
|
|
|
|
}
|
|
|
|
|
|
:root[data-darkmode="true"] {
|
|
|
|
|
|
--app-log-dark-font-color: #fff;
|
|
|
|
|
|
--app-log-light-font-color: #fff;
|
|
|
|
|
|
--app-log-debug-font-color: #e7e7e7;
|
|
|
|
|
|
--app-log-emerg-color: #a93734;
|
|
|
|
|
|
--app-log-alert: #eb5050;
|
|
|
|
|
|
--app-log-crit: #dc7f79;
|
|
|
|
|
|
--app-log-err: #c89593;
|
|
|
|
|
|
--app-log-warn: #8d7000;
|
|
|
|
|
|
--app-log-notice: #007627;
|
|
|
|
|
|
--app-log-info: rgba(0,0,0,0);
|
|
|
|
|
|
--app-log-debug: #5986b1;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
}
|
2021-03-26 23:49:38 +03:00
|
|
|
|
.log-entry-empty {
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-number {
|
|
|
|
|
|
min-width: 4em !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-time {
|
2021-10-05 20:48:58 +03:00
|
|
|
|
min-width: 15em !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-entry-host {
|
|
|
|
|
|
min-width: 10em !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-host-cell {
|
|
|
|
|
|
word-break: break-all !important;
|
|
|
|
|
|
word-wrap: break-word !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-log-level {
|
|
|
|
|
|
max-width: 5em !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-facility{
|
|
|
|
|
|
max-width: 7em !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-message {
|
|
|
|
|
|
min-width: 25em !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-entry-message-cell {
|
|
|
|
|
|
overflow-x: hidden !important;
|
|
|
|
|
|
text-overflow: ellipsis !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-empty {
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-emerg {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-emerg-color) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color);
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
log-emerg .td {
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
log-emerg td {
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-alert {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-alert) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color);
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-alert .td {
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-alert td {
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-light-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-crit {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-crit) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-crit .td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-crit td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-err {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-err) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-err .td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-err td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-warn {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-warn) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-warn .td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-warn td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-notice {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-notice) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-notice .td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-notice td {
|
|
|
|
|
|
color: var(--app-log-dark-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-info {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-info) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-debug {
|
2022-09-20 16:33:28 +03:00
|
|
|
|
background-color: var(--app-log-debug) !important;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
color: var(--app-log-debug-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-debug .td {
|
|
|
|
|
|
color: var(--app-log-debug-font-color) !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-debug td {
|
|
|
|
|
|
color: var(--app-log-debug-font-color) !important;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-highlight-item {
|
|
|
|
|
|
background-color: #ffef00;
|
2022-09-20 16:33:28 +03:00
|
|
|
|
color: #2e2e2e;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-entries-count {
|
|
|
|
|
|
margin: 0 0 5px 5px;
|
|
|
|
|
|
font-weight: bold;
|
2021-10-05 20:48:58 +03:00
|
|
|
|
opacity: 0.7;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
.log-entries-count-level {
|
|
|
|
|
|
display: inline-block !important;
|
|
|
|
|
|
margin: 0 0 0 5px;
|
|
|
|
|
|
padding: 0 4px;
|
|
|
|
|
|
-webkit-border-radius: 3px;
|
|
|
|
|
|
-moz-border-radius: 3px;
|
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
|
border: 1px solid #ccc;
|
|
|
|
|
|
font-weight: normal;
|
|
|
|
|
|
}
|
|
|
|
|
|
.log-host-dropdown-item {
|
|
|
|
|
|
}
|
2023-11-01 19:48:59 +03:00
|
|
|
|
.log-facility-dropdown-item {
|
|
|
|
|
|
}
|
2021-03-26 23:49:38 +03:00
|
|
|
|
`));
|
|
|
|
|
|
|
2021-12-05 19:18:32 +03:00
|
|
|
|
return baseclass.extend({
|
|
|
|
|
|
view: view.extend({
|
2021-03-27 18:35:35 +03:00
|
|
|
|
/**
|
2021-04-09 18:10:55 +03:00
|
|
|
|
* View name (for local storage and downloads).
|
2021-03-27 18:35:35 +03:00
|
|
|
|
* Must be overridden by a subclass!
|
|
|
|
|
|
*/
|
2021-11-04 18:57:08 +03:00
|
|
|
|
viewName : null,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2021-03-27 18:35:35 +03:00
|
|
|
|
/**
|
|
|
|
|
|
* Page title.
|
|
|
|
|
|
* Must be overridden by a subclass!
|
|
|
|
|
|
*/
|
2021-11-04 18:57:08 +03:00
|
|
|
|
title : null,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logFacilities : {
|
|
|
|
|
|
'kern' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'kern')),
|
|
|
|
|
|
'user' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'user')),
|
|
|
|
|
|
'mail' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'mail')),
|
|
|
|
|
|
'daemon' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'daemon')),
|
|
|
|
|
|
'auth' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'auth')),
|
|
|
|
|
|
'syslog' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'syslog')),
|
|
|
|
|
|
'lpr' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'lpr')),
|
|
|
|
|
|
'news' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'news')),
|
|
|
|
|
|
'uucp' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'uucp')),
|
|
|
|
|
|
'authpriv': E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'authpriv')),
|
|
|
|
|
|
'ftp' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'ftp')),
|
|
|
|
|
|
'ntp' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'ntp')),
|
|
|
|
|
|
'log' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'log')),
|
|
|
|
|
|
'clock' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'clock')),
|
|
|
|
|
|
'local0' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local0')),
|
|
|
|
|
|
'local1' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local1')),
|
|
|
|
|
|
'local2' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local2')),
|
|
|
|
|
|
'local3' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local3')),
|
|
|
|
|
|
'local4' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local4')),
|
|
|
|
|
|
'local5' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local5')),
|
|
|
|
|
|
'local6' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local6')),
|
|
|
|
|
|
'local7' : E('span', { 'class': 'zonebadge log-facility-dropdown-item' }, E('strong', 'local7')),
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-11-04 18:57:08 +03:00
|
|
|
|
logLevels : {
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'emerg' : E('span', { 'class': 'zonebadge log-emerg' }, E('strong', _('Emergency'))),
|
|
|
|
|
|
'alert' : E('span', { 'class': 'zonebadge log-alert' }, E('strong', _('Alert'))),
|
|
|
|
|
|
'crit' : E('span', { 'class': 'zonebadge log-crit' }, E('strong', _('Critical'))),
|
|
|
|
|
|
'err' : E('span', { 'class': 'zonebadge log-err' }, E('strong', _('Error'))),
|
|
|
|
|
|
'warn' : E('span', { 'class': 'zonebadge log-warn' }, E('strong', _('Warning'))),
|
|
|
|
|
|
'notice': E('span', { 'class': 'zonebadge log-notice' }, E('strong', _('Notice'))),
|
|
|
|
|
|
'info' : E('span', { 'class': 'zonebadge log-info' }, E('strong', _('Info'))),
|
|
|
|
|
|
'debug' : E('span', { 'class': 'zonebadge log-debug' }, E('strong', _('Debug'))),
|
2021-03-11 18:24:24 +03:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
tailValue : 25,
|
|
|
|
|
|
|
|
|
|
|
|
logSortingValue : 'asc',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
isHosts : false,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
isFacilities : false,
|
2021-03-27 18:35:35 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
isLevels : false,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logHosts : {},
|
2021-03-26 23:49:38 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logLevelsStat : {},
|
2021-03-27 18:35:35 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logHostsDropdown : null,
|
2021-03-26 23:49:38 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logFacilitiesDropdown: null,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logLevelsDropdown : null,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
totalLogLines : 0,
|
|
|
|
|
|
|
|
|
|
|
|
htmlEntities(str) {
|
2021-03-11 18:24:24 +03:00
|
|
|
|
return String(str).replace(
|
|
|
|
|
|
/&/g, '&').replace(
|
|
|
|
|
|
/</g, '<').replace(
|
|
|
|
|
|
/>/g, '>').replace(
|
2021-03-15 21:02:38 +03:00
|
|
|
|
/"/g, '"').replace(
|
|
|
|
|
|
/'/g, ''');
|
2021-03-11 18:24:24 +03:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
makeLogHostsDropdownItem(host) {
|
2021-03-26 23:49:38 +03:00
|
|
|
|
return E(
|
|
|
|
|
|
'span',
|
|
|
|
|
|
{ 'class': 'zonebadge log-host-dropdown-item' },
|
|
|
|
|
|
E('strong', host)
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
makeLogHostsDropdownSection() {
|
2021-03-27 18:35:35 +03:00
|
|
|
|
this.logHostsDropdown = new ui.Dropdown(
|
|
|
|
|
|
null,
|
|
|
|
|
|
this.logHosts,
|
|
|
|
|
|
{
|
2021-12-05 19:18:32 +03:00
|
|
|
|
id : 'logHostsDropdown',
|
|
|
|
|
|
multiple : true,
|
2021-03-27 18:35:35 +03:00
|
|
|
|
select_placeholder: _('All'),
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
return E(
|
|
|
|
|
|
'div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'for' : 'logHostsDropdown',
|
2021-03-27 18:35:35 +03:00
|
|
|
|
}, _('Hosts')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' },
|
|
|
|
|
|
this.logHostsDropdown.render()
|
|
|
|
|
|
),
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
makeLogFacilitiesDropdownSection(){
|
|
|
|
|
|
this.logFacilitiesDropdown = new ui.Dropdown(
|
|
|
|
|
|
null,
|
|
|
|
|
|
this.logFacilities,
|
|
|
|
|
|
{
|
|
|
|
|
|
id : 'logFacilitiesDropdown',
|
|
|
|
|
|
sort : Object.keys(this.logFacilities),
|
|
|
|
|
|
multiple : true,
|
|
|
|
|
|
select_placeholder: _('All'),
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
return E(
|
|
|
|
|
|
'div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
|
|
|
|
|
'for' : 'logFacilitiesDropdown',
|
|
|
|
|
|
}, _('Facilities')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' },
|
|
|
|
|
|
this.logFacilitiesDropdown.render()
|
|
|
|
|
|
),
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
makeLogLevelsDropdownSection(){
|
2021-03-27 18:35:35 +03:00
|
|
|
|
this.logLevelsDropdown = new ui.Dropdown(
|
|
|
|
|
|
null,
|
|
|
|
|
|
this.logLevels,
|
|
|
|
|
|
{
|
2021-12-05 19:18:32 +03:00
|
|
|
|
id : 'logLevelsDropdown',
|
|
|
|
|
|
sort : Object.keys(this.logLevels),
|
|
|
|
|
|
multiple : true,
|
2021-03-27 18:35:35 +03:00
|
|
|
|
select_placeholder: _('All'),
|
|
|
|
|
|
}
|
|
|
|
|
|
);
|
|
|
|
|
|
return E(
|
|
|
|
|
|
'div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'for' : 'logLevelsDropdown',
|
2021-03-27 18:35:35 +03:00
|
|
|
|
}, _('Logging levels')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' },
|
|
|
|
|
|
this.logLevelsDropdown.render()
|
|
|
|
|
|
),
|
|
|
|
|
|
]
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2021-03-11 18:24:24 +03:00
|
|
|
|
/**
|
2021-03-27 18:35:35 +03:00
|
|
|
|
* Receives raw log data.
|
|
|
|
|
|
* Abstract method, must be overridden by a subclass!
|
2021-03-11 18:24:24 +03:00
|
|
|
|
*
|
|
|
|
|
|
* @param {number} tail
|
|
|
|
|
|
* @returns {string}
|
|
|
|
|
|
* Returns the raw content of the log
|
|
|
|
|
|
*/
|
2023-11-01 19:48:59 +03:00
|
|
|
|
getLogData(tail) {
|
2021-03-26 23:49:38 +03:00
|
|
|
|
throw new Error('getLogData must be overridden by a subclass');
|
2021-03-11 18:24:24 +03:00
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-03-27 18:35:35 +03:00
|
|
|
|
* Parses log data.
|
|
|
|
|
|
* Abstract method, must be overridden by a subclass!
|
2021-03-11 18:24:24 +03:00
|
|
|
|
*
|
|
|
|
|
|
* @param {string} logdata
|
|
|
|
|
|
* @param {number} tail
|
2021-03-26 23:49:38 +03:00
|
|
|
|
* @returns {Array<number, string|null, string|null, string|null, string|null, string|null>}
|
|
|
|
|
|
* Returns an array of values: [ #, Timestamp, Host, Level, Facility, Message ]
|
2021-03-11 18:24:24 +03:00
|
|
|
|
*/
|
2023-11-01 19:48:59 +03:00
|
|
|
|
parseLogData(logdata, tail) {
|
2021-03-26 23:49:38 +03:00
|
|
|
|
throw new Error('parseLogData must be overridden by a subclass');
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
setDateFilter(entriesArray) {
|
|
|
|
|
|
let fPattern = document.getElementById('timeFilter').value;
|
|
|
|
|
|
if(!fPattern) {
|
|
|
|
|
|
return entriesArray;
|
|
|
|
|
|
};
|
|
|
|
|
|
return this.setRegexpFilter(entriesArray, 1, fPattern);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
setHostFilter(entriesArray) {
|
2021-03-26 23:49:38 +03:00
|
|
|
|
let logHostsKeys = Object.keys(this.logHosts);
|
2021-03-27 18:35:35 +03:00
|
|
|
|
if(logHostsKeys.length > 0 && this.logHostsDropdown) {
|
2021-03-26 23:49:38 +03:00
|
|
|
|
let selectedHosts = this.logHostsDropdown.getValue();
|
2021-03-27 18:35:35 +03:00
|
|
|
|
this.logHostsDropdown.addChoices(logHostsKeys, this.logHosts);
|
2021-03-26 23:49:38 +03:00
|
|
|
|
if(selectedHosts.length === 0 || logHostsKeys.length === selectedHosts.length) {
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray;
|
2021-03-26 23:49:38 +03:00
|
|
|
|
};
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray.filter(e => selectedHosts.includes(e[2]));
|
2021-03-26 23:49:38 +03:00
|
|
|
|
};
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray;
|
2021-03-11 18:24:24 +03:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
setFacilityFilter(entriesArray) {
|
|
|
|
|
|
let logFacilitiesKeys = Object.keys(this.logFacilities);
|
|
|
|
|
|
if(logFacilitiesKeys.length > 0 && this.logFacilitiesDropdown) {
|
|
|
|
|
|
let selectedFacilities = this.logFacilitiesDropdown.getValue();
|
|
|
|
|
|
if(selectedFacilities.length === 0 || logFacilitiesKeys.length === selectedFacilities.length) {
|
|
|
|
|
|
return entriesArray;
|
|
|
|
|
|
};
|
|
|
|
|
|
return entriesArray.filter(e => selectedFacilities.includes(e[3]));
|
|
|
|
|
|
};
|
|
|
|
|
|
return entriesArray;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
setLevelFilter(entriesArray) {
|
2021-03-15 21:02:38 +03:00
|
|
|
|
let logLevelsKeys = Object.keys(this.logLevels);
|
2021-03-27 18:35:35 +03:00
|
|
|
|
if(logLevelsKeys.length > 0 && this.logLevelsDropdown) {
|
2021-03-15 21:02:38 +03:00
|
|
|
|
let selectedLevels = this.logLevelsDropdown.getValue();
|
2021-03-26 23:49:38 +03:00
|
|
|
|
if(selectedLevels.length === 0 || logLevelsKeys.length === selectedLevels.length) {
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray;
|
2021-03-15 21:02:38 +03:00
|
|
|
|
};
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray.filter(e => selectedLevels.includes(e[4]));
|
2021-03-15 21:02:38 +03:00
|
|
|
|
};
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray;
|
2021-03-15 21:02:38 +03:00
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
regexpFilterHighlightFunc(match) {
|
2021-04-09 18:10:55 +03:00
|
|
|
|
return `<span class="log-highlight-item">${match}</span>`;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
setRegexpFilter(entriesArray, fieldNum, pattern) {
|
2021-03-15 21:02:38 +03:00
|
|
|
|
let fArr = [];
|
|
|
|
|
|
try {
|
2023-11-01 19:48:59 +03:00
|
|
|
|
let regExp = new RegExp(pattern, 'giu');
|
|
|
|
|
|
entriesArray.forEach((e, i) => {
|
|
|
|
|
|
if(e[fieldNum] !== null && regExp.test(e[fieldNum])) {
|
2021-04-09 18:10:55 +03:00
|
|
|
|
if(this.regexpFilterHighlightFunc) {
|
2023-11-01 19:48:59 +03:00
|
|
|
|
e[fieldNum] = e[fieldNum].replace(regExp, this.regexpFilterHighlightFunc);
|
2021-04-09 18:10:55 +03:00
|
|
|
|
};
|
2021-03-15 21:02:38 +03:00
|
|
|
|
fArr.push(e);
|
|
|
|
|
|
};
|
2021-04-09 18:10:55 +03:00
|
|
|
|
regExp.lastIndex = 0;
|
2021-03-15 21:02:38 +03:00
|
|
|
|
});
|
|
|
|
|
|
} catch(err) {
|
|
|
|
|
|
if(err.name === 'SyntaxError') {
|
|
|
|
|
|
ui.addNotification(null,
|
|
|
|
|
|
E('p', {}, _('Invalid regular expression') + ': ' + err.message));
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return entriesArray;
|
2021-03-15 21:02:38 +03:00
|
|
|
|
} else {
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
return fArr;
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
setMsgFilter(entriesArray) {
|
|
|
|
|
|
let fPattern = document.getElementById('msgFilter').value;
|
|
|
|
|
|
if(!fPattern) {
|
|
|
|
|
|
return entriesArray;
|
|
|
|
|
|
};
|
|
|
|
|
|
return this.setRegexpFilter(entriesArray, 5, fPattern);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
makeLogArea(logdataArray) {
|
2022-05-15 04:39:59 +03:00
|
|
|
|
let lines = `<tr class="tr"><td class="td center log-entry-empty">${_('No entries available...')}</td></tr>`;
|
|
|
|
|
|
let logTable = E('table', { 'id': 'logTable', 'class': 'table' });
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
|
|
|
|
|
for(let level of Object.keys(this.logLevels)) {
|
|
|
|
|
|
this.logLevelsStat[level] = 0;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if(logdataArray.length > 0) {
|
|
|
|
|
|
lines = [];
|
|
|
|
|
|
logdataArray.forEach((e, i) => {
|
2023-11-01 19:48:59 +03:00
|
|
|
|
if(e[4] in this.logLevels) {
|
|
|
|
|
|
this.logLevelsStat[e[4]] = this.logLevelsStat[e[4]] + 1;
|
2021-03-15 21:02:38 +03:00
|
|
|
|
};
|
2021-03-11 18:24:24 +03:00
|
|
|
|
|
|
|
|
|
|
lines.push(
|
2023-11-01 19:48:59 +03:00
|
|
|
|
`<tr class="tr log-${e[4] || 'empty'}"><td class="td left" data-title="#">${e[0]}</td>` +
|
|
|
|
|
|
((e[1]) ? `<td class="td left" data-title="${_('Timestamp')}"><span class="log-timestamp">${e[1]}</span></td>` : '') +
|
2022-05-15 04:39:59 +03:00
|
|
|
|
((e[2]) ? `<td class="td left log-entry-host-cell" data-title="${_('Host')}">${e[2]}</td>` : '') +
|
2023-11-01 19:48:59 +03:00
|
|
|
|
((e[3]) ? `<td class="td left" data-title="${_('Facility')}">${e[3]}</td>` : '') +
|
|
|
|
|
|
((e[4]) ? `<td class="td left" data-title="${_('Level')}">${e[4]}</td>` : '') +
|
2022-05-15 04:39:59 +03:00
|
|
|
|
((e[5]) ? `<td class="td left log-entry-message-cell" data-title="${_('Message')}">${e[5]}</td>` : '') +
|
|
|
|
|
|
`</tr>`
|
2021-03-11 18:24:24 +03:00
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
lines = lines.join('');
|
|
|
|
|
|
|
|
|
|
|
|
logTable.append(
|
2022-05-15 04:39:59 +03:00
|
|
|
|
E('tr', { 'class': 'tr table-titles' }, [
|
|
|
|
|
|
E('th', { 'class': 'th left log-entry-number' }, '#'),
|
|
|
|
|
|
(logdataArray[0][1]) ? E('th', { 'class': 'th left log-entry-time' }, _('Timestamp')) : '',
|
|
|
|
|
|
(logdataArray[0][2]) ? E('th', { 'class': 'th left log-entry-host' }, _('Host')) : '',
|
|
|
|
|
|
(logdataArray[0][4]) ? E('th', { 'class': 'th left log-entry-facility' }, _('Facility')) : '',
|
2023-11-01 19:48:59 +03:00
|
|
|
|
(logdataArray[0][3]) ? E('th', { 'class': 'th left log-entry-log-level' }, _('Level')) : '',
|
2022-05-15 04:39:59 +03:00
|
|
|
|
(logdataArray[0][5]) ? E('th', { 'class': 'th left log-entry-message' }, _('Message')) : '',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
])
|
|
|
|
|
|
);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
logTable.insertAdjacentHTML('beforeend', lines);
|
|
|
|
|
|
} catch(err) {
|
|
|
|
|
|
if(err.name === 'SyntaxError') {
|
|
|
|
|
|
ui.addNotification(null,
|
|
|
|
|
|
E('p', {}, _('HTML/XML error') + ': ' + err.message), 'error');
|
|
|
|
|
|
};
|
|
|
|
|
|
throw err;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let levelsStatString = '';
|
|
|
|
|
|
if((Object.values(this.logLevelsStat).reduce((s,c) => s + c, 0)) > 0) {
|
|
|
|
|
|
Object.entries(this.logLevelsStat).forEach(e => {
|
2021-03-15 21:02:38 +03:00
|
|
|
|
if(e[0] in this.logLevels && e[1] > 0) {
|
2021-03-11 18:24:24 +03:00
|
|
|
|
levelsStatString += `<span class="log-entries-count-level log-${e[0]}" title="${e[0]}">${e[1]}</span>`;
|
|
|
|
|
|
};
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
return E([
|
|
|
|
|
|
E('div', { 'class': 'log-entries-count' },
|
|
|
|
|
|
`${_('Entries')}: ${logdataArray.length} / ${this.totalLogLines}${levelsStatString}`
|
|
|
|
|
|
),
|
2021-04-09 18:10:55 +03:00
|
|
|
|
logTable,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
]);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
downloadLog(ev) {
|
2021-03-11 18:24:24 +03:00
|
|
|
|
let formElems = Array.from(document.forms.logForm.elements);
|
|
|
|
|
|
formElems.forEach(e => e.disabled = true);
|
|
|
|
|
|
|
|
|
|
|
|
return this.getLogData(0).then(logdata => {
|
|
|
|
|
|
logdata = logdata || '';
|
|
|
|
|
|
let link = E('a', {
|
2021-03-15 21:02:38 +03:00
|
|
|
|
'download': this.viewName + '.log',
|
2023-11-01 19:48:59 +03:00
|
|
|
|
'href' : URL.createObjectURL(
|
2021-03-11 18:24:24 +03:00
|
|
|
|
new Blob([ logdata ], { type: 'text/plain' })),
|
|
|
|
|
|
});
|
|
|
|
|
|
link.click();
|
|
|
|
|
|
URL.revokeObjectURL(link.href);
|
|
|
|
|
|
}).catch(() => {
|
|
|
|
|
|
ui.addNotification(null,
|
|
|
|
|
|
E('p', {}, _('Download error') + ': ' + err.message));
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
formElems.forEach(e => e.disabled = false);
|
|
|
|
|
|
});
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
load() {
|
2021-03-11 18:24:24 +03:00
|
|
|
|
// Restoring settings from localStorage
|
|
|
|
|
|
let tailValueLocal = localStorage.getItem(`luci-app-${this.viewName}-tailValue`);
|
|
|
|
|
|
if(tailValueLocal) {
|
|
|
|
|
|
this.tailValue = Number(tailValueLocal);
|
|
|
|
|
|
};
|
|
|
|
|
|
let logSortingLocal = localStorage.getItem(`luci-app-${this.viewName}-logSorting`);
|
|
|
|
|
|
if(logSortingLocal) {
|
|
|
|
|
|
this.logSortingValue = logSortingLocal;
|
|
|
|
|
|
};
|
|
|
|
|
|
return this.getLogData(this.tailValue);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
render(logdata) {
|
2021-03-11 18:24:24 +03:00
|
|
|
|
let logWrapper = E('div', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'id' : 'logWrapper',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'style': 'width:100%; min-height:20em; padding: 0 0 0 45px; font-size:0.9em !important'
|
|
|
|
|
|
}, this.makeLogArea(this.parseLogData(logdata, this.tailValue)));
|
|
|
|
|
|
|
|
|
|
|
|
let tailInput = E('input', {
|
2021-12-05 19:18:32 +03:00
|
|
|
|
'id' : 'tailInput',
|
|
|
|
|
|
'name' : 'tailInput',
|
|
|
|
|
|
'type' : 'text',
|
|
|
|
|
|
'form' : 'logForm',
|
|
|
|
|
|
'class' : 'cbi-input-text',
|
|
|
|
|
|
'style' : 'width:4em !important; min-width:4em !important',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'maxlength': 5,
|
|
|
|
|
|
});
|
|
|
|
|
|
tailInput.value = (this.tailValue === 0) ? null : this.tailValue;
|
|
|
|
|
|
ui.addValidator(tailInput, 'uinteger', true);
|
|
|
|
|
|
|
|
|
|
|
|
let tailReset = E('input', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'type' : 'button',
|
|
|
|
|
|
'form' : 'logForm',
|
2023-02-12 15:10:53 +03:00
|
|
|
|
'class': 'cbi-button btn',
|
|
|
|
|
|
'value': '×',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'click': ev => {
|
|
|
|
|
|
tailInput.value = null;
|
|
|
|
|
|
logFormSubmitBtn.click();
|
|
|
|
|
|
ev.target.blur();
|
|
|
|
|
|
},
|
|
|
|
|
|
'style': 'max-width:4em !important',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
let logHostsDropdownElem = '';
|
|
|
|
|
|
let logFacilitiesDropdownElem = '';
|
|
|
|
|
|
let logLevelsDropdownElem = '';
|
2021-03-27 18:35:35 +03:00
|
|
|
|
if(this.isLevels) {
|
|
|
|
|
|
logLevelsDropdownElem = this.makeLogLevelsDropdownSection();
|
|
|
|
|
|
};
|
2023-11-01 19:48:59 +03:00
|
|
|
|
if(this.isFacilities) {
|
|
|
|
|
|
logFacilitiesDropdownElem = this.makeLogFacilitiesDropdownSection();
|
|
|
|
|
|
};
|
2021-03-27 18:35:35 +03:00
|
|
|
|
if(this.isHosts) {
|
2021-12-05 19:18:32 +03:00
|
|
|
|
logHostsDropdownElem = this.makeLogHostsDropdownSection();
|
2021-03-11 18:24:24 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
let timeFilter = E('input', {
|
|
|
|
|
|
'id' : 'timeFilter',
|
|
|
|
|
|
'name' : 'timeFilter',
|
|
|
|
|
|
'type' : 'text',
|
|
|
|
|
|
'form' : 'logForm',
|
|
|
|
|
|
'class' : 'cbi-input-text',
|
|
|
|
|
|
'placeholder': _('Type an expression...'),
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let msgFilter = E('input', {
|
|
|
|
|
|
'id' : 'msgFilter',
|
|
|
|
|
|
'name' : 'msgFilter',
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'type' : 'text',
|
|
|
|
|
|
'form' : 'logForm',
|
|
|
|
|
|
'class' : 'cbi-input-text',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'placeholder': _('Type an expression...'),
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let logFormSubmitBtn = E('input', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'type' : 'submit',
|
|
|
|
|
|
'form' : 'logForm',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'class': 'cbi-button btn cbi-button-action',
|
|
|
|
|
|
'value': _('Apply'),
|
|
|
|
|
|
'click': ev => ev.target.blur(),
|
|
|
|
|
|
'style': 'margin-right: 1em',
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
let logSorting = E('select', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'id' : 'logSorting',
|
|
|
|
|
|
'name' : 'logSorting',
|
|
|
|
|
|
'form' : 'logForm',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'class': "cbi-input-select",
|
|
|
|
|
|
}, [
|
|
|
|
|
|
E('option', { 'value': 'asc' }, _('ascending')),
|
|
|
|
|
|
E('option', { 'value': 'desc' }, _('descending')),
|
|
|
|
|
|
]);
|
|
|
|
|
|
logSorting.value = this.logSortingValue;
|
|
|
|
|
|
|
|
|
|
|
|
let logDownloadBtn = E('button', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'id' : 'logDownloadBtn',
|
|
|
|
|
|
'name' : 'logDownloadBtn',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'class': 'cbi-button btn',
|
|
|
|
|
|
'click': ui.createHandlerFn(this, this.downloadLog),
|
|
|
|
|
|
}, _('Download log'));
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
let onSubmitForm = () => {
|
|
|
|
|
|
let formElems = Array.from(document.forms.logForm.elements);
|
|
|
|
|
|
formElems.forEach(e => e.disabled = true);
|
|
|
|
|
|
logDownloadBtn.disabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
// Saving settings to localStorage
|
|
|
|
|
|
if(this.tailValue != tailInput.value) {
|
|
|
|
|
|
this.tailValue = (/^[0-9]+$/.test(tailInput.value)) ? tailInput.value : 0;
|
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
|
`luci-app-${this.viewName}-tailValue`, String(this.tailValue));
|
|
|
|
|
|
};
|
|
|
|
|
|
if(this.logSortingValue != logSorting.value) {
|
|
|
|
|
|
this.logSortingValue = logSorting.value;
|
|
|
|
|
|
localStorage.setItem(
|
|
|
|
|
|
`luci-app-${this.viewName}-logSorting`, this.logSortingValue);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
let tail = (tailInput.value && tailInput.value > 0) ? tailInput.value : 0
|
|
|
|
|
|
return this.getLogData(tail).then(logdata => {
|
|
|
|
|
|
logdata = logdata || '';
|
|
|
|
|
|
logWrapper.innerHTML = '';
|
|
|
|
|
|
logWrapper.append(
|
|
|
|
|
|
this.makeLogArea(
|
|
|
|
|
|
this.setMsgFilter(
|
|
|
|
|
|
this.setFacilityFilter(
|
|
|
|
|
|
this.setLevelFilter(
|
|
|
|
|
|
this.setHostFilter(
|
|
|
|
|
|
this.setDateFilter(
|
|
|
|
|
|
this.parseLogData(logdata, tail)
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
)
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if(logdata) {
|
|
|
|
|
|
let timeFilterSection = document.getElementById('timeFilterSection');
|
|
|
|
|
|
if(this.isFacilities && !this.logFacilitiesDropdown) {
|
|
|
|
|
|
logFacilitiesDropdownElem = this.makeLogFacilitiesDropdownSection();
|
|
|
|
|
|
};
|
|
|
|
|
|
if(this.isLevels && !this.logLevelsDropdown) {
|
|
|
|
|
|
timeFilterSection.after(this.makeLogLevelsDropdownSection());
|
|
|
|
|
|
};
|
|
|
|
|
|
if(this.isHosts && !this.logHostsDropdown) {
|
|
|
|
|
|
timeFilterSection.after(this.makeLogHostsDropdownSection());
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
}).finally(() => {
|
|
|
|
|
|
formElems.forEach(e => e.disabled = false);
|
|
|
|
|
|
logDownloadBtn.disabled = false;
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2021-03-11 18:24:24 +03:00
|
|
|
|
return E([
|
|
|
|
|
|
E('h2', { 'id': 'logTitle', 'class': 'fade-in' }, this.title),
|
|
|
|
|
|
E('div', { 'class': 'cbi-section-descr fade-in' }),
|
|
|
|
|
|
E('div', { 'class': 'cbi-section fade-in' },
|
|
|
|
|
|
E('div', { 'class': 'cbi-section-node' }, [
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
E('div', { 'class': 'cbi-value' }, [
|
2021-03-11 18:24:24 +03:00
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'for' : 'tailInput',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
}, _('Last entries')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' }, [
|
|
|
|
|
|
tailInput,
|
|
|
|
|
|
tailReset,
|
|
|
|
|
|
]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
2023-11-01 19:48:59 +03:00
|
|
|
|
E('div', { 'id': 'timeFilterSection', 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
|
|
|
|
|
'for' : 'timeFilter',
|
|
|
|
|
|
}, _('Timestamp filter')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' }, timeFilter),
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
2021-03-26 23:49:38 +03:00
|
|
|
|
logHostsDropdownElem,
|
2023-11-01 19:48:59 +03:00
|
|
|
|
logFacilitiesDropdownElem,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
logLevelsDropdownElem,
|
|
|
|
|
|
|
|
|
|
|
|
E('div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2023-11-01 19:48:59 +03:00
|
|
|
|
'for' : 'msgFilter',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
}, _('Message filter')),
|
2023-11-01 19:48:59 +03:00
|
|
|
|
E('div', { 'class': 'cbi-value-field' }, msgFilter),
|
2021-03-11 18:24:24 +03:00
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
|
|
E('div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'for' : 'logSorting',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
}, _('Sorting entries')),
|
|
|
|
|
|
E('div', { 'class': 'cbi-value-field' }, logSorting,),
|
|
|
|
|
|
]),
|
|
|
|
|
|
|
|
|
|
|
|
E('div', { 'class': 'cbi-value' }, [
|
|
|
|
|
|
E('label', {
|
|
|
|
|
|
'class': 'cbi-value-title',
|
2022-05-23 22:01:50 +03:00
|
|
|
|
'for' : 'logFormSubmitBtn',
|
2021-03-26 23:49:38 +03:00
|
|
|
|
}, _('Refresh log')),
|
2021-03-11 18:24:24 +03:00
|
|
|
|
E('div', { 'class': 'cbi-value-field' }, [
|
|
|
|
|
|
logFormSubmitBtn,
|
2022-05-23 22:01:50 +03:00
|
|
|
|
E('input', {
|
|
|
|
|
|
'id' : 'logFormSubmitBtn',
|
|
|
|
|
|
'type': 'hidden',
|
|
|
|
|
|
}),
|
2021-03-11 18:24:24 +03:00
|
|
|
|
E('form', {
|
2021-11-04 18:57:08 +03:00
|
|
|
|
'id' : 'logForm',
|
|
|
|
|
|
'name' : 'logForm',
|
|
|
|
|
|
'style' : 'display:inline-block; margin-top:0.5em',
|
2021-03-11 18:24:24 +03:00
|
|
|
|
'submit': ui.createHandlerFn(this, function(ev) {
|
|
|
|
|
|
ev.preventDefault();
|
2023-11-01 19:48:59 +03:00
|
|
|
|
return onSubmitForm();
|
2021-03-11 18:24:24 +03:00
|
|
|
|
}),
|
|
|
|
|
|
}, E('span', {}, ' ')),
|
|
|
|
|
|
]),
|
|
|
|
|
|
]),
|
|
|
|
|
|
])
|
|
|
|
|
|
),
|
|
|
|
|
|
E('div', { 'class': 'cbi-section fade-in' },
|
2021-03-15 21:02:38 +03:00
|
|
|
|
E('div', { 'class': 'cbi-section-node' }, [
|
|
|
|
|
|
E('div', { 'style': 'position:fixed; z-index:1 !important' }, [
|
|
|
|
|
|
E('button', {
|
|
|
|
|
|
'class': 'btn',
|
|
|
|
|
|
'style': 'position:relative; display:block; margin:0 !important; left:1px; top:1px',
|
|
|
|
|
|
'click': ev => {
|
|
|
|
|
|
document.getElementById('logTitle').scrollIntoView(true);
|
|
|
|
|
|
ev.target.blur();
|
|
|
|
|
|
},
|
|
|
|
|
|
}, '↑'),
|
|
|
|
|
|
E('button', {
|
|
|
|
|
|
'class': 'btn',
|
|
|
|
|
|
'style': 'position:relative; display:block; margin:0 !important; margin-top:1px !important; left:1px; top:1px',
|
|
|
|
|
|
'click': ev => {
|
|
|
|
|
|
logWrapper.scrollIntoView(false);
|
|
|
|
|
|
ev.target.blur();
|
|
|
|
|
|
},
|
|
|
|
|
|
}, '↓'),
|
|
|
|
|
|
]),
|
|
|
|
|
|
logWrapper,
|
|
|
|
|
|
])
|
2021-03-11 18:24:24 +03:00
|
|
|
|
),
|
|
|
|
|
|
E('div', { 'class': 'cbi-section fade-in' },
|
|
|
|
|
|
E('div', { 'class': 'cbi-section-node' },
|
|
|
|
|
|
E('div', { 'class': 'cbi-value' },
|
2021-03-15 21:02:38 +03:00
|
|
|
|
E('div', { 'style': 'width:100%; text-align:right !important' }, logDownloadBtn)
|
|
|
|
|
|
),
|
2021-03-11 18:24:24 +03:00
|
|
|
|
)
|
|
|
|
|
|
),
|
|
|
|
|
|
]);
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
handleSaveApply: null,
|
2021-12-05 19:18:32 +03:00
|
|
|
|
handleSave : null,
|
2021-11-04 18:57:08 +03:00
|
|
|
|
handleReset : null,
|
2021-03-11 18:24:24 +03:00
|
|
|
|
}),
|
|
|
|
|
|
})
|