From 38473b1e905b3a2676c2490a27d64aacad115d69 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 20 Nov 2026 19:52:45 +0800 Subject: [PATCH] feat: make the ignore rule dialog and the ignored checks clearer (#1255) (#1260) * feat: make the ignore rule dialog and the ignored checks clearer In the ignore rule dialog, "Ignore for" becomes "Expiration" and "Entire check" becomes "All resources". Editing an expired rule now opens with a warning at the top that says when it expired, and only its expiration can change until a new one is set. The warning that the rule stays expired, shown at the bottom after a change, is gone. In the Components table, "+ N ignored" is a link like "+ N more" and shows that check's ignored resources. The checkbox only brings back the checks ignored as a whole, reads "Show ignored checks" and counts them in a badge. Checks with anything ignored get the warning banner's background, and the filter also finds ignored resources. * fix: put Expiration first and keep a locked Scope from changing An expired rule's fields wait for a new expiration, so Expiration is now the first field of the dialog instead of coming after the fields it unlocks. The shell's RadioGroup still takes the Up and Down keys once it is clicked, even when it is disabled or in view mode. So on an expired rule a click and Up switched the locked Scope, and Save then widened a rule for some resources to the whole check. The dialog now ignores a scope change while the rule is locked or only viewed. --------- (cherry picked from commit 97ce1e90f6b2dcf6851047c0dcf0d4f655ed0530) Signed-off-by: Marcelo Fukumoto Co-authored-by: Marcelo Fukumoto --- .../health/ComponentChecksTable.vue | 87 +++++--- .../components/health/HealthSummaryTable.vue | 46 +++-- .../components/health/IgnoreRuleModal.vue | 87 ++++---- .../health/__tests__/health.test.js | 190 +++++++++++++----- pkg/harvester/l10n/en-us.yaml | 11 +- pkg/harvester/utils/component-health.js | 14 +- 6 files changed, 271 insertions(+), 164 deletions(-) diff --git a/pkg/harvester/components/health/ComponentChecksTable.vue b/pkg/harvester/components/health/ComponentChecksTable.vue index 419d843a..ce82acc2 100644 --- a/pkg/harvester/components/health/ComponentChecksTable.vue +++ b/pkg/harvester/components/health/ComponentChecksTable.vue @@ -10,7 +10,7 @@ import { _CREATE, _EDIT, _VIEW } from '@shell/config/query-params'; import { HCI } from '../../types'; import { AFFECTED_RESOURCES_TRUNCATE_COUNT, MESSAGE_TRUNCATE_LENGTH, activeAffectedResourceNames, affectedResourceLabel, - allAffectedResourceNames, ignoreRuleName, ignoredResourceCount, resourceIgnoredBy, severityColor + allAffectedResourceNames, hasIgnored, ignoreRuleName, ignoredResourceCount, resourceIgnoredBy, severityColor } from '../../utils/component-health'; const props = defineProps({ @@ -22,10 +22,6 @@ const props = defineProps({ type: Array, default: () => [], }, - showIgnored: { - type: Boolean, - default: false, - }, // what is typed in the filter box of the table this one sits in filterText: { type: String, @@ -133,9 +129,17 @@ const hasActions = computed(() => rowsWithActions.value.some((row) => row.availa const expandedMessageIds = ref([]); const expandedResourceIds = ref([]); +const shownIgnoredIds = ref([]); -function affectedResourceNames(row) { - return props.showIgnored ? allAffectedResourceNames(row) : activeAffectedResourceNames(row); +// a check ignored as a whole lists all its resources, the others only the ones still reported +function listedResourceNames(row) { + return row.ignored ? allAffectedResourceNames(row) : activeAffectedResourceNames(row); +} + +function ignoredResourceNames(row) { + const active = activeAffectedResourceNames(row); + + return allAffectedResourceNames(row).filter((name) => !active.includes(name)); } // called from the template, where the refs are unwrapped, so the array is changed in place @@ -157,23 +161,25 @@ function displayedMessage(row, message) { return expandedMessageIds.value.includes(row.id) || !isMessageTruncated(message) ? message : message.slice(0, MESSAGE_TRUNCATE_LENGTH); } +// the ignored resources come after the others, once their link is used function visibleAffectedResourceNames(row) { - const names = affectedResourceNames(row); + const names = listedResourceNames(row); + const shown = expandedResourceIds.value.includes(row.id) ? names : names.slice(0, AFFECTED_RESOURCES_TRUNCATE_COUNT); - return expandedResourceIds.value.includes(row.id) ? names : names.slice(0, AFFECTED_RESOURCES_TRUNCATE_COUNT); + return shownIgnoredIds.value.includes(row.id) ? [...shown, ...ignoredResourceNames(row)] : shown; } function remainingAffectedResourcesCount(row) { - return Math.max(affectedResourceNames(row).length - AFFECTED_RESOURCES_TRUNCATE_COUNT, 0); + return Math.max(listedResourceNames(row).length - AFFECTED_RESOURCES_TRUNCATE_COUNT, 0); } function isResourceIgnored(row, name) { return row.ignored || !!resourceIgnoredBy(row, name); } -// the ignored resources that are left out of the list -function hiddenIgnoredCount(row) { - return props.showIgnored ? 0 : ignoredResourceCount(row); +// the ignored resources of a check that is still reported, which have a link of their own +function ignoredLinkCount(row) { + return row.ignored ? 0 : ignoredResourceCount(row); } @@ -204,7 +210,7 @@ function hiddenIgnoredCount(row) { />