You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2025/07/24 03:46:23 UTC

(superset) 01/01: feat: re-order CRUD list view action buttons

This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch dash_props
in repository https://gitbox.apache.org/repos/asf/superset.git

commit cb5b61d255ae712f4863565f516804b10f10157a
Author: Maxime Beauchemin <ma...@gmail.com>
AuthorDate: Wed Jul 23 20:39:57 2025 -0700

    feat: re-order CRUD list view action buttons
    
    OCD in action, I'm repositioning the buttons in most CRUD views:
    - import Icon is put left-most
    - primary "add new" button is right-most
---
 .../src/pages/AlertReportList/index.tsx            | 17 +++++-----
 .../src/pages/AnnotationLayerList/index.tsx        | 16 +++++-----
 superset-frontend/src/pages/ChartList/index.tsx    | 32 ++++++++++---------
 .../src/pages/CssTemplateList/index.tsx            | 16 +++++-----
 .../src/pages/DashboardList/index.tsx              | 32 ++++++++++---------
 superset-frontend/src/pages/DatasetList/index.tsx  | 36 ++++++++++++----------
 .../src/pages/RowLevelSecurityList/index.tsx       | 12 ++++----
 .../src/pages/SavedQueryList/index.tsx             | 35 +++++++++++----------
 8 files changed, 104 insertions(+), 92 deletions(-)

