Skip to content

Commit 5d3e2f7

Browse files
authored
Merge pull request #2616 from devtron-labs/fix/stack-manager-icon
fix: render null icon
2 parents 1629751 + 3b5ab22 commit 5d3e2f7

File tree

6 files changed

+30
-32
lines changed

6 files changed

+30
-32
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.10.0-patch-4",
7+
"@devtron-labs/devtron-fe-common-lib": "1.10.0-patch-5",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/components/common/navigation/NavigationRoutes.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import { DEFAULT_GIT_OPS_FEATURE_FLAGS } from './constants'
8181
import { ParsedTabsData, ParsedTabsDataV1 } from '../DynamicTabs/types'
8282
import { SwitchThemeDialog } from '@Pages/Shared'
8383
import { SwitchThemeDialogProps } from '@Pages/Shared/SwitchThemeDialog/types'
84-
import { getShowStackManager } from 'src/utils'
84+
import { EnvironmentDataStateType } from './types'
8585

8686
// Monaco Editor worker initialization
8787
self.MonacoEnvironment = {
@@ -152,16 +152,12 @@ export default function NavigationRoutes() {
152152
}
153153
const [environmentId, setEnvironmentId] = useState(null)
154154
const contextValue = useMemo(() => ({ environmentId, setEnvironmentId }), [environmentId])
155-
const [environmentDataState, setEnvironmentDataState] = useState<
156-
Pick<
157-
MainContext,
158-
'isAirgapped' | 'isManifestScanningEnabled' | 'canOnlyViewPermittedEnvOrgLevel' | 'featureGitOpsFlags'
159-
>
160-
>({
155+
const [environmentDataState, setEnvironmentDataState] = useState<EnvironmentDataStateType>({
161156
isAirgapped: false,
162157
isManifestScanningEnabled: false,
163158
canOnlyViewPermittedEnvOrgLevel: false,
164159
featureGitOpsFlags: structuredClone(DEFAULT_GIT_OPS_FEATURE_FLAGS),
160+
devtronManagedLicensingEnabled: false,
165161
})
166162
const [userPreferences, setUserPreferences] = useState<UserPreferencesType>(null)
167163
const [userPreferencesError, setUserPreferencesError] = useState<ServerErrors>(null)
@@ -173,7 +169,8 @@ export default function NavigationRoutes() {
173169
appTheme,
174170
} = useTheme()
175171

176-
const { isAirgapped, isManifestScanningEnabled, canOnlyViewPermittedEnvOrgLevel } = environmentDataState
172+
const { isAirgapped, isManifestScanningEnabled, canOnlyViewPermittedEnvOrgLevel, devtronManagedLicensingEnabled } =
173+
environmentDataState
177174

178175
const handleCloseLicenseInfoDialog = () => {
179176
setLicenseInfoDialogType(null)
@@ -342,6 +339,7 @@ export default function NavigationRoutes() {
342339
isManifestScanningEnabled: false,
343340
canOnlyViewPermittedEnvOrgLevel: false,
344341
featureGitOpsFlags: structuredClone(DEFAULT_GIT_OPS_FEATURE_FLAGS),
342+
devtronManagedLicensingEnabled: false,
345343
}
346344

347345
if (!getEnvironmentData) {
@@ -361,6 +359,7 @@ export default function NavigationRoutes() {
361359
isManifestScanningEnabled: result.isManifestScanningEnabled,
362360
canOnlyViewPermittedEnvOrgLevel: result.canOnlyViewPermittedEnvOrgLevel,
363361
featureGitOpsFlags: parsedFeatureGitOpsFlags,
362+
devtronManagedLicensingEnabled: result.devtronManagedLicensingEnabled || false,
364363
}
365364
} catch {
366365
return fallbackResponse
@@ -408,6 +407,7 @@ export default function NavigationRoutes() {
408407
isManifestScanningEnabled: environmentDataResponse.isManifestScanningEnabled,
409408
canOnlyViewPermittedEnvOrgLevel: environmentDataResponse.canOnlyViewPermittedEnvOrgLevel,
410409
featureGitOpsFlags: environmentDataResponse.featureGitOpsFlags,
410+
devtronManagedLicensingEnabled: environmentDataResponse.devtronManagedLicensingEnabled,
411411
})
412412

413413
setServerMode(serverModeResponse)
@@ -484,11 +484,13 @@ export default function NavigationRoutes() {
484484
}
485485
const _isOnboardingPage = isOnboardingPage()
486486

487-
const handleOpenLicenseInfoDialog = (initialDialogTab?: LicenseInfoDialogType.ABOUT | LicenseInfoDialogType.LICENSE) => {
487+
const handleOpenLicenseInfoDialog = (
488+
initialDialogTab?: LicenseInfoDialogType.ABOUT | LicenseInfoDialogType.LICENSE,
489+
) => {
488490
setLicenseInfoDialogType(initialDialogTab || LicenseInfoDialogType.ABOUT)
489491
}
490492

491-
const showStackManager = getShowStackManager(currentServerInfo.serverInfo?.installationType, !!licenseData)
493+
const showStackManager = !devtronManagedLicensingEnabled
492494

493495
return (
494496
<MainContextProvider

src/components/common/navigation/types.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
*/
1616

1717
import { URLS } from '@Config/routes'
18-
import { customEnv, IconsProps, URLS as CommonURLS } from '@devtron-labs/devtron-fe-common-lib'
18+
import {
19+
customEnv,
20+
IconsProps,
21+
URLS as CommonURLS,
22+
EnvironmentDataValuesDTO,
23+
} from '@devtron-labs/devtron-fe-common-lib'
1924

2025
export interface NavigationListItemType {
2126
title: string
@@ -32,3 +37,7 @@ export interface NavigationListItemType {
3237
moduleName?: string
3338
moduleNameTrivy?: string
3439
}
40+
41+
export interface EnvironmentDataStateType extends Omit<EnvironmentDataValuesDTO, 'isAirGapEnvironment'> {
42+
isAirgapped: boolean
43+
}

src/components/v2/devtronStackManager/DevtronStackManager.component.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ import clair from '../../../assets/icons/ic-trivy-to-clair.svg'
8181
import warn from '../../../assets/icons/ic-error-medium.svg'
8282
import { SuccessModalComponent } from './SuccessModalComponent'
8383
import { EMPTY_STATE_STATUS } from '../../../config/constantMessaging'
84-
import { getShowStackManager } from 'src/utils'
8584

8685
const getInstallationStatusLabel = (
8786
installationStatus: ModuleStatus,
@@ -254,8 +253,6 @@ export const NavItem = ({
254253
showInitializing,
255254
showVersionInfo,
256255
}: StackManagerNavItemType): JSX.Element => {
257-
const { currentServerInfo, licenseData } = useMainContext()
258-
259256
const getNavLink = (route: StackManagerNavLinkType): JSX.Element => {
260257
return (
261258
<NavLink
@@ -304,18 +301,12 @@ export const NavItem = ({
304301
)
305302
}
306303

307-
const showAboutDevtronTab = getShowStackManager(currentServerInfo?.serverInfo?.installationType, !!licenseData)
308-
309304
return (
310305
<div className="flex column left">
311306
<div className="section-heading cn-6 fs-12 fw-6 pl-8 mb-8 dc__uppercase">Integrations</div>
312307
{ModulesSection.map((route) => getNavLink(route))}
313-
{showAboutDevtronTab && (
314-
<>
315-
<hr className="mt-8 mb-8 w-100 checklist__divider" />
316-
{getNavLink(AboutSection)}
317-
</>
318-
)}
308+
<hr className="mt-8 mb-8 w-100 checklist__divider" />
309+
{getNavLink(AboutSection)}
319310
</div>
320311
)
321312
}
@@ -917,7 +908,7 @@ export const InstallationWrapper = ({
917908
}}
918909
showTooltip={isInstallButtonDisabled}
919910
text={text}
920-
startIcon={<Icon />}
911+
startIcon={Icon ? <Icon /> : null}
921912
fullWidth
922913
/>
923914
)}

src/utils.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
DATE_TIME_FORMATS,
66
getCentralAPIHealthObjectFromLocalStorage,
77
} from '@devtron-labs/devtron-fe-common-lib'
8-
import { InstallationType } from '@Components/v2/devtronStackManager/DevtronStackManager.type'
98
import { Routes } from '@Config/constants'
109

1110
const setCentralAPIHealthInLocalStorage = (health: boolean, existingHealthObj: CentralAPILocalConfig) => {
@@ -48,6 +47,3 @@ export const getCentralAPIHealth = async (): Promise<void> => {
4847
setCentralAPIHealthInLocalStorage(false, existingHealthObj)
4948
}
5049
}
51-
52-
export const getShowStackManager = (installationType: InstallationType, showLicenseData: boolean) =>
53-
installationType === InstallationType.ENTERPRISE ? showLicenseData : true

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,10 @@
11261126
dependencies:
11271127
"@jridgewell/trace-mapping" "0.3.9"
11281128

1129-
"@devtron-labs/[email protected]4":
1130-
version "1.10.0-patch-4"
1131-
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.10.0-patch-4.tgz#347759b5e0477527e44cf066ef8a9bc2689ca39b"
1132-
integrity sha512-bCO7G/IyXKFi4CIJmUe6kmUKjzAM/AJlOWoItf6pJV3tiPGWURFpD9nYMSWTsUJYFu1op4plFdle42f9zIi0kA==
1129+
"@devtron-labs/[email protected]5":
1130+
version "1.10.0-patch-5"
1131+
resolved "https://registry.yarnpkg.com/@devtron-labs/devtron-fe-common-lib/-/devtron-fe-common-lib-1.10.0-patch-5.tgz#26a13c55a38357968b6a21db1c5d940ca271f97c"
1132+
integrity sha512-zZJzMxn7VpuMl/HLZ5ZEpG4BTo1Mi666saZLVRiaaFtclTQDnEDzm6WgWSg/7dvOVM8UPEWoJjT8mBb+q9SZhA==
11331133
dependencies:
11341134
"@codemirror/lang-json" "6.0.1"
11351135
"@codemirror/lang-yaml" "6.1.2"

0 commit comments

Comments
 (0)