|
1 | 1 | import * as React from "react"; |
2 | 2 | import * as Sarif from "sarif"; |
3 | 3 | import * as Keys from "./result-keys"; |
4 | | -import { info } from "./octicons"; |
5 | 4 | import { |
6 | 5 | className, |
7 | 6 | ResultTableProps, |
8 | | - selectableZebraStripe, |
9 | 7 | jumpToLocation, |
10 | 8 | } from "./result-table-utils"; |
11 | 9 | import { onNavigation } from "./ResultsApp"; |
@@ -133,57 +131,39 @@ export class AlertTable extends React.Component< |
133 | 131 | <td className="vscode-codeql__location-cell">{location}</td> |
134 | 132 | ); |
135 | 133 |
|
136 | | - const selectedItem = this.state.selectedItem; |
137 | | - const resultRowIsSelected = |
138 | | - selectedItem?.resultIndex === resultIndex && |
139 | | - selectedItem.pathIndex === undefined; |
140 | | - |
141 | | - if (result.codeFlows === undefined) { |
142 | | - return ( |
143 | | - <tr |
144 | | - ref={this.scroller.ref(resultRowIsSelected)} |
145 | | - key={resultIndex} |
146 | | - {...selectableZebraStripe(resultRowIsSelected, resultIndex)} |
147 | | - > |
148 | | - <td className="vscode-codeql__icon-cell">{info}</td> |
149 | | - <td colSpan={3}>{msg}</td> |
150 | | - {locationCells} |
151 | | - </tr> |
152 | | - ); |
153 | | - } else { |
154 | | - return ( |
155 | | - <> |
156 | | - <AlertTableResultRow |
157 | | - result={result} |
158 | | - resultIndex={resultIndex} |
159 | | - currentResultExpanded={currentResultExpanded} |
160 | | - selectedItem={selectedItem} |
161 | | - toggler={toggler} |
162 | | - scroller={this.scroller} |
163 | | - msg={msg} |
164 | | - locationCells={locationCells} |
165 | | - /> |
166 | | - {currentResultExpanded && |
167 | | - Keys.getAllPaths(result).map((path, pathIndex) => ( |
168 | | - <AlertTablePathRow |
169 | | - key={`${resultIndex}-${pathIndex}`} |
170 | | - path={path} |
171 | | - pathIndex={pathIndex} |
172 | | - resultIndex={resultIndex} |
173 | | - currentPathExpanded={this.state.expanded.has( |
174 | | - Keys.keyToString({ resultIndex, pathIndex }), |
175 | | - )} |
176 | | - selectedItem={selectedItem} |
177 | | - databaseUri={databaseUri} |
178 | | - sourceLocationPrefix={sourceLocationPrefix} |
179 | | - updateSelectionCallback={updateSelectionCallback} |
180 | | - toggler={toggler} |
181 | | - scroller={this.scroller} |
182 | | - /> |
183 | | - ))} |
184 | | - </> |
185 | | - ); |
186 | | - } |
| 134 | + return ( |
| 135 | + <> |
| 136 | + <AlertTableResultRow |
| 137 | + result={result} |
| 138 | + resultIndex={resultIndex} |
| 139 | + currentResultExpanded={currentResultExpanded} |
| 140 | + selectedItem={this.state.selectedItem} |
| 141 | + toggler={toggler} |
| 142 | + scroller={this.scroller} |
| 143 | + msg={msg} |
| 144 | + locationCells={locationCells} |
| 145 | + /> |
| 146 | + {currentResultExpanded && |
| 147 | + result.codeFlows && |
| 148 | + Keys.getAllPaths(result).map((path, pathIndex) => ( |
| 149 | + <AlertTablePathRow |
| 150 | + key={`${resultIndex}-${pathIndex}`} |
| 151 | + path={path} |
| 152 | + pathIndex={pathIndex} |
| 153 | + resultIndex={resultIndex} |
| 154 | + currentPathExpanded={this.state.expanded.has( |
| 155 | + Keys.keyToString({ resultIndex, pathIndex }), |
| 156 | + )} |
| 157 | + selectedItem={this.state.selectedItem} |
| 158 | + databaseUri={databaseUri} |
| 159 | + sourceLocationPrefix={sourceLocationPrefix} |
| 160 | + updateSelectionCallback={updateSelectionCallback} |
| 161 | + toggler={toggler} |
| 162 | + scroller={this.scroller} |
| 163 | + /> |
| 164 | + ))} |
| 165 | + </> |
| 166 | + ); |
187 | 167 | }, |
188 | 168 | ); |
189 | 169 |
|
|
0 commit comments