@@ -24,6 +24,7 @@ import { SarifLocation } from "./locations/SarifLocation";
2424import { AlertTableDropdownIndicatorCell } from "./AlertTableDropdownIndicatorCell" ;
2525import { AlertTableNoResults } from "./AlertTableNoResults" ;
2626import { AlertTableTruncatedMessage } from "./AlertTableTruncatedMessage" ;
27+ import { AlertTablePathNodeRow } from "./AlertTablePathNodeRow" ;
2728
2829type AlertTableProps = ResultTableProps & {
2930 resultSet : InterpretedResultSet < SarifInterpretationData > ;
@@ -210,81 +211,20 @@ export class AlertTable extends React.Component<
210211
211212 const pathNodeRows =
212213 currentPathExpanded &&
213- path . locations . map ( ( step , pathNodeIndex ) => {
214- const pathNodeKey : Keys . PathNode = {
215- ...pathKey ,
216- pathNodeIndex,
217- } ;
218- const msg =
219- step . location !== undefined &&
220- step . location . message !== undefined ? (
221- < SarifLocation
222- text = { step . location . message . text }
223- loc = { step . location }
224- sourceLocationPrefix = { sourceLocationPrefix }
225- databaseUri = { databaseUri }
226- onClick = { updateSelectionCallback ( pathNodeKey ) }
227- />
228- ) : (
229- "[no location]"
230- ) ;
231- const additionalMsg =
232- step . location !== undefined ? (
233- < SarifLocation
234- loc = { step . location }
235- sourceLocationPrefix = { sourceLocationPrefix }
236- databaseUri = { databaseUri }
237- onClick = { updateSelectionCallback ( pathNodeKey ) }
238- />
239- ) : (
240- ""
241- ) ;
242- const isSelected = Keys . equalsNotUndefined (
243- this . state . selectedItem ,
244- pathNodeKey ,
245- ) ;
246- const stepIndex = pathNodeIndex + 1 ; // Convert to 1-based
247- const zebraIndex = resultIndex + stepIndex ;
248- return (
249- < tr
250- ref = { this . scroller . ref ( isSelected ) }
251- className = {
252- isSelected
253- ? "vscode-codeql__selected-path-node"
254- : undefined
255- }
256- key = { `${ resultIndex } -${ pathIndex } -${ pathNodeIndex } ` }
257- >
258- < td className = "vscode-codeql__icon-cell" >
259- < span className = "vscode-codeql__vertical-rule" > </ span >
260- </ td >
261- < td className = "vscode-codeql__icon-cell" >
262- < span className = "vscode-codeql__vertical-rule" > </ span >
263- </ td >
264- < td
265- { ...selectableZebraStripe (
266- isSelected ,
267- zebraIndex ,
268- "vscode-codeql__path-index-cell" ,
269- ) }
270- >
271- { stepIndex }
272- </ td >
273- < td { ...selectableZebraStripe ( isSelected , zebraIndex ) } >
274- { msg } { " " }
275- </ td >
276- < td
277- { ...selectableZebraStripe (
278- isSelected ,
279- zebraIndex ,
280- "vscode-codeql__location-cell" ,
281- ) }
282- >
283- { additionalMsg }
284- </ td >
285- </ tr >
286- ) ;
287- } ) ;
214+ path . locations . map ( ( step , pathNodeIndex ) => (
215+ < AlertTablePathNodeRow
216+ key = { `${ resultIndex } -${ pathIndex } -${ pathNodeIndex } ` }
217+ step = { step }
218+ pathNodeIndex = { pathNodeIndex }
219+ pathIndex = { pathIndex }
220+ resultIndex = { resultIndex }
221+ selectedItem = { selectedItem }
222+ databaseUri = { databaseUri }
223+ sourceLocationPrefix = { sourceLocationPrefix }
224+ updateSelectionCallback = { updateSelectionCallback }
225+ scroller = { this . scroller }
226+ />
227+ ) ) ;
288228
289229 return (
290230 < >
0 commit comments