mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
* properly expand and collapse filtered groups
Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
parent
7815e06f4b
commit
ab5cc3f6ea
1 changed files with 13 additions and 6 deletions
|
@ -1,10 +1,15 @@
|
||||||
function expandAll() {
|
function expandAll() {
|
||||||
$(".group-heading").show()
|
$('.group-heading').each(function () {
|
||||||
$('.collapse').addClass('show');
|
let style = $(this).attr("style")
|
||||||
|
// display only elements that are currently visible
|
||||||
|
if (style === "display: none;") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
$(this).next().addClass('show')
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function collapseAll() {
|
function collapseAll() {
|
||||||
$(".group-heading").show()
|
|
||||||
$('.collapse').removeClass('show');
|
$('.collapse').removeClass('show');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +34,9 @@ function debounce(func, delay) {
|
||||||
|
|
||||||
$('#search').on("keyup", debounce(search, 500));
|
$('#search').on("keyup", debounce(search, 500));
|
||||||
|
|
||||||
|
// search shows or hides groups&rules that satisfy the search phrase.
|
||||||
|
// case-insensitive, respects GET param `search`.
|
||||||
function search() {
|
function search() {
|
||||||
$(".rule-table").removeClass('show');
|
|
||||||
$(".rule").show();
|
$(".rule").show();
|
||||||
|
|
||||||
let groupHeader = $(".group-heading")
|
let groupHeader = $(".group-heading")
|
||||||
|
@ -41,6 +47,7 @@ function search() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$(".rule-table").removeClass('show');
|
||||||
groupHeader.hide()
|
groupHeader.hide()
|
||||||
|
|
||||||
searchPhrase = searchPhrase.toLowerCase()
|
searchPhrase = searchPhrase.toLowerCase()
|
||||||
|
@ -79,7 +86,7 @@ function filterGroupsByName(searchPhrase) {
|
||||||
|
|
||||||
function filterRuleByName(searchPhrase) {
|
function filterRuleByName(searchPhrase) {
|
||||||
$(".rule").each(function () {
|
$(".rule").each(function () {
|
||||||
const ruleName = $(this).attr("data-rule-name");
|
const ruleName = $(this).attr("data-rule-name").toLowerCase();
|
||||||
const hasValue = ruleName.indexOf(searchPhrase) >= 0
|
const hasValue = ruleName.indexOf(searchPhrase) >= 0
|
||||||
|
|
||||||
if (!hasValue) {
|
if (!hasValue) {
|
||||||
|
@ -97,7 +104,7 @@ function filterRuleByName(searchPhrase) {
|
||||||
function filterRuleByLabels(searchPhrase) {
|
function filterRuleByLabels(searchPhrase) {
|
||||||
$(".rule").each(function () {
|
$(".rule").each(function () {
|
||||||
const matches = $(".label", this).filter(function () {
|
const matches = $(".label", this).filter(function () {
|
||||||
const label = $(this).text();
|
const label = $(this).text().toLowerCase();
|
||||||
return label.indexOf(searchPhrase) >= 0;
|
return label.indexOf(searchPhrase) >= 0;
|
||||||
}).length;
|
}).length;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue