From fa4819b353c07cff4d20e13e4d6a32f82f8b012f Mon Sep 17 00:00:00 2001 From: ronahk <74967920+ronahk@users.noreply.github.com> Date: Mon, 28 Nov 2022 13:02:16 +0200 Subject: [PATCH] Update installed charts number according to filter (#121) --- pkg/dashboard/static/list-view.js | 1 - pkg/dashboard/static/scripts.js | 10 ++++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkg/dashboard/static/list-view.js b/pkg/dashboard/static/list-view.js index 5798b2e..9fd10f5 100644 --- a/pkg/dashboard/static/list-view.js +++ b/pkg/dashboard/static/list-view.js @@ -8,7 +8,6 @@ function loadChartsList() { reportError("Failed to get list of charts", xhr) }).done(function (data) { chartsCards.empty().hide() - $("#installedList .header h2 span").text(data.length) const usedNS = {} data.forEach(function (elm) { let card = buildChartCard(elm); diff --git a/pkg/dashboard/static/scripts.js b/pkg/dashboard/static/scripts.js index e396886..a74c3b8 100644 --- a/pkg/dashboard/static/scripts.js +++ b/pkg/dashboard/static/scripts.js @@ -328,11 +328,17 @@ function filterInstalledList(list) { let filterStr = $("#installedSearch").val().toLowerCase(); let filteredNamespaces = getHashParam("filteredNamespace") let anyShown = false; + let installedCount = 0; + list.each(function (ix, card) { - anyShown |= showHideInstalledRelease($(card), filteredNamespaces, filterStr) + anyShown = showHideInstalledRelease($(card), filteredNamespaces, filterStr) + if (anyShown) { + installedCount++; + } }) - if (list.length && !anyShown) { + $("#installedList .header h2 span").text(installedCount) + if (list.length && !installedCount) { warnMsg.show() } }