luci-app: Updated log

This commit is contained in:
gSpot
2021-04-09 18:10:55 +03:00
parent 4695d9cb9e
commit fc03a4b87e
2 changed files with 11 additions and 4 deletions
@@ -96,7 +96,7 @@ return L.Class.extend({
view: L.view.extend({
/**
* View name (for local storage).
* View name (for local storage and downloads).
* Must be overridden by a subclass!
*/
viewName: null,
@@ -250,6 +250,10 @@ return L.Class.extend({
return cArr;
},
regexpFilterHighlightFunc: function(match) {
return `<span class="log-highlight-item">${match}</span>`;
},
setRegexpFilter: function(cArr) {
let fPattern = document.getElementById('logFilter').value;
if(!fPattern) {
@@ -257,12 +261,15 @@ return L.Class.extend({
};
let fArr = [];
try {
let regExp = new RegExp(`(${fPattern})`, 'giu');
let regExp = new RegExp(fPattern, 'giu');
cArr.forEach((e, i) => {
if(e[5] !== null && regExp.test(e[5])) {
e[5] = e[5].replace(regExp, '<span class="log-highlight-item">$1</span>');
if(this.regexpFilterHighlightFunc) {
e[5] = e[5].replace(regExp, this.regexpFilterHighlightFunc);
};
fArr.push(e);
};
regExp.lastIndex = 0;
});
} catch(err) {
if(err.name === 'SyntaxError') {
@@ -338,7 +345,7 @@ return L.Class.extend({
E('div', { 'class': 'log-entries-count' },
`${_('Entries')}: ${logdataArray.length} / ${this.totalLogLines}${levelsStatString}`
),
logTable
logTable,
]);
},
Binary file not shown.