Skip to content

Commit 0af77b9

Browse files
committed
feat: add show license data key and update license dialog open handler
1 parent 96c7866 commit 0af77b9

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/Shared/Components/Header/HelpNav.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const HelpNav = ({
3636
setGettingStartedClicked,
3737
showHelpCard,
3838
}: HelpNavType) => {
39-
const { currentServerInfo, handleOpenLicenseInfoDialog } = useMainContext()
39+
const { currentServerInfo, handleOpenLicenseInfoDialog, showLicenseData } = useMainContext()
4040
const isEnterprise = currentServerInfo?.serverInfo?.installationType === InstallationType.ENTERPRISE
4141
const FEEDBACK_FORM_ID = `UheGN3KJ#source=${window.location.hostname}`
4242

@@ -89,6 +89,10 @@ const HelpNav = ({
8989
onClickHelpOptions(option)
9090
}
9191

92+
const handleOpenLicenseDialog = () => {
93+
handleOpenLicenseInfoDialog()
94+
}
95+
9296
const renderHelpOptions = (): JSX.Element => (
9397
<>
9498
{CommonHelpOptions.map((option, index) => (
@@ -105,12 +109,12 @@ const HelpNav = ({
105109
<option.icon />
106110
<div className="ml-12 cn-9 fs-14">{option.name}</div>
107111
</a>
108-
{isEnterprise && index === 1 && (
112+
{isEnterprise && showLicenseData && index === 1 && (
109113
<>
110114
<button
111115
type="button"
112116
className="dc__transparent help-card__option flexbox dc__align-items-center cn-9 dc__gap-12 fs-14"
113-
onClick={handleOpenLicenseInfoDialog}
117+
onClick={handleOpenLicenseDialog}
114118
>
115119
<Icon name="ic-devtron" color="N600" size={20} />
116120
About Devtron

src/Shared/Providers/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { MutableRefObject, ReactNode } from 'react'
1818
import { ServerInfo } from '../Components/Header/types'
1919
import { SERVER_MODE } from '../../Common'
20+
import { LicenseInfoDialogType } from '..'
2021

2122
export interface MainContext {
2223
serverMode: SERVER_MODE
@@ -55,7 +56,11 @@ export interface MainContext {
5556
isManifestScanningEnabled: boolean
5657
canOnlyViewPermittedEnvOrgLevel: boolean
5758
viewIsPipelineRBACConfiguredNode: ReactNode
58-
handleOpenLicenseInfoDialog: () => void
59+
handleOpenLicenseInfoDialog: (
60+
initialDialogType?: LicenseInfoDialogType.ABOUT | LicenseInfoDialogType.LICENSE,
61+
) => void
62+
showLicenseData: boolean
63+
setShowLicenseData: (showLicenseData: boolean) => void
5964
}
6065

6166
export interface MainContextProviderProps {

src/Shared/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,12 @@ export interface AppEnvIdType {
10321032
envId: number
10331033
}
10341034

1035+
export enum LicenseInfoDialogType {
1036+
ABOUT = 'about',
1037+
LICENSE = 'license',
1038+
UPDATE = 'update',
1039+
}
1040+
10351041
export enum LicensingErrorCodes {
10361042
FingerPrintMisMatch = '11001',
10371043
LicenseExpired = '11002',

0 commit comments

Comments
 (0)