Skip to content

Commit cefd060

Browse files
committed
Add selected node state
1 parent 9cfd0ce commit cefd060

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

src/main/frontend/pipeline-console-view/pipeline-console/main/PipelineConsole.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default function PipelineConsole() {
5959
mainViewVisibility === "graphOnly") && (
6060
<Stages
6161
stages={stages}
62+
selectedStage={openStage || undefined}
6263
stageViewPosition={stageViewPosition}
6364
onStageSelect={handleStageSelect}
6465
/>

src/main/frontend/pipeline-console-view/pipeline-console/main/components/stages.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616

1717
export default function Stages({
1818
stages,
19+
selectedStage,
1920
stageViewPosition,
2021
onStageSelect,
2122
}: StagesProps) {
@@ -96,6 +97,7 @@ export default function Stages({
9697
<TransformComponent wrapperStyle={{ width: "100%", height: "100%" }}>
9798
<PipelineGraph
9899
stages={stages}
100+
selectedStage={selectedStage}
99101
onStageSelect={(e) => {
100102
onStageSelect(e);
101103
setIsExpanded(false);
@@ -109,6 +111,7 @@ export default function Stages({
109111

110112
interface StagesProps {
111113
stages: StageInfo[];
114+
selectedStage?: StageInfo;
112115
stageViewPosition: StageViewPosition;
113116
onStageSelect: (nodeId: string) => void;
114117
}

src/main/frontend/pipeline-graph-view/pipeline-graph/main/PipelineGraph.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ export function PipelineGraph(props: Props) {
125125
key={node.id}
126126
node={node}
127127
collapsed={collapsed}
128+
selected={
129+
node.isPlaceholder ? false : selectedStage?.id === node.stage.id
130+
}
128131
onStageSelect={props.onStageSelect}
129132
/>
130133
))}

src/main/frontend/pipeline-graph-view/pipeline-graph/main/support/nodes.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,21 @@ import Tooltip from "../../../../common/components/tooltip.tsx";
1313
import { Total } from "../../../../common/utils/timings.tsx";
1414
import "./nodes.scss";
1515
import { CounterNodeInfo } from "../PipelineGraphLayout.ts";
16+
import { classNames } from "../../../../common/utils/classnames.ts";
1617

1718
type SVGChildren = Array<any>; // Fixme: Maybe refine this? Not sure what should go here, we have working code I can't make typecheck
1819

1920
interface NodeProps {
2021
node: NodeInfo;
2122
collapsed?: boolean;
2223
onStageSelect: (nodeId: string) => void;
24+
selected: boolean;
2325
}
2426

2527
/**
2628
* Generate the SVG elements to represent a node.
2729
*/
28-
export function Node({ node, collapsed, onStageSelect }: NodeProps) {
30+
export function Node({ node, collapsed, onStageSelect, selected }: NodeProps) {
2931
const key = node.key;
3032

3133
if (node.isPlaceholder) {
@@ -116,11 +118,14 @@ export function Node({ node, collapsed, onStageSelect }: NodeProps) {
116118
left: node.x,
117119
translate: "-50% -50%",
118120
} as CSSProperties,
119-
className:
120-
"PWGx-pipeline-node PWGx-pipeline-node--" +
121-
state +
122-
" " +
121+
className: classNames(
122+
"PWGx-pipeline-node",
123+
"PWGx-pipeline-node--" + state,
123124
resultToColor(node.stage.state, node.stage.skeleton),
125+
{
126+
"PWGx-pipeline-node--selected": selected,
127+
},
128+
),
124129
};
125130

126131
let tooltip: React.ReactElement | undefined;

src/main/frontend/pipeline-graph-view/pipeline-graph/styles/PipelineGraphWidget.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
z-index: -1;
2323
}
2424

25+
&--selected {
26+
&::after {
27+
box-shadow: 0 0 0 0.125rem currentColor, 0 0 0 0.5rem var(--card-background) !important;
28+
}
29+
}
30+
2531
&:has(a) {
2632
&::after {
2733
content: "";

0 commit comments

Comments
 (0)