Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
fix(bridge): Correctly show warning state (#6003)
Browse files Browse the repository at this point in the history
Signed-off-by: Klaus Strießnig <k.striessnig@gmail.com>
  • Loading branch information
Kirdock committed Nov 23, 2021
1 parent 1ae06a1 commit 9a21d19
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 8 deletions.
Expand Up @@ -3,7 +3,8 @@
<ktb-selectable-tile
(click)="selectEvent(sequence)"
[error]="sequence.isFinished() && sequence.isFaulty()"
[success]="sequence.isFinished() && !sequence.isFaulty()"
[warning]="sequence.isFinished() && sequence.isWarning()"
[success]="sequence.isSuccessful()"
[highlight]="sequence.hasPendingApproval()"
[selected]="_selectedEvent == sequence"
[attr.uitestid]="'keptn-root-events-list-' + sequence.shkeptncontext"
Expand Down
Expand Up @@ -45,6 +45,15 @@
background: $cta-color;
}

&.ktb-tile-warning:hover .ktb-selectable-tile-container,
&.ktb-tile-warning .ktb-selectable-tile-container {
border-color: $warning-color;
}

&.ktb-tile-selected.ktb-tile-warning .ktb-selectable-tile-container:before {
background: $warning-color;
}

&.ktb-tile-highlight:hover .ktb-selectable-tile-container,
&.ktb-tile-highlight .ktb-selectable-tile-container {
border-color: $blue-400;
Expand Down
Expand Up @@ -11,7 +11,9 @@ <h2>Sequences</h2>
<ng-template #finished>
<dt-icon
name="criticalevent"
[class]="sequence.isFaulty(this.stage) ? 'error' : 'success'"
[class.error]="sequence.isFaulty(this.stage)"
[class.warning]="sequence.isWarning(this.stage)"
[class.success]="sequence.isSuccessful(this.stage)"
class="event-icon"
></dt-icon>
</ng-template>
Expand All @@ -25,6 +27,7 @@ <h2>Sequences</h2>
class="event-icon"
[class.error]="subSequence.result === ResultTypes.FAILED"
[class.success]="subSequence.result === ResultTypes.PASSED"
[class.warning]="subSequence.result === ResultTypes.WARNING"
[class.highlight]="subSequence.hasPendingApproval"
[name]="getEventIcon(subSequence)"
></dt-icon>
Expand Down
Expand Up @@ -5,6 +5,7 @@
class="event-icon"
[name]="sequence.getIcon()"
[class.success]="sequence.isSuccessful()"
[class.warning]="sequence.isWarning()"
[class.error]="sequence.isFaulty()"
[class.highlight]="sequence.hasPendingApproval()"
></dt-icon>
Expand Down
Expand Up @@ -19,6 +19,7 @@
[class.error]="currentSequence.isFaulty(stage)"
[class.success]="currentSequence.isSuccessful(stage)"
[class.highlight]="currentSequence.hasPendingApproval(stage)"
[class.warning]="currentSequence.isWarning(stage)"
></dt-icon>
<ng-template #showLoading>
<button
Expand Down
Expand Up @@ -19,6 +19,7 @@
[name]="currentSequence.getIcon()"
[class.error]="currentSequence.isFaulty(service.stage)"
[class.success]="currentSequence.isSuccessful(service.stage)"
[class.warning]="currentSequence.isWarning(service.stage)"
[class.highlight]="currentSequence.hasPendingApproval(service.stage)"
></dt-icon>
<ng-template #showLoading>
Expand Down
15 changes: 9 additions & 6 deletions bridge/client/app/_models/sequence.ts
@@ -1,11 +1,11 @@
import { ResultTypes } from '../../../shared/models/result-types';
import { Trace } from './trace';
import { EventTypes } from '../../../shared/interfaces/event-types';
import { EvaluationResult } from '../../../shared/interfaces/evaluation-result';
import { EVENT_ICONS } from './event-icons';
import { RemediationAction } from '../../../shared/models/remediation-action';
import { Sequence as sq, SequenceStage, SequenceState } from '../../../shared/models/sequence';
import { DtIconType } from '@dynatrace/barista-icons';
import { ResultTypes } from '../../../shared/models/result-types';

type SeqStage = SequenceStage & {
latestEvaluationTrace?: Trace;
Expand Down Expand Up @@ -102,13 +102,16 @@ export class Sequence extends sq {
}

public isSuccessful(stageName?: string): boolean {
return stageName
? !this.isFaulty(stageName) && this.isFinished(stageName)
: this.state === SequenceState.FINISHED && !this.isFaulty();
return !this.isFaulty(stageName) && !this.isWarning(stageName) && this.isFinished(stageName);
}

public isWarning(stageName: string): boolean {
return this.getStage(stageName)?.latestEvaluation?.result === ResultTypes.WARNING;
public isWarning(stageName?: string): boolean {
return (
!this.isFaulty(stageName) &&
(stageName
? this.getStage(stageName)?.latestEvaluation?.result === ResultTypes.WARNING
: this.stages.some((st) => st.latestEvaluation?.result === ResultTypes.WARNING))
);
}

public isWaiting(): boolean {
Expand Down

0 comments on commit 9a21d19

Please sign in to comment.