Skip to content

Commit ccc17ff

Browse files
authored
Remove divs around TreeItems and add key to status labels (#160)
1 parent 888db0e commit ccc17ff

File tree

1 file changed

+29
-30
lines changed

1 file changed

+29
-30
lines changed

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

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,17 @@ const StepTreeItem = withStyles((theme: Theme) =>
6464
const getTreeItemsFromStepList = (stepsItems: StepInfo[]) => {
6565
return stepsItems.map((stepItemData) => {
6666
return (
67-
<div>
68-
<StepTreeItem
69-
key={stepItemData.id}
70-
nodeId={String(stepItemData.id)}
71-
label={
72-
<StepStatus
73-
status={decodeResultValue(stepItemData.state)}
74-
text={stepItemData.name.replace(/[^ -~]+/g, "")}
75-
/>
76-
}
77-
/>
78-
</div>
67+
<StepTreeItem
68+
key={stepItemData.id}
69+
nodeId={String(stepItemData.id)}
70+
label={
71+
<StepStatus
72+
status={decodeResultValue(stepItemData.state)}
73+
text={stepItemData.name.replace(/[^ -~]+/g, "")}
74+
key={`status-${stepItemData.id}`}
75+
/>
76+
}
77+
/>
7978
);
8079
});
8180
};
@@ -106,24 +105,23 @@ const getTreeItemsFromStage = (stageItems: StageInfo[], steps: StepInfo[]) => {
106105
children = [...children, ...stepsItems];
107106
}
108107
return (
109-
<div>
110-
<StageTreeItem
111-
key={stageItemData.id}
112-
nodeId={String(stageItemData.id)}
113-
label={
114-
<StepStatus
115-
status={decodeResultValue(stageItemData.state)}
116-
text={stageItemData.name}
117-
/>
118-
}
119-
children={children}
120-
classes={{
121-
label: stageItemData.synthetic
122-
? "pgv-graph-node--synthetic"
123-
: undefined,
124-
}}
125-
/>
126-
</div>
108+
<StageTreeItem
109+
key={stageItemData.id}
110+
nodeId={String(stageItemData.id)}
111+
label={
112+
<StepStatus
113+
status={decodeResultValue(stageItemData.state)}
114+
text={stageItemData.name}
115+
key={`status-${stageItemData.id}`}
116+
/>
117+
}
118+
children={children}
119+
classes={{
120+
label: stageItemData.synthetic
121+
? "pgv-graph-node--synthetic"
122+
: undefined,
123+
}}
124+
/>
127125
);
128126
});
129127
};
@@ -165,6 +163,7 @@ export class DataTreeView extends React.Component {
165163
expanded={this.props.expanded}
166164
selected={this.props.selected}
167165
onNodeToggle={this.props.onNodeToggle}
166+
key="console-tree-view"
168167
>
169168
{getTreeItemsFromStage(this.props.stages, this.props.steps)}
170169
</TreeView>

0 commit comments

Comments
 (0)