From 4c2aa8f461b4da95172f5dec124c391fd1822894 Mon Sep 17 00:00:00 2001 From: Jenny <32821331+jenny-s51@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:02:17 -0400 Subject: [PATCH] add customStatusIcon support to DefaultTaskGroup --- .../src/demos/pipelineGroupsDemo/DemoTaskGroup.tsx | 1 + ...elineGroupsNodes.ts => createDemoPipelineGroupsNodes.tsx} | 5 ++++- .../src/pipelines/components/groups/DefaultTaskGroup.tsx | 2 ++ .../pipelines/components/groups/DefaultTaskGroupExpanded.tsx | 2 ++ packages/module/src/pipelines/components/nodes/TaskPill.tsx | 5 +++-- 5 files changed, 12 insertions(+), 3 deletions(-) rename packages/demo-app-ts/src/demos/pipelineGroupsDemo/{createDemoPipelineGroupsNodes.ts => createDemoPipelineGroupsNodes.tsx} (99%) diff --git a/packages/demo-app-ts/src/demos/pipelineGroupsDemo/DemoTaskGroup.tsx b/packages/demo-app-ts/src/demos/pipelineGroupsDemo/DemoTaskGroup.tsx index f07457e3..c2839126 100644 --- a/packages/demo-app-ts/src/demos/pipelineGroupsDemo/DemoTaskGroup.tsx +++ b/packages/demo-app-ts/src/demos/pipelineGroupsDemo/DemoTaskGroup.tsx @@ -53,6 +53,7 @@ const DemoTaskGroup: React.FunctionComponent = ({ element, . hideDetailsAtMedium showStatusState status={data.status} + customStatusIcon={data.customStatusIcon} hiddenDetailsShownStatuses={[RunStatus.Succeeded]} {...rest} /> diff --git a/packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.ts b/packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.tsx similarity index 99% rename from packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.ts rename to packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.tsx index 582f0a54..32a10e7b 100644 --- a/packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.ts +++ b/packages/demo-app-ts/src/demos/pipelineGroupsDemo/createDemoPipelineGroupsNodes.tsx @@ -1,4 +1,6 @@ /* eslint-disable camelcase */ +import React from 'react'; +import { BanIcon } from '@patternfly/react-icons'; import { PipelineNodeModel, RunStatus } from '@patternfly/react-topology'; export const NODE_PADDING_VERTICAL = 0; @@ -112,7 +114,8 @@ export const createExecution3 = (runAfter?: string): [string, PipelineNodeModel[ group: true, runAfterTasks: runAfter ? [runAfter] : [], data: { - status: RunStatus.Succeeded, + status: RunStatus.Failed, + customStatusIcon: , isDependency: true } }; diff --git a/packages/module/src/pipelines/components/groups/DefaultTaskGroup.tsx b/packages/module/src/pipelines/components/groups/DefaultTaskGroup.tsx index 0f2d2aae..4fd1b343 100644 --- a/packages/module/src/pipelines/components/groups/DefaultTaskGroup.tsx +++ b/packages/module/src/pipelines/components/groups/DefaultTaskGroup.tsx @@ -39,6 +39,8 @@ export interface DefaultTaskGroupProps { dragRegroupable?: boolean; /** RunStatus to depict, supported on collapsed groups only. */ status?: RunStatus; + /** Custom icon to use as the status icon */ + customStatusIcon?: React.ReactNode; /** Flag indicating the status indicator, supported on collapsed groups only */ showStatusState?: boolean; /** Statuses to show at when details are hidden, supported on collapsed groups only */ diff --git a/packages/module/src/pipelines/components/groups/DefaultTaskGroupExpanded.tsx b/packages/module/src/pipelines/components/groups/DefaultTaskGroupExpanded.tsx index 63b04fe3..278dbc61 100644 --- a/packages/module/src/pipelines/components/groups/DefaultTaskGroupExpanded.tsx +++ b/packages/module/src/pipelines/components/groups/DefaultTaskGroupExpanded.tsx @@ -29,6 +29,7 @@ const DefaultTaskGroupExpanded: React.FunctionComponent = observer( badgeClassName = styles.topologyPipelinesPillBadge, badgeTooltip, badgePopoverParams, + customStatusIcon, nameLabelClass, taskIconClass, taskIcon, @@ -306,7 +307,7 @@ const TaskPill: React.FC = observer( (status === RunStatus.Running || status === RunStatus.InProgress) && styles.modifiers.spin )} > - + {customStatusIcon ?? } ) : null} @@ -371,7 +372,7 @@ const TaskPill: React.FC = observer( (status === RunStatus.Running || status === RunStatus.InProgress) && styles.modifiers.spin )} > - + {customStatusIcon ?? } )}