Skip to content

Commit

Permalink
add customStatusIcon support to DefaultTaskGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
jenny-s51 committed Oct 21, 2024
1 parent 02f6fbe commit 4c2aa8f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const DemoTaskGroup: React.FunctionComponent<DemoTaskGroupProps> = ({ element, .
hideDetailsAtMedium
showStatusState
status={data.status}
customStatusIcon={data.customStatusIcon}
hiddenDetailsShownStatuses={[RunStatus.Succeeded]}
{...rest}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -112,7 +114,8 @@ export const createExecution3 = (runAfter?: string): [string, PipelineNodeModel[
group: true,
runAfterTasks: runAfter ? [runAfter] : [],
data: {
status: RunStatus.Succeeded,
status: RunStatus.Failed,
customStatusIcon: <BanIcon />,
isDependency: true
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const DefaultTaskGroupExpanded: React.FunctionComponent<Omit<DefaultTaskGroupPro
showLabelOnHover,
hideDetailsAtMedium,
status,
customStatusIcon,
GroupLabelComponent = NodeLabel,
truncateLength,
canDrop,
Expand Down Expand Up @@ -179,6 +180,7 @@ const DefaultTaskGroupExpanded: React.FunctionComponent<Omit<DefaultTaskGroupPro
position={labelPosition}
centerLabelOnEdge={centerLabelOnEdge}
runStatus={status}
customStatusIcon={customStatusIcon}
paddingX={8}
paddingY={5}
dragRef={dragNodeRef ? dragLabelRef : undefined}
Expand Down
5 changes: 3 additions & 2 deletions packages/module/src/pipelines/components/nodes/TaskPill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const TaskPill: React.FC<TaskPillProps> = observer(
badgeClassName = styles.topologyPipelinesPillBadge,
badgeTooltip,
badgePopoverParams,
customStatusIcon,
nameLabelClass,
taskIconClass,
taskIcon,
Expand Down Expand Up @@ -306,7 +307,7 @@ const TaskPill: React.FC<TaskPillProps> = observer(
(status === RunStatus.Running || status === RunStatus.InProgress) && styles.modifiers.spin
)}
>
<StatusIcon status={status} />
{customStatusIcon ?? <StatusIcon status={status} />}
</g>
</g>
) : null}
Expand Down Expand Up @@ -371,7 +372,7 @@ const TaskPill: React.FC<TaskPillProps> = observer(
(status === RunStatus.Running || status === RunStatus.InProgress) && styles.modifiers.spin
)}
>
<StatusIcon status={status} />
{customStatusIcon ?? <StatusIcon status={status} />}
</g>
</g>
)}
Expand Down

0 comments on commit 4c2aa8f

Please sign in to comment.