Show only relevant tabs
This commit is contained in:
parent
a7d22e2a7f
commit
5bf914d1f2
@ -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 />
|
||||||
|
Loading…
Reference in New Issue
Block a user