Skip to content

Commit 34fb876

Browse files
authored
Merge pull request #2732 from devtron-labs/feat/v-cluster-full
feat: hide virtual cluster in EA Mode
2 parents 3545372 + 0410640 commit 34fb876

File tree

4 files changed

+43
-35
lines changed

4 files changed

+43
-35
lines changed

src/Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/Sidebar.tsx

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { generatePath, NavLink, useParams, useRouteMatch } from 'react-router-dom'
1818

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'
2020

2121
import { importComponentFromFELibrary } from '@Components/common'
2222
import { DOCUMENTATION } from '@Config/constants'
@@ -28,47 +28,53 @@ const isFELibAvailable = importComponentFromFELibrary('isFELibAvailable', null,
2828

2929
const Sidebar = () => {
3030
const { path } = useRouteMatch()
31+
const { serverMode } = useMainContext()
3132
const { type } = useParams<CreateClusterParams>()
3233

3334
const selectedSidebarElement = SIDEBAR_CONFIG[type]
3435

3536
return (
3637
<div className="w-250 p-20 flexbox-col dc__gap-24 dc__no-shrink dc__overflow-auto">
3738
<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()
4045

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 })}
5452
>
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>
5762

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+
)}
7278
</div>
7379

7480
<div className="divider__secondary--horizontal" />

src/Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/constants.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,6 @@ export const SIDEBAR_CONFIG: SidebarConfigType = {
4444
</>
4545
),
4646
isEnterprise: true,
47+
hideInEAMode: true,
4748
},
4849
} as const

src/Pages/GlobalConfigurations/ClustersAndEnvironments/CreateCluster/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { IconName } from '@devtron-labs/devtron-fe-common-lib/dist'
1+
import { IconName } from '@devtron-labs/devtron-fe-common-lib'
22

33
export enum CreateClusterTypeEnum {
44
CONNECT_CLUSTER = 'connect-cluster',
@@ -15,6 +15,7 @@ export type SidebarConfigType = Record<
1515
dataTestId: string
1616
documentationHeader?: string
1717
isEnterprise?: true
18+
hideInEAMode?: true
1819
}
1920
>
2021

src/components/v2/values/chartValuesDiff/ChartValuesView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ const ChartValuesView = ({
160160
presetValueId: string
161161
envId: string
162162
}>()
163-
const { serverMode, isManifestScanningEnabled } = useMainContext()
163+
const { serverMode } = useMainContext()
164164
const { handleDownload } = useDownload()
165165
const chartValuesAbortRef = useRef<AbortController>(new AbortController())
166166
const [chartValuesList, setChartValuesList] = useState<ChartValuesType[]>(chartValuesListFromParent || [])
@@ -1810,7 +1810,7 @@ const ChartValuesView = ({
18101810
)}
18111811
</div>
18121812
{!isExternalApp &&
1813-
isManifestScanningEnabled &&
1813+
serverMode === SERVER_MODE.FULL &&
18141814
(isDeployChartView || isUpdateAppView) &&
18151815
ToggleSecurityScan && (
18161816
<ToggleSecurityScan

0 commit comments

Comments
 (0)