Skip to content

Commit 443c9ac

Browse files
Inline some rendering in AlertTablePathNodeRow
1 parent 91e69c9 commit 443c9ac

1 file changed

Lines changed: 21 additions & 25 deletions

File tree

extensions/ql-vscode/src/view/results/AlertTablePathNodeRow.tsx

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,29 +37,6 @@ export function AlertTablePathNodeRow(props: Props) {
3737
pathIndex,
3838
pathNodeIndex,
3939
};
40-
const msg =
41-
step.location !== undefined && step.location.message !== undefined ? (
42-
<SarifLocation
43-
text={step.location.message.text}
44-
loc={step.location}
45-
sourceLocationPrefix={sourceLocationPrefix}
46-
databaseUri={databaseUri}
47-
onClick={updateSelectionCallback(pathNodeKey)}
48-
/>
49-
) : (
50-
"[no location]"
51-
);
52-
const additionalMsg =
53-
step.location !== undefined ? (
54-
<SarifLocation
55-
loc={step.location}
56-
sourceLocationPrefix={sourceLocationPrefix}
57-
databaseUri={databaseUri}
58-
onClick={updateSelectionCallback(pathNodeKey)}
59-
/>
60-
) : (
61-
""
62-
);
6340
const isSelected = Keys.equalsNotUndefined(selectedItem, pathNodeKey);
6441
const stepIndex = pathNodeIndex + 1; // Convert to 1-based
6542
const zebraIndex = resultIndex + stepIndex;
@@ -83,15 +60,34 @@ export function AlertTablePathNodeRow(props: Props) {
8360
>
8461
{stepIndex}
8562
</td>
86-
<td {...selectableZebraStripe(isSelected, zebraIndex)}>{msg} </td>
63+
<td {...selectableZebraStripe(isSelected, zebraIndex)}>
64+
{step.location && step.location.message ? (
65+
<SarifLocation
66+
text={step.location.message.text}
67+
loc={step.location}
68+
sourceLocationPrefix={sourceLocationPrefix}
69+
databaseUri={databaseUri}
70+
onClick={updateSelectionCallback(pathNodeKey)}
71+
/>
72+
) : (
73+
"[no location]"
74+
)}
75+
</td>
8776
<td
8877
{...selectableZebraStripe(
8978
isSelected,
9079
zebraIndex,
9180
"vscode-codeql__location-cell",
9281
)}
9382
>
94-
{additionalMsg}
83+
{step.location && (
84+
<SarifLocation
85+
loc={step.location}
86+
sourceLocationPrefix={sourceLocationPrefix}
87+
databaseUri={databaseUri}
88+
onClick={updateSelectionCallback(pathNodeKey)}
89+
/>
90+
)}
9591
</td>
9692
</tr>
9793
);

0 commit comments

Comments
 (0)