villebro commented on a change in pull request #11880:
URL: 
https://github.com/apache/incubator-superset/pull/11880#discussion_r534158986



##########
File path: superset-frontend/src/dashboard/components/SliceHeaderControls.jsx
##########
@@ -171,11 +171,18 @@ class SliceHeaderControls extends React.PureComponent {
       addDangerToast,
       isFullSize,
     } = this.props;
-    const cachedWhen = moment.utc(cachedDttm).fromNow();
+    const cachedWhen = cachedDttm.map(itemCachedDttm =>
+      moment.utc(itemCachedDttm).fromNow(),
+    );
     const updatedWhen = updatedDttm ? moment.utc(updatedDttm).fromNow() : '';
-    const refreshTooltip = isCached
-      ? t('Cached %s', cachedWhen)
-      : (updatedWhen && t('Fetched %s', updatedWhen)) || '';
+    const getCachedTitle = itemCached => {
+      return itemCached
+        ? t('Cached %s', cachedWhen)
+        : updatedWhen && t('Fetched %s', updatedWhen);
+    };
+    let refreshTooltip = isCached.map(getCachedTitle) || '';
+    // If all queries have same cache time we can unit them to one
+    refreshTooltip = [...new Set(refreshTooltip)].join(', ');

Review comment:
       I wonder if we should instead have something like this for the case when 
there are more than one result:
   ```
   *Force refresh*
   Query 1: Fetched a minute ago
   Query 2: Fetched 3 minutes ago
   Query 3: Not cached
   ```
   Also, we should think about how to display multiple results in the "View 
Results" tab. But that can wait; let's just make sure the user experience is 
unchanged for single queries.




----------------------------------------------------------------
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