Skip to content

Commit

Permalink
Merge pull request opendatahub-io#2903 from jenny-s51/RHOAIENG-7428
Browse files Browse the repository at this point in the history
[RHOAIENG-7428]: update pipelineRunLabel to apply correct colors
  • Loading branch information
openshift-merge-bot[bot] authored Jun 12, 2024
2 parents c720c3c + 2450f44 commit 7725a1f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const PipelineDetailsTitle: React.FC<RunJobTitleProps> = ({
statusIcon,
pipelineRunLabel,
}) => {
const { icon, label } = computeRunStatus(run);
const { icon, label, color } = computeRunStatus(run);

const isArchived = run.storage_state === StorageStateKF.ARCHIVED;

Expand All @@ -30,7 +30,9 @@ const PipelineDetailsTitle: React.FC<RunJobTitleProps> = ({
)}
{statusIcon && (
<SplitItem>
<Label icon={icon}>{label}</Label>
<Label color={color} icon={icon}>
{label}
</Label>
</SplitItem>
)}
{isArchived && (
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/concepts/pipelines/content/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
QuestionCircleIcon,
SyncAltIcon,
} from '@patternfly/react-icons';
import { Icon } from '@patternfly/react-core';
import { Icon, LabelProps } from '@patternfly/react-core';
import {
PipelineCoreResourceKFv2,
PipelineRunJobKFv2,
Expand All @@ -20,6 +20,7 @@ import { relativeTime } from '~/utilities/time';
export type RunStatusDetails = {
icon: React.ReactNode;
label: PipelineRunKFv2['state'] | string;
color?: LabelProps['color'];
status?: React.ComponentProps<typeof Icon>['status'];
details?: string;
createdAt?: string;
Expand All @@ -36,6 +37,7 @@ export const computeRunStatus = (run?: PipelineRunKFv2 | null): RunStatusDetails
let status: React.ComponentProps<typeof Icon>['status'];
let details: string | undefined;
let label: string;
let color: LabelProps['color'];
const createdAt = relativeTime(Date.now(), new Date(run.created_at).getTime());

switch (run.state) {
Expand All @@ -56,11 +58,13 @@ export const computeRunStatus = (run?: PipelineRunKFv2 | null): RunStatusDetails
case RuntimeStateKF.SUCCEEDED:
icon = <CheckCircleIcon />;
status = 'success';
color = 'green';
label = runtimeStateLabels[RuntimeStateKF.SUCCEEDED];
break;
case RuntimeStateKF.FAILED:
icon = <ExclamationCircleIcon />;
status = 'danger';
color = 'red';
label = runtimeStateLabels[RuntimeStateKF.FAILED];
details = run.error?.message;
break;
Expand All @@ -83,7 +87,7 @@ export const computeRunStatus = (run?: PipelineRunKFv2 | null): RunStatusDetails
details = run.state;
}

return { icon, label, status, details, createdAt };
return { icon, label, color, status, details, createdAt };
};

export const getPipelineAndVersionDeleteString = (
Expand Down

0 comments on commit 7725a1f

Please sign in to comment.