nytai commented on a change in pull request #11271:
URL: 
https://github.com/apache/incubator-superset/pull/11271#discussion_r508170265



##########
File path: superset-frontend/src/views/CRUD/csstemplates/CssTemplatesList.tsx
##########
@@ -71,13 +80,105 @@ function CssTemplatesList({
   const canEdit = hasPerm('can_edit');
   const canDelete = hasPerm('can_delete');
 
+  const menuData: SubMenuProps = {
+    name: t('CSS Templates'),
+  };
+
+  const subMenuButtons: Array<ButtonProps> = [];
+
+  if (canDelete) {
+    subMenuButtons.push({
+      name: t('Bulk Select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+    });
+  }
+
+  /* subMenuButtons.push({
+    name: t('+ CSS Template'),
+    onClick: openNewTemplate,
+    buttonStyle: 'primary',
+  }); */
+
+  menuData.buttons = subMenuButtons;
+
+  const [
+    templateCurrentlyDeleting,
+    setTemplateCurrentlyDeleting,
+  ] = useState<TemplateObject | null>(null);
+
+  const handleTemplateDelete = ({ id, template_name }: TemplateObject) => {
+    SupersetClient.delete({
+      endpoint: `/api/v1/css_template/${id}`,
+    }).then(
+      () => {
+        refreshData();
+        setTemplateCurrentlyDeleting(null);
+        addSuccessToast(t('Deleted: %s', template_name));
+      },
+      createErrorHandler(errMsg =>
+        addDangerToast(
+          t('There was an issue deleting %s: %s', template_name, errMsg),
+        ),
+      ),
+    );
+  };
+
+  const handleBulkTemplateDelete = (templatesToDelete: TemplateObject[]) => {
+    SupersetClient.delete({
+      endpoint: `/api/v1/css_template/?q=${rison.encode(
+        templatesToDelete.map(({ id }) => id),
+      )}`,
+    }).then(
+      ({ json = {} }) => {
+        refreshData();
+        addSuccessToast(json.message);
+      },
+      createErrorHandler(errMsg =>
+        addDangerToast(
+          t('There was an issue deleting the selected templates: %s', errMsg),
+        ),
+      ),
+    );
+  };
+
   const initialSort = [{ id: 'template_name', desc: true }];
   const columns = useMemo(
     () => [
       {
         accessor: 'template_name',
         Header: t('Name'),
       },
+      {
+        Cell: ({
+          row: {
+            original: {
+              changed_on_delta_humanized: changedOn,
+              changed_by: changedBy,
+            },
+          },
+        }: any) => {
+          let name = 'null';
+
+          if (changedBy) {
+            name = `${changedBy.first_name} ${changedBy.last_name}`;
+          }
+
+          return (
+            <TooltipWrapper
+              label="allow-run-async-header"
+              tooltip={`${t('Last modified by')} ${name}`}

Review comment:
       Not all languages follow the same grammar structure as english. You can 
pass variables into the `t` function
   ```suggestion
                 tooltip={t('Last modified by %s', name)}
   ```




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