Skip to content

Commit 6bf691e

Browse files
committed
Remove Location header
Just cycle through ascending, descending, and no sort on Message column.
1 parent c9fd8d4 commit 6bf691e

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

extensions/ql-vscode/src/view/alert-table.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ export interface PathTableState {
1515
selectedPathNode: undefined | Keys.PathNode;
1616
}
1717

18-
type InterpretedResultsColumn = InterpretedResultsSortColumn | 'file-position';
19-
2018
export class PathTable extends React.Component<PathTableProps, PathTableState> {
2119
constructor(props: PathTableProps) {
2220
super(props);
@@ -56,18 +54,15 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
5654
}
5755
}
5856

59-
getNextSortState(column: InterpretedResultsColumn): InterpretedResultsSortState | undefined {
60-
if (column === 'file-position') {
61-
return undefined;
62-
}
57+
getNextSortState(column: InterpretedResultsSortColumn): InterpretedResultsSortState | undefined {
6358
const oldSortState = this.props.resultSet.sortState;
6459
const prevDirection = oldSortState && oldSortState.sortBy === column ? oldSortState.sortDirection : undefined;
65-
const nextDirection = nextSortDirection(prevDirection);
60+
const nextDirection = nextSortDirection(prevDirection, true);
6661
return nextDirection === undefined ? undefined :
6762
{ sortBy: column, sortDirection: nextDirection };
6863
}
6964

70-
toggleSortStateForColumn(column: InterpretedResultsSortColumn | 'file-position'): void {
65+
toggleSortStateForColumn(column: InterpretedResultsSortColumn): void {
7166
vscode.postMessage({
7267
t: 'changeInterpretedSort',
7368
sortState: this.getNextSortState(column),
@@ -80,8 +75,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
8075
const header = <thead>
8176
<tr>
8277
<th colSpan={2}></th>
83-
<th className={this.sortClass('alert-message') + ' vscode-codeql__alert-message-cell'} colSpan={2} onClick={() => this.toggleSortStateForColumn('alert-message')}>Message</th>
84-
<th className={'sort-none vscode-codeql__location-cell'} onClick={() => this.toggleSortStateForColumn('file-position')}>Location</th>
78+
<th className={this.sortClass('alert-message') + ' vscode-codeql__alert-message-cell'} colSpan={3} onClick={() => this.toggleSortStateForColumn('alert-message')}>Message</th>
8579
</tr>
8680
</thead>;
8781

extensions/ql-vscode/src/view/result-table-utils.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ export function selectableZebraStripe(isSelected: boolean, index: number, ...oth
8888

8989
/**
9090
* Returns the next sort direction when cycling through sort directions while clicking.
91+
* if `includeUndefined` is true, include `undefined` in the cycle.
9192
*/
92-
export function nextSortDirection(direction: SortDirection | undefined): SortDirection {
93+
export function nextSortDirection(direction: SortDirection | undefined, includeUndefined?: boolean): SortDirection | undefined {
9394
switch (direction) {
9495
case SortDirection.asc:
9596
return SortDirection.desc;
9697
case SortDirection.desc:
98+
return includeUndefined ? undefined : SortDirection.asc;
9799
case undefined:
98100
return SortDirection.asc;
99101
default:

0 commit comments

Comments
 (0)