From bd76648e4e74725b95fb927196e690a8be68b2e7 Mon Sep 17 00:00:00 2001 From: Diego Medina Date: Wed, 9 Mar 2022 14:19:18 -0500 Subject: [PATCH] fix: show the total row count in the SQL Lab Query History tab when limited by DISPLAY_MAX_ROW (#19054) --- .../src/SqlLab/components/ResultSet/index.tsx | 8 +++++--- superset-frontend/src/SqlLab/reducers/sqlLab.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx index 6f6642d840..4d8818b1d9 100644 --- a/superset-frontend/src/SqlLab/components/ResultSet/index.tsx +++ b/superset-frontend/src/SqlLab/components/ResultSet/index.tsx @@ -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 = @@ -657,7 +659,7 @@ export default class ResultSet extends React.PureComponent<