diff --git a/superset-frontend/src/pages/AlertReportList/index.tsx b/superset-frontend/src/pages/AlertReportList/index.tsx
index e6fec4dfda..b8fbe1199d 100644
--- a/superset-frontend/src/pages/AlertReportList/index.tsx
+++ b/superset-frontend/src/pages/AlertReportList/index.tsx
@@ -429,6 +429,15 @@ function AlertList({
 
   const subMenuButtons: SubMenuProps['buttons'] = [];
 
+  if (canDelete) {
+    subMenuButtons.push({
+      name: t('Bulk select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+      'data-test': 'bulk-select-toggle',
+    });
+  }
+
   if (canCreate) {
     subMenuButtons.push({
       icon: <Icons.PlusOutlined iconSize="m" />,
@@ -439,14 +448,6 @@ function AlertList({
       },
     });
   }
-  if (canDelete) {
-    subMenuButtons.push({
-      name: t('Bulk select'),
-      onClick: toggleBulkSelect,
-      buttonStyle: 'secondary',
-      'data-test': 'bulk-select-toggle',
-    });
-  }
 
   const emptyState = {
     title: t('No %s yet', titlePlural),
diff --git a/superset-frontend/src/pages/AnnotationLayerList/index.tsx b/superset-frontend/src/pages/AnnotationLayerList/index.tsx
index 65ff7efd6d..3fa81873ba 100644
--- a/superset-frontend/src/pages/AnnotationLayerList/index.tsx
+++ b/superset-frontend/src/pages/AnnotationLayerList/index.tsx
@@ -226,6 +226,14 @@ function AnnotationLayersList({
 
   const subMenuButtons: SubMenuProps['buttons'] = [];
 
+  if (canDelete) {
+    subMenuButtons.push({
+      name: t('Bulk select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+    });
+  }
+
   if (canCreate) {
     subMenuButtons.push({
       icon: <Icons.PlusOutlined iconSize="m" />,
@@ -237,14 +245,6 @@ function AnnotationLayersList({
     });
   }
 
-  if (canDelete) {
-    subMenuButtons.push({
-      name: t('Bulk select'),
-      onClick: toggleBulkSelect,
-      buttonStyle: 'secondary',
-    });
-  }
-
   const filters: ListViewFilters = useMemo(
     () => [
       {
diff --git a/superset-frontend/src/pages/ChartList/index.tsx b/superset-frontend/src/pages/ChartList/index.tsx
index c96491ca00..6eb832c9c0 100644
--- a/superset-frontend/src/pages/ChartList/index.tsx
+++ b/superset-frontend/src/pages/ChartList/index.tsx
@@ -765,6 +765,23 @@ function ChartList(props: ChartListProps) {
   );
 
   const subMenuButtons: SubMenuProps['buttons'] = [];
+
+  if (canCreate) {
+    subMenuButtons.push({
+      name: (
+        <Tooltip
+          id="import-tooltip"
+          title={t('Import charts')}
+          placement="bottomRight"
+        >
+          <Icons.DownloadOutlined iconSize="l" data-test="import-button" />
+        </Tooltip>
+      ),
+      buttonStyle: 'link',
+      onClick: openChartImportModal,
+    });
+  }
+
   if (canDelete || canExport) {
     subMenuButtons.push({
       name: t('Bulk select'),
@@ -773,6 +790,7 @@ function ChartList(props: ChartListProps) {
       onClick: toggleBulkSelect,
     });
   }
+
   if (canCreate) {
     subMenuButtons.push({
       icon: <Icons.PlusOutlined iconSize="m" />,
@@ -782,20 +800,6 @@ function ChartList(props: ChartListProps) {
         history.push('/chart/add');
       },
     });
-
-    subMenuButtons.push({
-      name: (
-        <Tooltip
-          id="import-tooltip"
-          title={t('Import charts')}
-          placement="bottomRight"
-        >
-          <Icons.DownloadOutlined iconSize="l" data-test="import-button" />
-        </Tooltip>
-      ),
-      buttonStyle: 'link',
-      onClick: openChartImportModal,
-    });
   }
 
   return (
diff --git a/superset-frontend/src/pages/CssTemplateList/index.tsx b/superset-frontend/src/pages/CssTemplateList/index.tsx
index f112f85474..497ff882c3 100644
--- a/superset-frontend/src/pages/CssTemplateList/index.tsx
+++ b/superset-frontend/src/pages/CssTemplateList/index.tsx
@@ -200,6 +200,14 @@ function CssTemplatesList({
 
   const subMenuButtons: SubMenuProps['buttons'] = [];
 
+  if (canDelete) {
+    subMenuButtons.push({
+      name: t('Bulk select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+    });
+  }
+
   if (canCreate) {
     subMenuButtons.push({
       name: <>{t('CSS template')}</>,
@@ -212,14 +220,6 @@ function CssTemplatesList({
     });
   }
 
-  if (canDelete) {
-    subMenuButtons.push({
-      name: t('Bulk select'),
-      onClick: toggleBulkSelect,
-      buttonStyle: 'secondary',
-    });
-  }
-
   menuData.buttons = subMenuButtons;
 
   const filters: ListViewFilters = useMemo(
diff --git a/superset-frontend/src/pages/DashboardList/index.tsx b/superset-frontend/src/pages/DashboardList/index.tsx
index 504d42a50d..25856e7179 100644
--- a/superset-frontend/src/pages/DashboardList/index.tsx
+++ b/superset-frontend/src/pages/DashboardList/index.tsx
@@ -686,6 +686,23 @@ function DashboardList(props: DashboardListProps) {
   );
 
   const subMenuButtons: SubMenuProps['buttons'] = [];
+
+  if (canCreate) {
+    subMenuButtons.push({
+      name: (
+        <Tooltip
+          id="import-tooltip"
+          title={t('Import dashboards')}
+          placement="bottomRight"
+        >
+          <Icons.DownloadOutlined iconSize="l" data-test="import-button" />
+        </Tooltip>
+      ),
+      buttonStyle: 'link',
+      onClick: openDashboardImportModal,
+    });
+  }
+
   if (canDelete || canExport) {
     subMenuButtons.push({
       name: t('Bulk select'),
@@ -694,6 +711,7 @@ function DashboardList(props: DashboardListProps) {
       onClick: toggleBulkSelect,
     });
   }
+
   if (canCreate) {
     subMenuButtons.push({
       icon: <Icons.PlusOutlined iconSize="m" />,
@@ -703,20 +721,6 @@ function DashboardList(props: DashboardListProps) {
         navigateTo('/dashboard/new', { assign: true });
       },
     });
-
-    subMenuButtons.push({
-      name: (
-        <Tooltip
-          id="import-tooltip"
-          title={t('Import dashboards')}
-          placement="bottomRight"
-        >
-          <Icons.DownloadOutlined iconSize="l" data-test="import-button" />
-        </Tooltip>
-      ),
-      buttonStyle: 'link',
-      onClick: openDashboardImportModal,
-    });
   }
   return (
     <>
diff --git a/superset-frontend/src/pages/DatasetList/index.tsx b/superset-frontend/src/pages/DatasetList/index.tsx
index 3ff182d070..25e655c8ea 100644
--- a/superset-frontend/src/pages/DatasetList/index.tsx
+++ b/superset-frontend/src/pages/DatasetList/index.tsx
@@ -634,24 +634,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
 
   const buttonArr: Array<ButtonProps> = [];
 
-  if (canDelete || canExport) {
-    buttonArr.push({
-      name: t('Bulk select'),
-      onClick: toggleBulkSelect,
-      buttonStyle: 'secondary',
-    });
-  }
-
   if (canCreate) {
-    buttonArr.push({
-      icon: <Icons.PlusOutlined iconSize="m" />,
-      name: t('Dataset'),
-      onClick: () => {
-        history.push('/dataset/add/');
-      },
-      buttonStyle: 'primary',
-    });
-
     buttonArr.push({
       name: (
         <Tooltip
@@ -671,6 +654,25 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
     });
   }
 
+  if (canDelete || canExport) {
+    buttonArr.push({
+      name: t('Bulk select'),
+      onClick: toggleBulkSelect,
+      buttonStyle: 'secondary',
+    });
+  }
+
+  if (canCreate) {
+    buttonArr.push({
+      icon: <Icons.PlusOutlined iconSize="m" />,
+      name: t('Dataset'),
+      onClick: () => {
+        history.push('/dataset/add/');
+      },
+      buttonStyle: 'primary',
+    });
+  }
+
   menuData.buttons = buttonArr;
 
   const closeDatasetDeleteModal = () => {
diff --git a/superset-frontend/src/pages/RowLevelSecurityList/index.tsx b/superset-frontend/src/pages/RowLevelSecurityList/index.tsx
index 6276e634f3..fa0f3085f5 100644
--- a/superset-frontend/src/pages/RowLevelSecurityList/index.tsx
+++ b/superset-frontend/src/pages/RowLevelSecurityList/index.tsx
@@ -313,18 +313,18 @@ function RowLevelSecurityList(props: RLSProps) {
   const subMenuButtons: SubMenuProps['buttons'] = [];
 
   if (canWrite) {
-    subMenuButtons.push({
-      name: t('Rule'),
-      icon: <Icons.PlusOutlined iconSize="m" data-test="add-rule" />,
-      buttonStyle: 'primary',
-      onClick: () => handleRuleEdit(null),
-    });
     subMenuButtons.push({
       name: t('Bulk select'),
       buttonStyle: 'secondary',
       'data-test': 'bulk-select',
       onClick: toggleBulkSelect,
     });
+    subMenuButtons.push({
+      name: t('Rule'),
+      icon: <Icons.PlusOutlined iconSize="m" data-test="add-rule" />,
+      buttonStyle: 'primary',
+      onClick: () => handleRuleEdit(null),
+    });
   }
 
   return (
diff --git a/superset-frontend/src/pages/SavedQueryList/index.tsx b/superset-frontend/src/pages/SavedQueryList/index.tsx
index fffabde743..6a1932a4d1 100644
--- a/superset-frontend/src/pages/SavedQueryList/index.tsx
+++ b/superset-frontend/src/pages/SavedQueryList/index.tsx
@@ -190,6 +190,24 @@ function SavedQueryList({
 
   const subMenuButtons: Array<ButtonProps> = [];
 
+  if (canCreate) {
+    subMenuButtons.push({
+      name: (
+        <Tooltip
+          id="import-tooltip"
+          title={t('Import queries')}
+          placement="bottomRight"
+          data-test="import-tooltip-test"
+        >
+          <Icons.DownloadOutlined data-test="import-icon" iconSize="l" />
+        </Tooltip>
+      ),
+      buttonStyle: 'link',
+      onClick: openSavedQueryImportModal,
+      'data-test': 'import-button',
+    });
+  }
+
   if (canDelete) {
     subMenuButtons.push({
       name: t('Bulk select'),
@@ -210,23 +228,6 @@ function SavedQueryList({
       history.push('/sqllab?new=true');
     },
   });
-  if (canCreate) {
-    subMenuButtons.push({
-      name: (
-        <Tooltip
-          id="import-tooltip"
-          title={t('Import queries')}
-          placement="bottomRight"
-          data-test="import-tooltip-test"
-        >
-          <Icons.DownloadOutlined data-test="import-icon" iconSize="l" />
-        </Tooltip>
-      ),
-      buttonStyle: 'link',
-      onClick: openSavedQueryImportModal,
-      'data-test': 'import-button',
-    });
-  }
 
   menuData.buttons = subMenuButtons;