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 97ce1e90f6)

Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
Co-authored-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
This commit is contained in:
mergify[bot]andMarcelo Fukumoto authored and GitHub committed 2026-11-20 19:52:45 +08:00
1 parent 47a9de7661
commit 38473b1e90
6 files changed
+271 -164

No files matched your search

@@ -8,13 +8,14 @@ import { exceptionToErrorsArray } from '@shell/utils/error';
import Banner from '@components/Banner/Banner.vue';
import { BadgeState } from '@components/BadgeState';
import { Checkbox } from '@components/Form/Checkbox';
import { RcCounterBadge } from '@components/Pill';
import { RcButton } from '@components/RcButton';
import { useModal } from '@components/RcModal';
import ComponentChecksTable from './ComponentChecksTable.vue';
import IgnoreRuleModal from './IgnoreRuleModal.vue';
import {
COMPONENT_HEALTH_SEVERITIES, HEALTH_SUMMARY_SEVERITY_RANK, activeAffectedResourceNames, affectedResourceKind,
affectedResourceLabel, allAffectedResourceNames, componentOf, healthSummarySeverity, ignoredCounts, severityColor
COMPONENT_HEALTH_SEVERITIES, HEALTH_SUMMARY_SEVERITY_RANK, affectedResourceKind, affectedResourceLabel,
allAffectedResourceNames, componentOf, healthSummarySeverity, severityColor
} from '../../utils/component-health';
const store = useStore();
@@ -111,22 +112,13 @@ const shownChecks = computed(() => checks.value.filter((check) => showIgnored.va
check.affectedResources?.apiVersion,
affectedResourceKind(check),
affectedResourceLabel(check, store),
...(showIgnored.value ? allAffectedResourceNames(check) : activeAffectedResourceNames(check)),
// the ignored resources too, they are behind a link like the ones past the first few
...allAffectedResourceNames(check),
].join(' ').toLowerCase(),
})));
const ignored = computed(() => ignoredCounts(checks.value));
const hasIgnored = computed(() => ignored.value.checks + ignored.value.resources > 0);
// says what turning it on brings back, the same whether it is on or off
const showIgnoredLabel = computed(() => {
const counts = [
ignored.value.checks && t('harvester.dashboard.sections.componentHealth.ignoredChecks', { count: ignored.value.checks }),
ignored.value.resources && t('harvester.dashboard.sections.componentHealth.ignoredResources', { count: ignored.value.resources }),
].filter(Boolean).join(', ');
return t('harvester.dashboard.sections.componentHealth.showIgnored', { counts });
});
// the checks ignored as a whole, the ones the checkbox brings back
const ignoredCheckCount = computed(() => checks.value.filter((check) => check.ignored).length);
const rows = computed(() => {
const result = [];
@@ -212,14 +204,25 @@ function collapseAll() {
>
<template #header-left>
<div
v-if="hasIgnored"
v-if="ignoredCheckCount"
class="show-ignored"
>
<!-- the label holds the badge, so the checkbox is named here -->
<Checkbox
v-model:value="showIgnored"
type="checkbox"
:label="showIgnoredLabel"
/>
:alternate-label="`${ t('harvester.dashboard.sections.componentHealth.showIgnored') } ${ ignoredCheckCount }`"
>
<template #label>
<span class="show-ignored-label">
{{ t('harvester.dashboard.sections.componentHealth.showIgnored') }}
<RcCounterBadge
:count="ignoredCheckCount"
type="inactive"
/>
</span>
</template>
</Checkbox>
</div>
</template>
<template #header-right>
@@ -267,7 +270,6 @@ function collapseAll() {
class="sub-table"
:rows="row.checks"
:ignore-rules="ignoreRules"
:show-ignored="showIgnored"
:filter-text="filterText"
:load-failed="!!loadErrors.componentHealths"
@open-rule="openRuleModal"
@@ -292,6 +294,12 @@ function collapseAll() {
height: 100%;
}
.show-ignored-label {
display: inline-flex;
align-items: center;
gap: 6px;
}
.expand-actions {
display: flex;
align-items: center;