betodealmeida commented on a change in pull request #14885:
URL: https://github.com/apache/superset/pull/14885#discussion_r641770448



##########
File path: superset-frontend/src/SqlLab/components/QueryTable/index.jsx
##########
@@ -98,6 +115,36 @@ const QueryTable = props => {
           q.duration = fDuration(q.startDttm, q.endDttm);
         }
         const time = moment(q.startDttm).format().split('T');
+        const statusConfig = {
+          name: '',
+          label: '',
+          status: '',
+        };
+        if (q.state === 'success') {

Review comment:
       To simplify some of the code here and where you set the color you could 
move all of this to a map:
   
   ```js
   statusAttributes = {
     success: {
       color: theme.colors.success.base,
       config: {
         name: 'check',
         label: t('Success'),
         status: 'success',
       },
     },
     ...
   }
   ```
   
   Then you can get the color with:
   
   ```js
   color: ${({ status, theme }) => statusAttributes[status]?.color || 
theme.colors.grayscale.base;
   ```
   
   And here:
   
   ```js
   statusConfig = statusAttributes[q.state]?.config || defaultStatusConfig;
   ```




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