Skip to content

Commit b6bd534

Browse files
committed
Fixes pagination when there are no results
When there are no results, always ensure that max pages is 1. This commit also changes the way pagination buttons are displayed, removing their border.
1 parent 8093d9a commit b6bd534

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

extensions/ql-vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [Unreleased]
44

55
- Fix error with choosing qlpack search path.
6+
- Add the AST Viewer to inspect the QL AST of a source file in a database. Currently, only available for C/C++ sources.
7+
- Fix pagination when there are no results.
68

79
## 1.3.1 - 7 July 2020
810

extensions/ql-vscode/src/view/result-tables.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ export class ResultTables
147147
// on initial load of query results, resultSets.numPages will have the number of *raw* pages available,
148148
// not interpreted pages, because the extension doesn't know the view will default to showing alerts
149149
// instead.
150-
const numPages = selectedTable == ALERTS_TABLE_NAME ?
151-
parsedResultSets.numInterpretedPages : parsedResultSets.numPages;
150+
const numPages = Math.max(selectedTable === ALERTS_TABLE_NAME ?
151+
parsedResultSets.numInterpretedPages : parsedResultSets.numPages, 1);
152152

153153
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
154154
this.setState({ selectedPage: e.target.value });
@@ -188,7 +188,12 @@ export class ResultTables
188188
value={this.state.selectedPage}
189189
onChange={onChange}
190190
onBlur={e => choosePage(e.target.value)}
191-
onKeyDown={e => { if (e.keyCode === 13) choosePage((e.target as HTMLInputElement).value); }}
191+
onKeyDown={e => {
192+
if (e.keyCode === 13) {
193+
choosePage((e.target as HTMLInputElement).value);
194+
}
195+
}
196+
}
192197
/>
193198
<span>
194199
/ {numPages}

extensions/ql-vscode/src/view/resultsView.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
.vscode-codeql__table-selection-header button {
1818
padding: 0.3rem;
1919
margin: 0.2rem;
20-
border-radius: 5px;
20+
border: 0;
21+
font-size: large;
2122
color: var(--vscode-editor-foreground);
2223
background-color: var(--vscode-editorGutter-background);
2324
cursor: pointer;

0 commit comments

Comments
 (0)