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