File tree Expand file tree Collapse file tree 3 files changed +200
-206
lines changed
extensions/ql-vscode/src/view/results Expand file tree Collapse file tree 3 files changed +200
-206
lines changed Original file line number Diff line number Diff line change
1
+ import * as React from "react" ;
2
+ import { ALERTS_TABLE_NAME } from "../../common/interface-types" ;
3
+ import {
4
+ alertExtrasClassName ,
5
+ toggleDiagnosticsClassName ,
6
+ } from "./result-table-utils" ;
7
+
8
+ interface Props {
9
+ selectedTable : string ;
10
+ problemsViewSelected : boolean ;
11
+ handleCheckboxChanged : ( event : React . ChangeEvent < HTMLInputElement > ) => void ;
12
+ }
13
+
14
+ export function ProblemsViewCheckbox ( props : Props ) : JSX . Element | null {
15
+ const { selectedTable, problemsViewSelected, handleCheckboxChanged } = props ;
16
+
17
+ if ( selectedTable !== ALERTS_TABLE_NAME ) {
18
+ return null ;
19
+ }
20
+ return (
21
+ < div className = { alertExtrasClassName } >
22
+ < div className = { toggleDiagnosticsClassName } >
23
+ < input
24
+ type = "checkbox"
25
+ id = "toggle-diagnostics"
26
+ name = "toggle-diagnostics"
27
+ onChange = { handleCheckboxChanged }
28
+ checked = { problemsViewSelected }
29
+ />
30
+ < label htmlFor = "toggle-diagnostics" >
31
+ Show results in Problems view
32
+ </ label >
33
+ </ div >
34
+ </ div >
35
+ ) ;
36
+ }
Original file line number Diff line number Diff line change
1
+ import * as React from "react" ;
2
+ import { ResultSet } from "../../common/interface-types" ;
3
+ import { tableHeaderItemClassName } from "./result-table-utils" ;
4
+
5
+ interface Props {
6
+ resultSet ?: ResultSet ;
7
+ }
8
+
9
+ function getResultCount ( resultSet : ResultSet ) : number {
10
+ switch ( resultSet . t ) {
11
+ case "RawResultSet" :
12
+ return resultSet . schema . rows ;
13
+ case "InterpretedResultSet" :
14
+ return resultSet . interpretation . numTotalResults ;
15
+ }
16
+ }
17
+
18
+ export function ResultCount ( props : Props ) : JSX . Element | null {
19
+ if ( ! props . resultSet ) {
20
+ return null ;
21
+ }
22
+
23
+ const resultCount = getResultCount ( props . resultSet ) ;
24
+ return (
25
+ < span className = { tableHeaderItemClassName } >
26
+ { resultCount } { resultCount === 1 ? "result" : "results" }
27
+ </ span >
28
+ ) ;
29
+ }
You can’t perform that action at this time.
0 commit comments