Skip to content

Commit

Permalink
fix: show the total row count in the SQL Lab Query History tab when l…
Browse files Browse the repository at this point in the history
…imited by DISPLAY_MAX_ROW (#19054)
  • Loading branch information
diegomedina248 authored Mar 9, 2022
1 parent f53f86f commit bd76648
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions superset-frontend/src/SqlLab/components/ResultSet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,18 +583,20 @@ export default class ResultSet extends React.PureComponent<
const limitReached = results?.displayLimitReached;
const limit = queryLimit || results.query.limit;
const isAdmin = !!this.props.user?.roles?.Admin;
const rowsCount = Math.min(rows || 0, results?.data?.length || 0);

const displayMaxRowsReachedMessage = {
withAdmin: t(
'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 ' +
'the %(limit)d limit.',
{ rows, limit },
{ rows: rowsCount, limit },
),
withoutAdmin: t(
'The number of results displayed is limited to %(rows)d. ' +
'Please add additional limits/filters, download to csv, or contact an admin ' +
'to see more rows up to the %(limit)d limit.',
{ rows, limit },
{ rows: rowsCount, limit },
),
};
const shouldUseDefaultDropdownAlert =
Expand Down Expand Up @@ -657,7 +659,7 @@ export default class ResultSet extends React.PureComponent<
<Alert
type="warning"
onClose={this.onAlertClose}
message={t('%(rows)d rows returned', { rows })}
message={t('%(rows)d rows returned', { rows: rowsCount })}
description={
isAdmin
? displayMaxRowsReachedMessage.withAdmin
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/SqlLab/reducers/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export default function sqlLabReducer(state = {}, action) {
endDttm: now(),
progress: 100,
results: action.results,
rows: action?.results?.data?.length,
rows: action?.results?.query?.rows || 0,
state: 'success',
limitingFactor: action?.results?.query?.limitingFactor,
tempSchema: action?.results?.query?.tempSchema,
Expand Down

0 comments on commit bd76648

Please sign in to comment.