mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-22 00:27:38 +08:00
feat: make the ignore rule dialog and the ignored checks clearer (#1255)
* 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. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * 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. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com>
This commit is contained in:
1 parent
f3ca9e4c44
commit
97ce1e90f6
6 files changed
+271
-164
No files matched your search
@@ -73,17 +73,9 @@ export function ignoredResourceCount(row) {
|
||||
return allAffectedResourceNames(row).length - activeAffectedResourceNames(row).length;
|
||||
}
|
||||
|
||||
// what "Show ignored" brings back: the checks ignored as a whole, and the ignored resources of the other checks
|
||||
export function ignoredCounts(checks) {
|
||||
return (checks || []).reduce((counts, check) => {
|
||||
if (check.ignored) {
|
||||
counts.checks += 1;
|
||||
} else {
|
||||
counts.resources += ignoredResourceCount(check);
|
||||
}
|
||||
|
||||
return counts;
|
||||
}, { checks: 0, resources: 0 });
|
||||
// the check is ignored as a whole, or some of its resources are
|
||||
export function hasIgnored(check) {
|
||||
return !!check?.ignored || ignoredResourceCount(check) > 0;
|
||||
}
|
||||
|
||||
// the UI keeps one rule per check under this name, so Kubernetes refuses a second one for the same check.
|
||||
|
||||
Reference in new issue
Block a user