fix regex-based text filter

This commit is contained in:
Alexander Zobnin
2018-01-27 13:26:14 +03:00
parent 7a517be6e1
commit 48a003a930
8 changed files with 26 additions and 14 deletions

View File

@@ -54,7 +54,7 @@ function handleText(history, items, target, addHostName = true) {
return convertHistory(history, items, addHostName, convertTextCallback);
}
function handleHistoryAsTable(history, items) {
function handleHistoryAsTable(history, items, target) {
let table = new TableModel();
table.addColumn({text: 'Host'});
table.addColumn({text: 'Item'});
@@ -66,6 +66,12 @@ function handleHistoryAsTable(history, items) {
let itemHistory = grouped_history[item.itemid] || [];
let lastPoint = _.last(itemHistory);
let lastValue = lastPoint ? lastPoint.value : null;
// Regex-based extractor
if (target.textFilter) {
lastValue = extractText(lastValue, target.textFilter, target.useCaptureGroups);
}
let host = _.first(item.hosts);
host = host ? host.name : "";