File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed
components/QueryResultTable
components/ResultSetsViewer Expand file tree Collapse file tree 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 = {
2121 ...DEFAULT_TABLE_SETTINGS ,
2222 stripedRows : true ,
2323 sortable : false ,
24- displayIndices : { maxIndex : 100000 } ,
24+ displayIndices : true ,
2525} ;
2626
2727export const b = cn ( 'ydb-query-result-table' ) ;
@@ -77,6 +77,7 @@ interface QueryResultTableProps
7777 extends Omit < ResizeableDataTableProps < KeyValueRow > , 'data' | 'columns' > {
7878 data ?: KeyValueRow [ ] ;
7979 columns ?: ColumnType [ ] ;
80+ settings ?: Partial < Settings > ;
8081}
8182
8283export const QueryResultTable = ( props : QueryResultTableProps ) => {
@@ -100,7 +101,7 @@ export const QueryResultTable = (props: QueryResultTableProps) => {
100101 < ResizeableDataTable
101102 data = { data }
102103 columns = { columns }
103- settings = { TABLE_SETTINGS }
104+ settings = { { ... TABLE_SETTINGS , ... props . settings } }
104105 // prevent accessing row.id in case it is present but is not the PK (i.e. may repeat)
105106 rowKey = { getRowIndex }
106107 visibleRowIndex = { getVisibleRowIndex }
Original file line number Diff line number Diff line change 11import React from 'react' ;
22
3+ import type { Settings } from '@gravity-ui/react-data-table' ;
34import { isEqual } from 'lodash' ;
45import { v4 as uuidv4 } from 'uuid' ;
56
@@ -265,6 +266,11 @@ export default function QueryEditor(props: QueryEditorProps) {
265266 showPreview = { showPreview }
266267 queryText = { lastExecutedQueryText }
267268 onCancelRunningQuery = { handleCancelRunningQuery }
269+ tableSettings = {
270+ isStreamingEnabled && querySettings . limitRows
271+ ? { displayIndices : { maxIndex : querySettings . limitRows } }
272+ : undefined
273+ }
268274 />
269275 </ div >
270276 </ SplitPane >
@@ -285,6 +291,7 @@ interface ResultProps {
285291 path : string ;
286292 showPreview ?: boolean ;
287293 queryText : string ;
294+ tableSettings ?: Partial < Settings > ;
288295 onCancelRunningQuery : VoidFunction ;
289296}
290297function Result ( {
@@ -299,6 +306,7 @@ function Result({
299306 path,
300307 showPreview,
301308 queryText,
309+ tableSettings,
302310 onCancelRunningQuery,
303311} : ResultProps ) {
304312 if ( showPreview ) {
@@ -315,6 +323,7 @@ function Result({
315323 isResultsCollapsed = { resultVisibilityState . collapsed }
316324 isCancelError = { Boolean ( cancelQueryResponse ?. error ) }
317325 isCancelling = { Boolean ( cancelQueryResponse ?. isLoading ) }
326+ tableSettings = { tableSettings }
318327 onExpandResults = { onExpandResultHandler }
319328 onCollapseResults = { onCollapseResultHandler }
320329 queryText = { queryText }
Original file line number Diff line number Diff line change 11import React from 'react' ;
22
3+ import type { Settings } from '@gravity-ui/react-data-table' ;
34import type { ControlGroupOption } from '@gravity-ui/uikit' ;
45import { ClipboardButton , RadioButton } from '@gravity-ui/uikit' ;
56
@@ -82,6 +83,7 @@ interface ExecuteResultProps {
8283 theme ?: string ;
8384 tenantName : string ;
8485 queryText ?: string ;
86+ tableSettings ?: Partial < Settings > ;
8587
8688 isCancelling : boolean ;
8789 isCancelError : boolean ;
@@ -99,6 +101,7 @@ export function QueryResultViewer({
99101 queryText,
100102 isCancelling,
101103 isCancelError,
104+ tableSettings,
102105 onCancelRunningQuery,
103106 onCollapseResults,
104107 onExpandResults,
@@ -230,6 +233,7 @@ export function QueryResultViewer({
230233 resultSets = { resultSets }
231234 error = { error }
232235 selectedResultSet = { selectedResultSet }
236+ tableSettings = { tableSettings }
233237 setSelectedResultSet = { setSelectedResultSet }
234238 />
235239 ) ;
Original file line number Diff line number Diff line change 1+ import type { Settings } from '@gravity-ui/react-data-table' ;
12import { Tabs , Text } from '@gravity-ui/uikit' ;
23
34import { QueryResultTable } from '../../../../../../components/QueryResultTable' ;
@@ -15,6 +16,7 @@ interface ResultSetsViewerProps {
1516 resultSets ?: ParsedResultSet [ ] ;
1617 selectedResultSet : number ;
1718 error ?: unknown ;
19+ tableSettings ?: Partial < Settings > ;
1820 setSelectedResultSet : ( resultSet : number ) => void ;
1921}
2022
@@ -73,7 +75,11 @@ export function ResultSetsViewer(props: ResultSetsViewerProps) {
7375 { currentResult ? (
7476 < div className = { b ( 'result' ) } >
7577 { renderResultHeadWithCount ( ) }
76- < QueryResultTable data = { currentResult . result } columns = { currentResult . columns } />
78+ < QueryResultTable
79+ settings = { props . tableSettings }
80+ data = { currentResult . result }
81+ columns = { currentResult . columns }
82+ />
7783 </ div >
7884 ) : null }
7985 </ div >
You can’t perform that action at this time.
0 commit comments