Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,18 @@ function updateDetailsPanel(nodeId, nodeDetails) {
var showStageTask = document.getElementById("stageId-and-taskId-checkbox")
&& document.getElementById("stageId-and-taskId-checkbox").checked;

var totalMetrics = (details.metrics ? details.metrics.length : 0) +
(details.children || []).reduce(function (sum, childId) {
var child = nodeDetails[childId];
return sum + (child && child.metrics ? child.metrics.length : 0);
}, 0);

var html = "";
// Add search box when there are many metrics
if (totalMetrics > 5) {
html += '<input type="text" id="metric-search" class="form-control form-control-sm mb-2" ' +
'placeholder="Filter metrics...">';
}
if (details.metrics && details.metrics.length > 0) {
html += buildMetricsTable(details.metrics, showStageTask, true);
} else if (!details.children) {
Expand Down Expand Up @@ -468,6 +479,18 @@ function updateDetailsPanel(nodeId, nodeDetails) {
sorttable.makeSortable(table);
});
}

// Wire up metric search/filter
var searchBox = document.getElementById("metric-search");
if (searchBox) {
searchBox.addEventListener("input", function () {
var query = this.value.toLowerCase();
bodyEl.querySelectorAll("table tbody tr").forEach(function (row) {
var metricName = row.cells[0] ? row.cells[0].textContent.toLowerCase() : "";
row.style.display = metricName.indexOf(query) >= 0 ? "" : "none";
});
});
}
}

function htmlEscape(str) {
Expand Down