diff --git a/frontend/src/components/App/TopBar.tsx b/frontend/src/components/App/TopBar.tsx index f8391bdf37..1b392a8cfc 100644 --- a/frontend/src/components/App/TopBar.tsx +++ b/frontend/src/components/App/TopBar.tsx @@ -139,9 +139,21 @@ function AppBarActionsMenu({ appBarActions.map(action => { const Action = has(action, 'action') ? action.action : action; if (React.isValidElement(Action)) { + const label = (action as AppBarAction)?.label; return ( - {Action} + + + {Action} + + {label && } + ); } else if (Action === null) { @@ -150,7 +162,10 @@ function AppBarActionsMenu({ const ActionComponent = Action as React.FC; return ( - + @@ -308,33 +323,41 @@ export function PureTopBar({ id: DefaultAppBarAction.NOTIFICATION, action: null, }, - { - id: DefaultAppBarAction.SETTINGS, - action: ( - - - - ), - }, + ...(isClusterContext + ? [ + { + id: DefaultAppBarAction.SETTINGS, + action: , + label: t('translation|Settings'), + onClick: () => { + handleMenuClose(); + history.push(createRouteURL('settingsCluster', { cluster })); + }, + }, + ] + : []), { id: DefaultAppBarAction.USER, action: !!isClusterContext && ( - - { - handleMenuClose(); - handleProfileMenuOpen(event); - }} - size="medium" - > - - - + { + handleMenuClose(); + handleProfileMenuOpen(event); + }} + size="medium" + > + + ), + label: t('translation|Account'), + onClick: (event: React.MouseEvent) => { + handleMenuClose(); + handleProfileMenuOpen(event); + }, }, ]; const renderMobileMenu = ( @@ -395,6 +418,12 @@ export function PureTopBar({ ), }, ]; + + const visibleMobileActions = processAppBarActions( + allAppBarActionsMobile, + appBarActionsProcessors + ).filter(action => React.isValidElement(action.action) || typeof action === 'function'); + return ( <> - - - + {visibleMobileActions.length > 0 && ( + + + + )} ) : ( <> diff --git a/frontend/src/redux/actionButtonsSlice.ts b/frontend/src/redux/actionButtonsSlice.ts index cf96080970..51a4e7c030 100644 --- a/frontend/src/redux/actionButtonsSlice.ts +++ b/frontend/src/redux/actionButtonsSlice.ts @@ -22,6 +22,8 @@ export type RowAction = { export type AppBarAction = { id: string; action?: AppBarActionType; + label?: string; + onClick?: (args?: any) => void; }; export enum DefaultHeaderAction {