File tree 4 files changed +23
-3
lines changed
components/QueryResultTable
components/ResultSetsViewer
4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const TABLE_SETTINGS: Settings = {
21
21
...DEFAULT_TABLE_SETTINGS ,
22
22
stripedRows : true ,
23
23
sortable : false ,
24
- displayIndices : { maxIndex : 100000 } ,
24
+ displayIndices : true ,
25
25
} ;
26
26
27
27
export const b = cn ( 'ydb-query-result-table' ) ;
@@ -77,6 +77,7 @@ interface QueryResultTableProps
77
77
extends Omit < ResizeableDataTableProps < KeyValueRow > , 'data' | 'columns' > {
78
78
data ?: KeyValueRow [ ] ;
79
79
columns ?: ColumnType [ ] ;
80
+ settings ?: Partial < Settings > ;
80
81
}
81
82
82
83
export const QueryResultTable = ( props : QueryResultTableProps ) => {
@@ -100,7 +101,7 @@ export const QueryResultTable = (props: QueryResultTableProps) => {
100
101
< ResizeableDataTable
101
102
data = { data }
102
103
columns = { columns }
103
- settings = { TABLE_SETTINGS }
104
+ settings = { { ... TABLE_SETTINGS , ... props . settings } }
104
105
// prevent accessing row.id in case it is present but is not the PK (i.e. may repeat)
105
106
rowKey = { getRowIndex }
106
107
visibleRowIndex = { getVisibleRowIndex }
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
3
+ import type { Settings } from '@gravity-ui/react-data-table' ;
3
4
import { isEqual } from 'lodash' ;
4
5
import { v4 as uuidv4 } from 'uuid' ;
5
6
@@ -265,6 +266,11 @@ export default function QueryEditor(props: QueryEditorProps) {
265
266
showPreview = { showPreview }
266
267
queryText = { lastExecutedQueryText }
267
268
onCancelRunningQuery = { handleCancelRunningQuery }
269
+ tableSettings = {
270
+ isStreamingEnabled && querySettings . limitRows
271
+ ? { displayIndices : { maxIndex : querySettings . limitRows } }
272
+ : undefined
273
+ }
268
274
/>
269
275
</ div >
270
276
</ SplitPane >
@@ -285,6 +291,7 @@ interface ResultProps {
285
291
path : string ;
286
292
showPreview ?: boolean ;
287
293
queryText : string ;
294
+ tableSettings ?: Partial < Settings > ;
288
295
onCancelRunningQuery : VoidFunction ;
289
296
}
290
297
function Result ( {
@@ -299,6 +306,7 @@ function Result({
299
306
path,
300
307
showPreview,
301
308
queryText,
309
+ tableSettings,
302
310
onCancelRunningQuery,
303
311
} : ResultProps ) {
304
312
if ( showPreview ) {
@@ -315,6 +323,7 @@ function Result({
315
323
isResultsCollapsed = { resultVisibilityState . collapsed }
316
324
isCancelError = { Boolean ( cancelQueryResponse ?. error ) }
317
325
isCancelling = { Boolean ( cancelQueryResponse ?. isLoading ) }
326
+ tableSettings = { tableSettings }
318
327
onExpandResults = { onExpandResultHandler }
319
328
onCollapseResults = { onCollapseResultHandler }
320
329
queryText = { queryText }
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
3
+ import type { Settings } from '@gravity-ui/react-data-table' ;
3
4
import type { ControlGroupOption } from '@gravity-ui/uikit' ;
4
5
import { ClipboardButton , RadioButton } from '@gravity-ui/uikit' ;
5
6
@@ -82,6 +83,7 @@ interface ExecuteResultProps {
82
83
theme ?: string ;
83
84
tenantName : string ;
84
85
queryText ?: string ;
86
+ tableSettings ?: Partial < Settings > ;
85
87
86
88
isCancelling : boolean ;
87
89
isCancelError : boolean ;
@@ -99,6 +101,7 @@ export function QueryResultViewer({
99
101
queryText,
100
102
isCancelling,
101
103
isCancelError,
104
+ tableSettings,
102
105
onCancelRunningQuery,
103
106
onCollapseResults,
104
107
onExpandResults,
@@ -230,6 +233,7 @@ export function QueryResultViewer({
230
233
resultSets = { resultSets }
231
234
error = { error }
232
235
selectedResultSet = { selectedResultSet }
236
+ tableSettings = { tableSettings }
233
237
setSelectedResultSet = { setSelectedResultSet }
234
238
/>
235
239
) ;
Original file line number Diff line number Diff line change
1
+ import type { Settings } from '@gravity-ui/react-data-table' ;
1
2
import { Tabs , Text } from '@gravity-ui/uikit' ;
2
3
3
4
import { QueryResultTable } from '../../../../../../components/QueryResultTable' ;
@@ -15,6 +16,7 @@ interface ResultSetsViewerProps {
15
16
resultSets ?: ParsedResultSet [ ] ;
16
17
selectedResultSet : number ;
17
18
error ?: unknown ;
19
+ tableSettings ?: Partial < Settings > ;
18
20
setSelectedResultSet : ( resultSet : number ) => void ;
19
21
}
20
22
@@ -73,7 +75,11 @@ export function ResultSetsViewer(props: ResultSetsViewerProps) {
73
75
{ currentResult ? (
74
76
< div className = { b ( 'result' ) } >
75
77
{ renderResultHeadWithCount ( ) }
76
- < QueryResultTable data = { currentResult . result } columns = { currentResult . columns } />
78
+ < QueryResultTable
79
+ settings = { props . tableSettings }
80
+ data = { currentResult . result }
81
+ columns = { currentResult . columns }
82
+ />
77
83
</ div >
78
84
) : null }
79
85
</ div >
You can’t perform that action at this time.
0 commit comments