Skip to content
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
13 changes: 8 additions & 5 deletions superset-frontend/src/features/home/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,10 @@ export function Menu({
const path = location.pathname;
switch (true) {
case path.startsWith(Paths.Dashboard):
setActiveTabs(['Dashboards']);
setActiveTabs([t('Dashboards')]);
break;
case path.startsWith(Paths.Chart) || path.startsWith(Paths.Explore):
setActiveTabs(['Charts']);
setActiveTabs([t('Charts')]);
break;
case path.startsWith(Paths.Datasets):
setActiveTabs([datasetsLabel()]);
Expand Down Expand Up @@ -263,9 +263,10 @@ export function Menu({

const childItems: MenuItem[] = [];
childs?.forEach((child: MenuObjectChildProps | string, index1: number) => {
if (typeof child === 'string' && child === '-' && label !== 'Data') {
if (typeof child === 'string' && child === '-' && label !== t('Data')) {
childItems.push({ type: 'divider', key: `divider-${index1}` });
} else if (typeof child !== 'string') {
Object.assign(child, { label: t(child.label) });
childItems.push({
key: `${child.label}`,
label: child.isFrontendRoute ? (
Expand Down Expand Up @@ -366,6 +367,7 @@ export function Menu({
items={menu.map(item => {
const props = {
...item,
label: t(item.label),
isFrontendRoute: isFrontendRoute(item.url),
Comment thread
jakubhruby marked this conversation as resolved.
childs: item.childs?.map(c => {
if (typeof c === 'string') {
Expand Down Expand Up @@ -429,15 +431,16 @@ export default function MenuWrapper({ data, ...rest }: MenuProps) {
// Apply any label override for this item (keyed by FAB internal name).
...(item.name && labelOverrides[item.name]
? { label: labelOverrides[item.name]() }
: {}),
: { label: t(item.label) }),
};

// Filter childs
if (item.childs) {
item.childs.forEach((child: MenuObjectChildProps | string) => {
if (typeof child === 'string') {
children.push(child);
children.push(t(child));
} else if ((child as MenuObjectChildProps).label) {
Object.assign(child, { label: t(child.label) });
children.push(child);
}
});
Expand Down
Loading