Remove Location header
Just cycle through ascending, descending, and no sort on Message column.
This commit is contained in:
Родитель
c9fd8d41d5
Коммит
6bf691ef51
|
@ -15,8 +15,6 @@ export interface PathTableState {
|
|||
selectedPathNode: undefined | Keys.PathNode;
|
||||
}
|
||||
|
||||
type InterpretedResultsColumn = InterpretedResultsSortColumn | 'file-position';
|
||||
|
||||
export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
||||
constructor(props: PathTableProps) {
|
||||
super(props);
|
||||
|
@ -56,18 +54,15 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
|||
}
|
||||
}
|
||||
|
||||
getNextSortState(column: InterpretedResultsColumn): InterpretedResultsSortState | undefined {
|
||||
if (column === 'file-position') {
|
||||
return undefined;
|
||||
}
|
||||
getNextSortState(column: InterpretedResultsSortColumn): InterpretedResultsSortState | undefined {
|
||||
const oldSortState = this.props.resultSet.sortState;
|
||||
const prevDirection = oldSortState && oldSortState.sortBy === column ? oldSortState.sortDirection : undefined;
|
||||
const nextDirection = nextSortDirection(prevDirection);
|
||||
const nextDirection = nextSortDirection(prevDirection, true);
|
||||
return nextDirection === undefined ? undefined :
|
||||
{ sortBy: column, sortDirection: nextDirection };
|
||||
}
|
||||
|
||||
toggleSortStateForColumn(column: InterpretedResultsSortColumn | 'file-position'): void {
|
||||
toggleSortStateForColumn(column: InterpretedResultsSortColumn): void {
|
||||
vscode.postMessage({
|
||||
t: 'changeInterpretedSort',
|
||||
sortState: this.getNextSortState(column),
|
||||
|
@ -80,8 +75,7 @@ export class PathTable extends React.Component<PathTableProps, PathTableState> {
|
|||
const header = <thead>
|
||||
<tr>
|
||||
<th colSpan={2}></th>
|
||||
<th className={this.sortClass('alert-message') + ' vscode-codeql__alert-message-cell'} colSpan={2} onClick={() => this.toggleSortStateForColumn('alert-message')}>Message</th>
|
||||
<th className={'sort-none vscode-codeql__location-cell'} onClick={() => this.toggleSortStateForColumn('file-position')}>Location</th>
|
||||
<th className={this.sortClass('alert-message') + ' vscode-codeql__alert-message-cell'} colSpan={3} onClick={() => this.toggleSortStateForColumn('alert-message')}>Message</th>
|
||||
</tr>
|
||||
</thead>;
|
||||
|
||||
|
|
|
@ -88,12 +88,14 @@ export function selectableZebraStripe(isSelected: boolean, index: number, ...oth
|
|||
|
||||
/**
|
||||
* Returns the next sort direction when cycling through sort directions while clicking.
|
||||
* if `includeUndefined` is true, include `undefined` in the cycle.
|
||||
*/
|
||||
export function nextSortDirection(direction: SortDirection | undefined): SortDirection {
|
||||
export function nextSortDirection(direction: SortDirection | undefined, includeUndefined?: boolean): SortDirection | undefined {
|
||||
switch (direction) {
|
||||
case SortDirection.asc:
|
||||
return SortDirection.desc;
|
||||
case SortDirection.desc:
|
||||
return includeUndefined ? undefined : SortDirection.asc;
|
||||
case undefined:
|
||||
return SortDirection.asc;
|
||||
default:
|
||||
|
|
Загрузка…
Ссылка в новой задаче