99 ResultTableProps ,
1010 selectableZebraStripe ,
1111 jumpToLocation ,
12- nextSortDirection ,
1312 emptyQueryResultsMessage ,
1413} from "./result-table-utils" ;
1514import { onNavigation } from "./results" ;
@@ -18,19 +17,16 @@ import {
1817 NavigateMsg ,
1918 NavigationDirection ,
2019 SarifInterpretationData ,
21- InterpretedResultsSortColumn ,
22- SortDirection ,
23- InterpretedResultsSortState ,
2420} from "../../common/interface-types" ;
2521import {
2622 parseSarifPlainTextMessage ,
2723 parseSarifLocation ,
2824 isNoLocation ,
2925} from "../../common/sarif-utils" ;
30- import { vscode } from "../vscode-api" ;
3126import { isWholeFileLoc , isLineColumnLoc } from "../../common/bqrs-utils" ;
3227import { ScrollIntoViewHelper } from "./scroll-into-view-helper" ;
3328import { sendTelemetry } from "../common/telemetry" ;
29+ import { AlertTableHeader } from "./alert-table-header" ;
3430
3531export type PathTableProps = ResultTableProps & {
3632 resultSet : InterpretedResultSet < SarifInterpretationData > ;
@@ -74,38 +70,6 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
7470 e . preventDefault ( ) ;
7571 }
7672
77- sortClass ( column : InterpretedResultsSortColumn ) : string {
78- const sortState = this . props . resultSet . interpretation . data . sortState ;
79- if ( sortState !== undefined && sortState . sortBy === column ) {
80- return sortState . sortDirection === SortDirection . asc
81- ? "sort-asc"
82- : "sort-desc" ;
83- } else {
84- return "sort-none" ;
85- }
86- }
87-
88- getNextSortState (
89- column : InterpretedResultsSortColumn ,
90- ) : InterpretedResultsSortState | undefined {
91- const oldSortState = this . props . resultSet . interpretation . data . sortState ;
92- const prevDirection =
93- oldSortState && oldSortState . sortBy === column
94- ? oldSortState . sortDirection
95- : undefined ;
96- const nextDirection = nextSortDirection ( prevDirection , true ) ;
97- return nextDirection === undefined
98- ? undefined
99- : { sortBy : column , sortDirection : nextDirection } ;
100- }
101-
102- toggleSortStateForColumn ( column : InterpretedResultsSortColumn ) : void {
103- vscode . postMessage ( {
104- t : "changeInterpretedSort" ,
105- sortState : this . getNextSortState ( column ) ,
106- } ) ;
107- }
108-
10973 renderNoResults ( ) : JSX . Element {
11074 if ( this . props . nonemptyRawResults ) {
11175 return (
@@ -129,23 +93,6 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
12993 render ( ) : JSX . Element {
13094 const { databaseUri, resultSet } = this . props ;
13195
132- const header = (
133- < thead >
134- < tr >
135- < th colSpan = { 2 } > </ th >
136- < th
137- className = { `${ this . sortClass (
138- "alert-message" ,
139- ) } vscode-codeql__alert-message-cell`}
140- colSpan = { 3 }
141- onClick = { ( ) => this . toggleSortStateForColumn ( "alert-message" ) }
142- >
143- Message
144- </ th >
145- </ tr >
146- </ thead >
147- ) ;
148-
14996 const rows : JSX . Element [ ] = [ ] ;
15097 const { numTruncatedResults, sourceLocationPrefix } =
15198 resultSet . interpretation ;
@@ -468,7 +415,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
468415
469416 return (
470417 < table className = { className } >
471- { header }
418+ < AlertTableHeader sortState = { resultSet . interpretation . data . sortState } />
472419 < tbody > { rows } </ tbody >
473420 </ table >
474421 ) ;
0 commit comments