Skip to content

Commit c4b8e5f

Browse files
committed
fix: refine stacked mode critical/unhealthy toggle filters
1 parent a494f6e commit c4b8e5f

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

src/components/stage/index.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ const Stage = ({
133133
const sigs = levels.reduce(
134134
(acc, { steps = [] }) => ({
135135
...acc,
136-
...steps.reduce(
137-
(acc, { id, signals = [] }) => ({
136+
...steps.reduce((acc, { id, signals = [], excluded, status }) => {
137+
const isInExcludedStep = excluded === true;
138+
const isInHealthyStep = status === 'unknown' || status === 'success';
139+
return {
138140
...acc,
139141
...signals.reduce((acc, { guid, name, status, type }) => {
140142
const isInSelectedStep =
@@ -150,12 +152,13 @@ const Stage = ({
150152
statusIndex: ORDERED_STATUSES.indexOf(status),
151153
typeIndex: ORDERED_SIGNAL_TYPES.indexOf(type),
152154
isInSelectedStep,
155+
isInExcludedStep,
156+
isInHealthyStep,
153157
},
154158
};
155159
}, {}),
156-
}),
157-
{}
158-
),
160+
};
161+
}, {}),
159162
}),
160163
{}
161164
);
@@ -175,10 +178,23 @@ const Stage = ({
175178
.filter((s) => {
176179
switch (expandOption) {
177180
case SIGNAL_EXPAND.UNHEALTHY_ONLY:
178-
return s.statusIndex < SUCCESS_STATUS_INDEX;
181+
return (
182+
!s.isInExcludedStep &&
183+
!s.isInHealthyStep &&
184+
s.statusIndex < SUCCESS_STATUS_INDEX
185+
);
179186
case SIGNAL_EXPAND.CRITICAL_ONLY:
187+
return (
188+
!s.isInExcludedStep &&
189+
!s.isInHealthyStep &&
190+
s.statusIndex === CRITICAL_STATUS_INDEX
191+
);
180192
case SIGNAL_EXPAND.UNHEALTHY_ONLY | SIGNAL_EXPAND.CRITICAL_ONLY:
181-
return s.statusIndex === CRITICAL_STATUS_INDEX;
193+
return (
194+
!s.isInExcludedStep &&
195+
!s.isInHealthyStep &&
196+
s.statusIndex === CRITICAL_STATUS_INDEX
197+
);
182198
default:
183199
return true;
184200
}

0 commit comments

Comments
 (0)