-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core/managed): show failed, pending bubbles for any constraint type #8611
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import { | |
} from '../domain/IManagedEntity'; | ||
import { Icon } from '../presentation'; | ||
|
||
import { isConstraintSupported, getConstraintIcon } from './constraints/constraintRegistry'; | ||
|
||
import { ISelectedArtifactVersion } from './Environments'; | ||
import { Pill } from './Pill'; | ||
import { IStatusBubbleStackProps, StatusBubbleStack } from './StatusBubbleStack'; | ||
|
@@ -134,14 +136,29 @@ function getArtifactStatuses({ environments }: IManagedArtifactVersion): Artifac | |
// NOTE: The order in which entries are added to `statuses` is important. The highest priority | ||
// item must be inserted first. | ||
|
||
const isConstraintPendingManualJudgement = (constraint: IStatefulConstraint) => | ||
constraint.type == 'manual-judgement' && constraint.status == StatefulConstraintStatus.PENDING; | ||
const requiresManualApproval = environments.some((environment) => | ||
environment.statefulConstraints?.some(isConstraintPendingManualJudgement), | ||
const pendingConstraintTypes = new Set<string>(); | ||
const failedConstraintTypes = new Set<string>(); | ||
|
||
environments.forEach((environment) => | ||
environment.statefulConstraints?.forEach(({ type, status }: IStatefulConstraint) => { | ||
if (!isConstraintSupported(type)) { | ||
return; | ||
} | ||
|
||
if (status === StatefulConstraintStatus.PENDING) { | ||
pendingConstraintTypes.add(type); | ||
} else if (status === StatefulConstraintStatus.FAIL || status === StatefulConstraintStatus.OVERRIDE_FAIL) { | ||
failedConstraintTypes.add(type); | ||
} | ||
}), | ||
); | ||
if (requiresManualApproval) { | ||
statuses.push({ appearance: 'progress', iconName: 'manualJudgement' }); | ||
} | ||
|
||
pendingConstraintTypes.forEach((type) => { | ||
statuses.push({ appearance: 'progress', iconName: getConstraintIcon(type) }); | ||
}); | ||
failedConstraintTypes.forEach((type) => { | ||
statuses.push({ appearance: 'error', iconName: getConstraintIcon(type) }); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way I've setup the logic here is that we will reduce all the constraints across all the environments into a list of their unique types – so let's say there are three pending manual judgements across three environments, we'll show one single pending manual judgement bubble. If there were any failed manual judgements, we'd show one single error manual judgement bubble. So you'll see that some environments have a constraint in that state, but no context about how many. Same is true for pinning right now. Longer term we may need to think about supporting quantities on these bubbles so we could e.g. have a pending manual judgement bubble with a little "2" to indicate that there are two environments with that constraint status. |
||
|
||
const isPinned = environments.some(({ pinned }) => pinned); | ||
if (isPinned) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the way i'm stacking these right now is: