mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: show the total row count in the SQL Lab Query History tab when limited by DISPLAY_MAX_ROW (#19054)
This commit is contained in:
parent
f53f86f796
commit
bd76648e4e
@ -583,18 +583,20 @@ export default class ResultSet extends React.PureComponent<
|
|||||||
const limitReached = results?.displayLimitReached;
|
const limitReached = results?.displayLimitReached;
|
||||||
const limit = queryLimit || results.query.limit;
|
const limit = queryLimit || results.query.limit;
|
||||||
const isAdmin = !!this.props.user?.roles?.Admin;
|
const isAdmin = !!this.props.user?.roles?.Admin;
|
||||||
|
const rowsCount = Math.min(rows || 0, results?.data?.length || 0);
|
||||||
|
|
||||||
const displayMaxRowsReachedMessage = {
|
const displayMaxRowsReachedMessage = {
|
||||||
withAdmin: t(
|
withAdmin: t(
|
||||||
'The number of results displayed is limited to %(rows)d by the configuration DISPLAY_MAX_ROWS. ' +
|
'The number of results displayed is limited to %(rows)d by the configuration DISPLAY_MAX_ROWS. ' +
|
||||||
'Please add additional limits/filters or download to csv to see more rows up to ' +
|
'Please add additional limits/filters or download to csv to see more rows up to ' +
|
||||||
'the %(limit)d limit.',
|
'the %(limit)d limit.',
|
||||||
{ rows, limit },
|
{ rows: rowsCount, limit },
|
||||||
),
|
),
|
||||||
withoutAdmin: t(
|
withoutAdmin: t(
|
||||||
'The number of results displayed is limited to %(rows)d. ' +
|
'The number of results displayed is limited to %(rows)d. ' +
|
||||||
'Please add additional limits/filters, download to csv, or contact an admin ' +
|
'Please add additional limits/filters, download to csv, or contact an admin ' +
|
||||||
'to see more rows up to the %(limit)d limit.',
|
'to see more rows up to the %(limit)d limit.',
|
||||||
{ rows, limit },
|
{ rows: rowsCount, limit },
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
const shouldUseDefaultDropdownAlert =
|
const shouldUseDefaultDropdownAlert =
|
||||||
@ -657,7 +659,7 @@ export default class ResultSet extends React.PureComponent<
|
|||||||
<Alert
|
<Alert
|
||||||
type="warning"
|
type="warning"
|
||||||
onClose={this.onAlertClose}
|
onClose={this.onAlertClose}
|
||||||
message={t('%(rows)d rows returned', { rows })}
|
message={t('%(rows)d rows returned', { rows: rowsCount })}
|
||||||
description={
|
description={
|
||||||
isAdmin
|
isAdmin
|
||||||
? displayMaxRowsReachedMessage.withAdmin
|
? displayMaxRowsReachedMessage.withAdmin
|
||||||
|
@ -332,7 +332,7 @@ export default function sqlLabReducer(state = {}, action) {
|
|||||||
endDttm: now(),
|
endDttm: now(),
|
||||||
progress: 100,
|
progress: 100,
|
||||||
results: action.results,
|
results: action.results,
|
||||||
rows: action?.results?.data?.length,
|
rows: action?.results?.query?.rows || 0,
|
||||||
state: 'success',
|
state: 'success',
|
||||||
limitingFactor: action?.results?.query?.limitingFactor,
|
limitingFactor: action?.results?.query?.limitingFactor,
|
||||||
tempSchema: action?.results?.query?.tempSchema,
|
tempSchema: action?.results?.query?.tempSchema,
|
||||||
|
Loading…
Reference in New Issue
Block a user