16
16
17
17
import { generatePath , NavLink , useParams , useRouteMatch } from 'react-router-dom'
18
18
19
- import { Icon , IconName , ModalSidebarPanel } from '@devtron-labs/devtron-fe-common-lib'
19
+ import { Icon , IconName , ModalSidebarPanel , SERVER_MODE , useMainContext } from '@devtron-labs/devtron-fe-common-lib'
20
20
21
21
import { importComponentFromFELibrary } from '@Components/common'
22
22
import { DOCUMENTATION } from '@Config/constants'
@@ -28,47 +28,53 @@ const isFELibAvailable = importComponentFromFELibrary('isFELibAvailable', null,
28
28
29
29
const Sidebar = ( ) => {
30
30
const { path } = useRouteMatch ( )
31
+ const { serverMode } = useMainContext ( )
31
32
const { type } = useParams < CreateClusterParams > ( )
32
33
33
34
const selectedSidebarElement = SIDEBAR_CONFIG [ type ]
34
35
35
36
return (
36
37
< div className = "w-250 p-20 flexbox-col dc__gap-24 dc__no-shrink dc__overflow-auto" >
37
38
< div className = "flexbox-col" >
38
- { Object . entries ( SIDEBAR_CONFIG ) . map ( ( [ key , { title, iconName, isEnterprise, dataTestId } ] ) => {
39
- const isSelected = type . toLowerCase ( ) === key . toLowerCase ( )
39
+ { Object . entries ( SIDEBAR_CONFIG ) . map (
40
+ ( [ key , { title, iconName, isEnterprise, dataTestId, hideInEAMode } ] ) => {
41
+ if ( hideInEAMode && serverMode === SERVER_MODE . EA_ONLY ) {
42
+ return null
43
+ }
44
+ const isSelected = type . toLowerCase ( ) === key . toLowerCase ( )
40
45
41
- return (
42
- < NavLink
43
- data-testid = { dataTestId }
44
- key = { key }
45
- className = { `dc__transparent flex left dc__gap-8 py-6 px-8 br-4 ${ isSelected ? 'bcb-1' : 'dc__hover-n50' } ` }
46
- to = { generatePath ( path , { type : key } ) }
47
- >
48
- < span className = "dc__fill-available-space dc__no-shrink icon-dim-16" >
49
- < Icon name = { iconName as IconName } color = { isSelected ? 'B500' : 'N600' } />
50
- </ span >
51
-
52
- < span
53
- className = { `fs-13 lh-20 dc__truncate flex-grow-1 ${ isSelected ? 'cb-5 fw-6' : 'cn-9' } ` }
46
+ return (
47
+ < NavLink
48
+ data-testid = { dataTestId }
49
+ key = { key }
50
+ className = { `dc__transparent flex left dc__gap-8 py-6 px-8 br-4 ${ isSelected ? 'bcb-1' : 'dc__hover-n50' } ` }
51
+ to = { generatePath ( path , { type : key } ) }
54
52
>
55
- { title }
56
- </ span >
53
+ < span className = "dc__fill-available-space dc__no-shrink icon-dim-16" >
54
+ < Icon name = { iconName as IconName } color = { isSelected ? 'B500' : 'N600' } />
55
+ </ span >
56
+
57
+ < span
58
+ className = { `fs-13 lh-20 dc__truncate flex-grow-1 ${ isSelected ? 'cb-5 fw-6' : 'cn-9' } ` }
59
+ >
60
+ { title }
61
+ </ span >
57
62
58
- { isEnterprise && ! isFELibAvailable && (
59
- < Icon
60
- name = "ic-enterprise-feat"
61
- color = "Y700"
62
- tooltipProps = { {
63
- content : 'This is an enterprise only feature' ,
64
- placement : 'right' ,
65
- alwaysShowTippyOnHover : true ,
66
- } }
67
- />
68
- ) }
69
- </ NavLink >
70
- )
71
- } ) }
63
+ { isEnterprise && ! isFELibAvailable && (
64
+ < Icon
65
+ name = "ic-enterprise-feat"
66
+ color = "Y700"
67
+ tooltipProps = { {
68
+ content : 'This is an enterprise only feature' ,
69
+ placement : 'right' ,
70
+ alwaysShowTippyOnHover : true ,
71
+ } }
72
+ />
73
+ ) }
74
+ </ NavLink >
75
+ )
76
+ } ,
77
+ ) }
72
78
</ div >
73
79
74
80
< div className = "divider__secondary--horizontal" />
0 commit comments