Show only relevant tabs
Some checks reported errors
continuous-integration/drone/push Build was killed
continuous-integration/drone/pr Build is passing

This commit is contained in:
Pierre HUBERT 2024-12-06 19:02:21 +01:00
parent a7d22e2a7f
commit 5bf914d1f2

View File

@ -59,6 +59,10 @@ function AuthenticatedApp(): React.ReactElement {
const load = async () => { const load = async () => {
setRights(await ServerApi.GetRights()); setRights(await ServerApi.GetRights());
if (rights!.groups.length > 0) setTab("group");
else if (rights!.vms.length > 0) setTab("vm");
else setTab("info");
}; };
return ( return (
@ -87,27 +91,21 @@ function AuthenticatedApp(): React.ReactElement {
selectedValue={tab} selectedValue={tab}
onTabSelect={(_, d) => setTab(d.value as any)} onTabSelect={(_, d) => setTab(d.value as any)}
> >
<Tab {rights!.groups.length > 0 && (
value="group" <Tab value="group" icon={<AppListIcon />}>
icon={<AppListIcon />}
disabled={rights!.groups.length === 0}
>
Groups Groups
</Tab> </Tab>
<Tab )}
value="vm" {rights!.vms.length > 0 && (
icon={<DesktopIcon />} <Tab value="vm" icon={<DesktopIcon />}>
disabled={rights!.vms.length === 0}
>
Virtual machines Virtual machines
</Tab> </Tab>
<Tab )}
value="info" {rights!.sys_info && (
icon={<InfoIcon />} <Tab value="info" icon={<InfoIcon />}>
disabled={!rights!.sys_info}
>
System info System info
</Tab> </Tab>
)}
</TabList> </TabList>
<div> <div>
<MainMenu /> <MainMenu />