Skip to content

Commit 24c2591

Browse files
1704 Adds reusable sideNavMenuDivider menuitem. Updates id's to the actual names they represent
1 parent 8b97e05 commit 24c2591

File tree

1 file changed

+23
-16
lines changed
  • packages/orchestrator-ui-components/src/components/WfoPageTemplate/WfoSidebar

1 file changed

+23
-16
lines changed

packages/orchestrator-ui-components/src/components/WfoPageTemplate/WfoSidebar/WfoSidebar.tsx

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React, { FC, useState } from 'react';
33
import { useTranslations } from 'next-intl';
44
import { useRouter } from 'next/router';
55

6-
import { EuiSideNav, EuiSpacer } from '@elastic/eui';
6+
import { EuiHorizontalRule, EuiSideNav, EuiSpacer } from '@elastic/eui';
77
import { EuiSideNavItemType } from '@elastic/eui/src/components/side_nav/side_nav_types';
88

99
import { WfoIsAllowedToRender, menuItemIsAllowed } from '@/components';
@@ -36,6 +36,12 @@ export const urlPolicyMap = new Map<string, PolicyResource>([
3636
[PATH_SETTINGS, PolicyResource.NAVIGATION_SETTINGS],
3737
]);
3838

39+
export const sideNavMenuDivider: EuiSideNavItemType<object> = {
40+
name: '',
41+
id: 'menuDivider',
42+
renderItem: () => <EuiHorizontalRule margin="xs" />,
43+
};
44+
3945
export type WfoSidebarProps = {
4046
overrideMenuItems?: (
4147
defaultMenuItems: EuiSideNavItemType<object>[],
@@ -60,7 +66,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
6066
const defaultMenuItems: EuiSideNavItemType<object>[] = [
6167
{
6268
name: t('start'),
63-
id: '2',
69+
id: 'start',
6470
isSelected: router.pathname === PATH_START,
6571
href: PATH_START,
6672
renderItem: () => (
@@ -73,7 +79,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
7379
},
7480
{
7581
name: t('subscriptions'),
76-
id: '3',
82+
id: 'subscriptions',
7783
isSelected: router.pathname.startsWith(PATH_SUBSCRIPTIONS),
7884
href: PATH_SUBSCRIPTIONS,
7985
renderItem: () => (
@@ -86,7 +92,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
8692
},
8793
{
8894
name: t('workflows'),
89-
id: '4',
95+
id: 'workflows',
9096
isSelected: router.pathname.startsWith(PATH_WORKFLOWS),
9197
href: PATH_WORKFLOWS,
9298
renderItem: () => (
@@ -100,7 +106,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
100106
{
101107
name: t('tasks'),
102108
isSelected: router.pathname.startsWith(PATH_TASKS),
103-
id: '5',
109+
id: 'tasks',
104110
href: PATH_TASKS,
105111
renderItem: () => (
106112
<WfoMenuItemLink
@@ -112,7 +118,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
112118
},
113119
{
114120
name: t('metadata'),
115-
id: '6',
121+
id: 'metadata',
116122
href: PATH_METADATA,
117123
isSelected:
118124
router.pathname.substring(0, PATH_METADATA.length) ===
@@ -121,17 +127,18 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
121127
<WfoMenuItemLink
122128
path={PATH_METADATA_PRODUCTS}
123129
translationString="metadata"
124-
isSelected={
125-
router.pathname.substring(0, PATH_METADATA.length) ===
126-
PATH_METADATA
127-
}
130+
isSelected={true}
131+
// isSelected={
132+
// router.pathname.substring(0, PATH_METADATA.length) ===
133+
// PATH_METADATA
134+
// }
128135
hasSubItems={true}
129136
/>
130137
),
131138
items: [
132139
{
133140
name: t('metadataProducts'),
134-
id: '6.1',
141+
id: 'metadata-products',
135142
href: PATH_METADATA_PRODUCTS,
136143
renderItem: () => (
137144
<WfoMenuItemLink
@@ -146,7 +153,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
146153
},
147154
{
148155
name: t('metadataProductblocks'),
149-
id: '6.2',
156+
id: 'metadata-productblocks',
150157
isSelected:
151158
router.pathname === PATH_METADATA_PRODUCT_BLOCKS,
152159
href: PATH_METADATA_PRODUCT_BLOCKS,
@@ -163,7 +170,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
163170
},
164171
{
165172
name: t('metadataResourceTypes'),
166-
id: '6.3',
173+
id: 'metadata-resourceTypes',
167174
href: PATH_METADATA_RESOURCE_TYPES,
168175
isSelected:
169176
router.pathname === PATH_METADATA_RESOURCE_TYPES,
@@ -180,7 +187,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
180187
},
181188
{
182189
name: t('metadataWorkflows'),
183-
id: '6.4',
190+
id: 'metadata-workflows',
184191
isSelected: router.pathname === PATH_METADATA_WORKFLOWS,
185192
href: PATH_METADATA_WORKFLOWS,
186193
renderItem: () => (
@@ -196,7 +203,7 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
196203
},
197204
{
198205
name: t('metadataTasks'),
199-
id: '6.5',
206+
id: 'metadata-tasks',
200207
isSelected: router.pathname === PATH_METADATA_TASKS,
201208
href: PATH_METADATA_TASKS,
202209
renderItem: () => (
@@ -212,8 +219,8 @@ export const WfoSidebar: FC<WfoSidebarProps> = ({ overrideMenuItems }) => {
212219
},
213220
{
214221
name: t('settings'),
222+
id: 'settings',
215223
isSelected: router.pathname === PATH_SETTINGS,
216-
id: '7',
217224
href: PATH_SETTINGS,
218225
renderItem: () => (
219226
<WfoMenuItemLink

0 commit comments

Comments
 (0)