You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2025/02/21 16:23:46 UTC
(superset) 02/04: fix: keep the tab order (#30888)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 5.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 45045d3a1c901a2bd1d4bd7125991fe4fb220685
Author: Steven Liu <wz...@gmail.com>
AuthorDate: Thu Feb 20 10:26:36 2025 +1100
fix: keep the tab order (#30888)
Co-authored-by: Steven Liu <st...@covergenius.com>
(cherry picked from commit d5a5bd46d2119847e8525907ddf7e28c2e29696a)
---
.../src/features/alerts/AlertReportModal.tsx | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index f3f8bab182..f230a02b52 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -826,11 +826,19 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
})
.then(response => {
const { tab_tree: tabTree, all_tabs: allTabs } = response.json.result;
- tabTree.push({
- title: 'All Tabs',
- // select tree only works with string value
- value: JSON.stringify(Object.keys(allTabs)),
- });
+ const allTabsWithOrder = tabTree.map(
+ (tab: { value: string }) => tab.value,
+ );
+
+ // Only show all tabs when there are more than one tab
+ if (allTabsWithOrder.length > 1) {
+ tabTree.push({
+ title: 'All Tabs',
+ // select tree only works with string value
+ value: JSON.stringify(allTabsWithOrder),
+ });
+ }
+
setTabOptions(tabTree);
const anchor = currentAlert?.extra?.dashboard?.anchor;