mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 06:30:59 +00:00
luci-app: Updated log
This commit is contained in:
@@ -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.
Reference in New Issue
Block a user