feat: add dropdown to user and project list navbar

This commit is contained in:
Christoph Kluge 2024-09-02 17:55:12 +02:00
parent 4ec1de6900
commit 906bac965f
2 changed files with 45 additions and 3 deletions

View File

@ -48,6 +48,7 @@
href: `/monitoring/user/${username}`, href: `/monitoring/user/${username}`,
icon: "bar-chart-line-fill", icon: "bar-chart-line-fill",
perCluster: false, perCluster: false,
listOptions: false,
menu: "none", menu: "none",
}, },
{ {
@ -56,6 +57,7 @@
href: `/monitoring/jobs/`, href: `/monitoring/jobs/`,
icon: "card-list", icon: "card-list",
perCluster: false, perCluster: false,
listOptions: false,
menu: "none", menu: "none",
}, },
{ {
@ -63,7 +65,8 @@
requiredRole: roles.manager, requiredRole: roles.manager,
href: "/monitoring/users/", href: "/monitoring/users/",
icon: "people-fill", icon: "people-fill",
perCluster: false, perCluster: true,
listOptions: true,
menu: "Groups", menu: "Groups",
}, },
{ {
@ -71,7 +74,8 @@
requiredRole: roles.support, requiredRole: roles.support,
href: "/monitoring/projects/", href: "/monitoring/projects/",
icon: "folder", icon: "folder",
perCluster: false, perCluster: true,
listOptions: true,
menu: "Groups", menu: "Groups",
}, },
{ {
@ -80,6 +84,7 @@
href: "/monitoring/tags/", href: "/monitoring/tags/",
icon: "tags", icon: "tags",
perCluster: false, perCluster: false,
listOptions: false,
menu: "Groups", menu: "Groups",
}, },
{ {
@ -88,6 +93,7 @@
href: "/monitoring/analysis/", href: "/monitoring/analysis/",
icon: "graph-up", icon: "graph-up",
perCluster: true, perCluster: true,
listOptions: false,
menu: "Stats", menu: "Stats",
}, },
{ {
@ -96,6 +102,7 @@
href: "/monitoring/systems/", href: "/monitoring/systems/",
icon: "cpu", icon: "cpu",
perCluster: true, perCluster: true,
listOptions: false,
menu: "Groups", menu: "Groups",
}, },
{ {
@ -104,6 +111,7 @@
href: "/monitoring/status/", href: "/monitoring/status/",
icon: "cpu", icon: "cpu",
perCluster: true, perCluster: true,
listOptions: false,
menu: "Stats", menu: "Stats",
}, },
]; ];

View File

@ -21,7 +21,41 @@
</script> </script>
{#each links as item} {#each links as item}
{#if !item.perCluster} {#if item.listOptions}
<Dropdown nav inNavbar>
<DropdownToggle nav caret>
<Icon name={item.icon} />
{item.title}
</DropdownToggle>
<DropdownMenu class="dropdown-menu-lg-end">
<DropdownItem
href={item.href}
>
All Clusters
</DropdownItem>
<DropdownItem divider />
{#each clusters as cluster}
<Dropdown nav direction="right">
<DropdownToggle nav caret class="dropdown-item py-1 px-2">
{cluster.name}
</DropdownToggle>
<DropdownMenu>
<DropdownItem class="py-1 px-2"
href={item.href + '?cluster=' + cluster.name}
>
All Jobs
</DropdownItem>
<DropdownItem class="py-1 px-2"
href={item.href + '?cluster=' + cluster.name + '&state=running'}
>
Running Jobs
</DropdownItem>
</DropdownMenu>
</Dropdown>
{/each}
</DropdownMenu>
</Dropdown>
{:else if !item.perCluster}
<NavLink href={item.href} active={window.location.pathname == item.href} <NavLink href={item.href} active={window.location.pathname == item.href}
><Icon name={item.icon} /> {item.title}</NavLink ><Icon name={item.icon} /> {item.title}</NavLink
> >