@@ -8,11 +8,12 @@ import { AlertTableDropdownIndicatorCell } from "./AlertTableDropdownIndicatorCe
88import { useMemo } from "react" ;
99import { SarifLocation } from "./locations/SarifLocation" ;
1010import { SarifMessageWithLocations } from "./locations/SarifMessageWithLocations" ;
11+ import { AlertTablePathRow } from "./AlertTablePathRow" ;
1112
1213interface Props {
1314 result : Sarif . Result ;
1415 resultIndex : number ;
15- currentResultExpanded : boolean ;
16+ expanded : Set < string > ;
1617 selectedItem : undefined | Keys . ResultKey ;
1718 databaseUri : string ;
1819 sourceLocationPrefix : string ;
@@ -27,7 +28,7 @@ export function AlertTableResultRow(props: Props) {
2728 const {
2829 result,
2930 resultIndex,
30- currentResultExpanded ,
31+ expanded ,
3132 selectedItem,
3233 databaseUri,
3334 sourceLocationPrefix,
@@ -73,37 +74,58 @@ export function AlertTableResultRow(props: Props) {
7374 />
7475 ) ;
7576
77+ const currentResultExpanded = expanded . has ( Keys . keyToString ( resultKey ) ) ;
7678 return (
77- < tr
78- ref = { scroller . ref ( resultRowIsSelected ) }
79- { ...selectableZebraStripe ( resultRowIsSelected , resultIndex ) }
80- key = { resultIndex }
81- >
82- { result . codeFlows === undefined ? (
83- < >
84- < td className = "vscode-codeql__icon-cell" > { info } </ td >
85- < td colSpan = { 3 } > { msg } </ td >
86- </ >
87- ) : (
88- < >
89- < AlertTableDropdownIndicatorCell
90- expanded = { currentResultExpanded }
91- onClick = { handleDropdownClick }
92- />
93- < td className = "vscode-codeql__icon-cell" > { listUnordered } </ td >
94- < td colSpan = { 2 } > { msg } </ td >
95- </ >
96- ) }
97- < td className = "vscode-codeql__location-cell" >
98- { result . locations && result . locations . length > 0 && (
99- < SarifLocation
100- loc = { result . locations [ 0 ] }
101- sourceLocationPrefix = { sourceLocationPrefix }
79+ < >
80+ < tr
81+ ref = { scroller . ref ( resultRowIsSelected ) }
82+ { ...selectableZebraStripe ( resultRowIsSelected , resultIndex ) }
83+ >
84+ { result . codeFlows === undefined ? (
85+ < >
86+ < td className = "vscode-codeql__icon-cell" > { info } </ td >
87+ < td colSpan = { 3 } > { msg } </ td >
88+ </ >
89+ ) : (
90+ < >
91+ < AlertTableDropdownIndicatorCell
92+ expanded = { currentResultExpanded }
93+ onClick = { handleDropdownClick }
94+ />
95+ < td className = "vscode-codeql__icon-cell" > { listUnordered } </ td >
96+ < td colSpan = { 2 } > { msg } </ td >
97+ </ >
98+ ) }
99+ < td className = "vscode-codeql__location-cell" >
100+ { result . locations && result . locations . length > 0 && (
101+ < SarifLocation
102+ loc = { result . locations [ 0 ] }
103+ sourceLocationPrefix = { sourceLocationPrefix }
104+ databaseUri = { databaseUri }
105+ onClick = { handleSarifLocationClicked }
106+ />
107+ ) }
108+ </ td >
109+ </ tr >
110+ { currentResultExpanded &&
111+ result . codeFlows &&
112+ Keys . getAllPaths ( result ) . map ( ( path , pathIndex ) => (
113+ < AlertTablePathRow
114+ key = { `${ resultIndex } -${ pathIndex } ` }
115+ path = { path }
116+ pathIndex = { pathIndex }
117+ resultIndex = { resultIndex }
118+ currentPathExpanded = { expanded . has (
119+ Keys . keyToString ( { resultIndex, pathIndex } ) ,
120+ ) }
121+ selectedItem = { selectedItem }
102122 databaseUri = { databaseUri }
103- onClick = { handleSarifLocationClicked }
123+ sourceLocationPrefix = { sourceLocationPrefix }
124+ updateSelectionCallback = { updateSelectionCallback }
125+ toggler = { toggler }
126+ scroller = { scroller }
104127 />
105- ) }
106- </ td >
107- </ tr >
128+ ) ) }
129+ </ >
108130 ) ;
109131}
0 commit comments