Skip to content

Commit aeb3b01

Browse files
committed
Merge branch 'develop' into feat/chart-card-ui
2 parents 909b728 + e861a21 commit aeb3b01

6 files changed

Lines changed: 67 additions & 30 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "1.15.0-pre-1",
3+
"version": "1.15.0-pre-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/DocLink/DocLink.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,25 @@ export const DocLink = <T extends boolean = false>({
2323
fullWidth = false,
2424
}: DocLinkProps<T>) => {
2525
// HOOKS
26-
const { isEnterprise, setSidePanelConfig } = useMainContext()
26+
const { isEnterprise, setSidePanelConfig, isLicenseDashboard } = useMainContext()
2727

2828
// CONSTANTS
2929
const documentationLink = getDocumentationUrl({
3030
docLinkKey,
3131
isEnterprise,
3232
isExternalLink,
33+
isLicenseDashboard,
3334
})
3435

3536
// HANDLERS
3637
const handleClick = (e: MouseEvent<HTMLAnchorElement>) => {
37-
if (!isExternalLink && !openInNewTab && !e.metaKey && documentationLink.startsWith(DOCUMENTATION_HOME_PAGE)) {
38+
if (
39+
!isExternalLink &&
40+
!openInNewTab &&
41+
!e.metaKey &&
42+
!isLicenseDashboard &&
43+
documentationLink.startsWith(DOCUMENTATION_HOME_PAGE)
44+
) {
3845
e.preventDefault()
3946
setSidePanelConfig((prev) => ({ ...prev, open: true, docLink: documentationLink, reinitialize: true }))
4047
}

src/Shared/Components/DocLink/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { DOCUMENTATION } from './constants'
77
export type BaseDocLink<T extends boolean> = {
88
isExternalLink?: T
99
isEnterprise?: boolean
10+
isLicenseDashboard?: boolean
1011
docLinkKey: T extends true ? string : keyof typeof DOCUMENTATION
1112
}
1213

src/Shared/Components/DocLink/utils.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const getDocumentationUrl = <T extends boolean = false>({
77
docLinkKey,
88
isEnterprise = false,
99
isExternalLink,
10+
isLicenseDashboard = false,
1011
}: BaseDocLink<T>) => {
1112
if (isExternalLink) {
1213
return docLinkKey
@@ -18,5 +19,7 @@ export const getDocumentationUrl = <T extends boolean = false>({
1819
return docPath
1920
}
2021

21-
return `${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${docPath || ''}?utm-source=product_${isEnterprise ? 'ent' : 'oss'}`
22+
const utmPath = !isLicenseDashboard ? `?utm-source=product_${isEnterprise ? 'ent' : 'oss'}` : ''
23+
24+
return `${DOCUMENTATION_HOME_PAGE}${DOCUMENTATION_VERSION}/${docPath || ''}${utmPath}`
2225
}

src/Shared/Providers/types.ts

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,19 @@ export interface SidePanelConfig {
3939
docLink: string | null
4040
}
4141

42-
export interface MainContext {
43-
serverMode: SERVER_MODE
42+
type CommonMainContextProps = {
4443
setServerMode: (serverMode: SERVER_MODE) => void
4544
isHelpGettingStartedClicked: boolean
4645
showCloseButtonAfterGettingStartedClicked: () => void
47-
loginCount: number
4846
setLoginCount: (loginCount: number) => void
4947
showGettingStartedCard: boolean
5048
setShowGettingStartedCard: (showGettingStartedCard: boolean) => void
5149
isGettingStartedClicked: boolean
5250
setGettingStartedClicked: (isGettingStartedClicked: boolean) => void
5351
moduleInInstallingState: string
5452
setModuleInInstallingState: (moduleInInstallingState: string) => void
55-
installedModuleMap: MutableRefObject<Record<string, boolean>>
5653
currentServerInfo: {
57-
serverInfo: ServerInfo
54+
serverInfo: ServerInfo | null
5855
fetchingServerInfo: boolean
5956
}
6057
isAirgapped: boolean
@@ -79,31 +76,60 @@ export interface MainContext {
7976
handleOpenLicenseInfoDialog: (
8077
initialDialogType?: LicenseInfoDialogType.ABOUT | LicenseInfoDialogType.LICENSE,
8178
) => void
82-
/**
83-
* Data is set only if showLicenseData is received as true
84-
*/
85-
licenseData: DevtronLicenseInfo
8679
setLicenseData: Dispatch<SetStateAction<DevtronLicenseInfo>>
8780
canFetchHelmAppStatus: boolean
88-
reloadVersionConfig: ReloadVersionConfigTypes
89-
intelligenceConfig: IntelligenceConfig
9081
setIntelligenceConfig: Dispatch<SetStateAction<IntelligenceConfig>>
91-
92-
sidePanelConfig: SidePanelConfig
9382
setSidePanelConfig: Dispatch<SetStateAction<SidePanelConfig>>
94-
95-
/**
96-
* Indicates whether the current Devtron instance is running as an Enterprise edition. \
97-
* This flag is determined based on server-side configuration.
98-
*/
99-
isEnterprise: boolean
100-
/**
101-
* Indicates whether the fe-lib modules are available in the current instance. \
102-
* Used to conditionally render or enable features that depend on fe-lib
103-
*/
104-
isFELibAvailable: boolean
10583
}
10684

85+
export type MainContext = CommonMainContextProps &
86+
(
87+
| {
88+
isLicenseDashboard?: never
89+
serverMode: SERVER_MODE
90+
loginCount: number | null
91+
installedModuleMap: MutableRefObject<Record<string, boolean>>
92+
/**
93+
* Data is set only if showLicenseData is received as true
94+
*/
95+
licenseData: DevtronLicenseInfo
96+
97+
reloadVersionConfig: ReloadVersionConfigTypes
98+
intelligenceConfig: IntelligenceConfig
99+
100+
sidePanelConfig: SidePanelConfig
101+
102+
/**
103+
* Indicates whether the current Devtron instance is running as an Enterprise edition. \
104+
* This flag is determined based on server-side configuration.
105+
*/
106+
isEnterprise: boolean
107+
/**
108+
* Indicates whether the fe-lib modules are available in the current instance. \
109+
* Used to conditionally render or enable features that depend on fe-lib
110+
*/
111+
isFELibAvailable: boolean
112+
}
113+
| {
114+
isLicenseDashboard: true
115+
serverMode: null
116+
loginCount: null
117+
installedModuleMap: null
118+
/**
119+
* Data is set only if showLicenseData is received as true
120+
*/
121+
licenseData: null
122+
123+
reloadVersionConfig: null
124+
intelligenceConfig: null
125+
126+
sidePanelConfig: null
127+
128+
isEnterprise: false
129+
isFELibAvailable: false
130+
}
131+
)
132+
107133
export interface MainContextProviderProps {
108134
children: ReactNode
109135
value: MainContext

0 commit comments

Comments
 (0)