eschutho commented on a change in pull request #14381:
URL: https://github.com/apache/superset/pull/14381#discussion_r631455067



##########
File path: superset-frontend/src/SqlLab/components/ResultSet.tsx
##########
@@ -501,22 +529,79 @@ export default class ResultSet extends 
React.PureComponent<
     return <div />;
   }
 
+  onAlertClose = () => {
+    this.setState({ alertIsOpen: false });
+  };
+
   renderRowsReturned() {
-    const { results, rows, queryLimit } = this.props.query;
-    const limitReached = results?.displayLimitReached;
+    const { results, rows, queryLimit, limitingFactor } = this.props.query;
+    let limitMessage;
+    const isAdmin = this.props.user?.roles.hasOwnProperty('Admin');
+    const adminWarning = isAdmin
+      ? ' by the configuration DISPLAY_MAX_ROWS'
+      : null;
+    if (limitingFactor === LIMITING_FACTOR.QUERY && this.props.csv) {
+      limitMessage = (
+        <span className="limitMessage">
+          {t(
+            `The number of rows displayed is limited to %s by the query`,
+            rows,
+          )}
+        </span>
+      );
+    } else if (
+      limitingFactor === LIMITING_FACTOR.DROPDOWN &&
+      !defaultDropdown(queryLimit, limitingFactor)
+    ) {
+      limitMessage = (
+        <span className="limitMessage">
+          {t(
+            `The number of rows displayed is limited to %s by the limit 
dropdown.`,
+            rows,
+          )}
+        </span>
+      );
+    } else if (limitingFactor === LIMITING_FACTOR.QUERY_AND_DROPDOWN) {
+      limitMessage = (
+        <span className="limitMessage">
+          {t(
+            `The number of rows displayed is limited to %s by the query and 
limit dropdown.`,
+            rows,
+          )}
+        </span>
+      );
+    }
     return (
-      <ReturnedRows>
-        {!limitReached && (
-          <Alert type="warning" message={t(`%s rows returned`, rows)} />
-        )}
-        {limitReached && (
+      <ReturnedRows ref={this.alertRef}>
+        {!limitReached(results?.displayLimitReached) &&
+          !defaultDropdown(queryLimit, limitingFactor) && (
+            <span>
+              {t(`%s rows returned`, rows)} {limitMessage}
+            </span>
+          )}
+        {!limitReached(results?.displayLimitReached) &&
+          defaultDropdown(queryLimit, limitingFactor) && (
+            <Alert
+              type="warning"
+              message={t(`%s rows returned`, rows)}
+              onClose={this.onAlertClose}
+              description={t(
+                `The number of rows displayed is limited to %s by the 
dropdown.`,
+                rows,
+              )}
+            />
+          )}
+        {limitReached(results?.displayLimitReached) && (
           <Alert
             type="warning"
-            message={t(
-              `The number of results displayed is limited to %s. Please add
-            additional limits/filters or download to csv to see more rows up to
-            the %s limit.`,
+            onClose={this.onAlertClose}
+            message={t(`%s rows returned`, rows)}
+            description={t(
+              `The number of results displayed is limited to %s%s. Please add
+              additional limits/filters or download to csv to see more rows up 
to
+              the %s limit. %s`,

Review comment:
       do I see four string placeholders above, but three values below? 
AdminWarning isn't going to get translated either, btw.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to