Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: keep the tab order #30888

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@US579 will this change affect the pdf generation as well or just the dropdown ui in the modal?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will not affect pdf generation, just dropdown UI
when there is only one tab, the all tab option will not be showed up

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we add all tab it will just be a list with one anchor
eg.
['anchor']

so it is same as setting one tab directly


setTabOptions(tabTree);

const anchor = currentAlert?.extra?.dashboard?.anchor;
Expand Down
Loading