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 />} Groups
disabled={rights!.groups.length === 0} </Tab>
> )}
Groups {rights!.vms.length > 0 && (
</Tab> <Tab value="vm" icon={<DesktopIcon />}>
<Tab Virtual machines
value="vm" </Tab>
icon={<DesktopIcon />} )}
disabled={rights!.vms.length === 0} {rights!.sys_info && (
> <Tab value="info" icon={<InfoIcon />}>
Virtual machines System info
</Tab> </Tab>
<Tab )}
value="info"
icon={<InfoIcon />}
disabled={!rights!.sys_info}
>
System info
</Tab>
</TabList> </TabList>
<div> <div>
<MainMenu /> <MainMenu />