1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

F #5422: Add order to sidebar items (#1479)

This commit is contained in:
Sergio Betanzos 2021-09-24 10:48:09 +02:00 committed by GitHub
parent 806bebd209
commit 589c567c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -34,6 +34,7 @@ export const ENDPOINTS = [
path: PATH.DASHBOARD,
sidebar: true,
icon: DashboardIcon,
position: 1,
Component: Dashboard
},
{
@ -41,6 +42,7 @@ export const ENDPOINTS = [
path: PATH.SETTINGS,
sidebar: true,
icon: SettingsIcon,
position: -1,
Component: Settings
}
]

View File

@ -46,6 +46,7 @@ const Sidebar = ({ endpoints }) => {
const SidebarEndpoints = useMemo(
() => endpoints
?.filter(({ sidebar = false }) => sidebar)
?.sort(({ position: posA = 1 }, { position: posB = 1 }) => posB - posA)
?.map((endpoint, index) =>
endpoint.routes ? (
<SidebarCollapseItem key={`item-${index}`} {...endpoint} />