Skip to content

Commit 3a34e91

Browse files
committed
Merge branch 'kubecon-2025' of https://github.com/devtron-labs/devtron-fe-common-lib into feat/infra-overview
2 parents 6b0f1a6 + 005bb21 commit 3a34e91

22 files changed

Lines changed: 163 additions & 60 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.20.3-beta-3",
3+
"version": "1.20.5-beta-1",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/API/CoreAPI.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ class CoreAPI {
240240
preventLicenseRedirect: options?.preventLicenseRedirect || false,
241241
shouldParseServerErrorForUnauthorizedUser: options?.shouldParseServerErrorForUnauthorizedUser,
242242
isMultipartRequest,
243+
isProxyHost: options?.isProxyHost || false,
243244
}),
244245
timeoutPromise,
245246
]).catch((err) => {

src/Common/API/types.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@ export interface FetchInTimeParamsType<Data = object> {
3939

4040
export interface FetchAPIParamsType<Data = object>
4141
extends Omit<FetchInTimeParamsType<Data>, 'options'>,
42-
Pick<APIOptions, 'preventAutoLogout' | 'preventLicenseRedirect' | 'shouldParseServerErrorForUnauthorizedUser'> {
43-
/**
44-
* @default false
45-
* @description - If true, will override the default host (orchestrator or whatever defined initially in CoreAPI constructor) with the `proxy` host
46-
*/
47-
isProxyHost?: boolean
42+
Pick<
43+
APIOptions,
44+
'preventAutoLogout' | 'preventLicenseRedirect' | 'shouldParseServerErrorForUnauthorizedUser' | 'isProxyHost'
45+
> {
4846
signal: AbortSignal
4947
}

src/Common/BreadCrumb/BreadCrumb.tsx

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

1717
import React, { useMemo, useEffect } from 'react'
1818
import { Link, useRouteMatch, useParams } from 'react-router-dom'
19-
import { useBreadcrumbContext } from './BreadcrumbStore'
19+
import { useBreadcrumbContext, getBreadCrumbSeparator } from './BreadcrumbStore'
2020
import { ConditionalWrap } from '../Helper'
2121
import { Breadcrumb, Breadcrumbs, UseBreadcrumbOptionalProps, UseBreadcrumbState } from './Types'
2222

@@ -115,7 +115,7 @@ export const BreadCrumb: React.FC<Breadcrumbs> = ({
115115
</ConditionalWrap>
116116

117117
{idx + 1 !== filteredCrumbs.length && breadcrumb.name && (
118-
<span className="dc__devtron-breadcrumb__item__separator">{sep}</span>
118+
getBreadCrumbSeparator(sep)
119119
)}
120120
</React.Fragment>
121121
))}

src/Common/BreadCrumb/BreadcrumbStore.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export const BreadcrumbText = ({ heading, isActive, shouldTruncate = false }: Br
2525
<span className={`dc__breadcrumb-text cb-5 fs-16 lh-1-5 ${shouldTruncate ? 'dc__truncate' : ''} ${isActive ? 'cn-9 fw-6' : 'cb-5 fw-4 dc__mxw-155 dc__ellipsis-right'}`}>{heading}</span>
2626
)
2727

28+
export const getBreadCrumbSeparator = (sep: string = '/') => (
29+
<span className="dc__devtron-breadcrumb__item__separator">{sep}</span>
30+
)
31+
2832
const Store = ({ children }) => {
2933
const [state, setState] = useState(initialState)
3034
return <BreadcrumbContext.Provider value={{ state, setState }}>{children}</BreadcrumbContext.Provider>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react'
2+
import { Link } from 'react-router-dom'
3+
4+
import { BreadcrumbText, getBreadCrumbSeparator } from './BreadcrumbStore'
5+
import { NestedBreadCrumbProps } from './Types'
6+
7+
export const NestedBreadCrumb = ({ redirectUrl, linkText, profileName }: NestedBreadCrumbProps) => {
8+
const breadcrumbLinkClass = 'active dc__devtron-breadcrumb__item fs-16 fw-4 lh-1-5 dc__ellipsis-right dc__mxw-155'
9+
10+
const breadcrumbs = [
11+
{ type: 'link', label: linkText, to: redirectUrl },
12+
...(profileName
13+
? [
14+
{ type: 'link', label: 'Profiles', to: redirectUrl },
15+
{
16+
type: 'text',
17+
label: profileName,
18+
},
19+
]
20+
: [
21+
{
22+
type: 'text',
23+
label: 'Create Profile',
24+
},
25+
]),
26+
]
27+
28+
return (
29+
<div className="flex left flex-grow-1 dc__gap-4">
30+
{breadcrumbs.map((crumb, index) => (
31+
<React.Fragment key={crumb.label}>
32+
{crumb.type === 'link' ? (
33+
<Link to={crumb.to!} className={breadcrumbLinkClass}>
34+
{crumb.label}
35+
</Link>
36+
) : (
37+
<BreadcrumbText heading={crumb.label} isActive />
38+
)}
39+
{index < breadcrumbs.length - 1 && getBreadCrumbSeparator()}
40+
</React.Fragment>
41+
))}
42+
</div>
43+
)
44+
}

src/Common/BreadCrumb/Types.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,19 @@ export interface BreadcrumbTextProps {
5252
*/
5353
shouldTruncate?: boolean
5454
}
55+
56+
export interface NestedBreadCrumbProps {
57+
/**
58+
* It is the url to which the link should redirect
59+
*/
60+
redirectUrl: string
61+
/**
62+
* It is the text of the link
63+
*/
64+
linkText: string
65+
/**
66+
* It is the name of the profile
67+
* If not given, would show "Create Profile"
68+
*/
69+
profileName: string
70+
}

src/Common/Common.service.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -651,17 +651,6 @@ export const getDetailedClusterList = async (
651651
...res
652652
}) => {
653653
const costModuleInstallationStatus = costModuleConfig?.installationStatus || 'NotInstalled'
654-
// Need to remove following keys from config if present: openCostServiceName, openCostServicePort, releaseName, namespace
655-
const sanitizedCostConfig = costModuleConfig?.config
656-
? Object.fromEntries(
657-
Object.entries(costModuleConfig.config).filter(
658-
([key]) =>
659-
!['openCostServiceName', 'openCostServicePort', 'releaseName', 'namespace'].includes(
660-
key,
661-
),
662-
),
663-
)
664-
: undefined
665654

666655
return {
667656
...res,
@@ -678,7 +667,10 @@ export const getDetailedClusterList = async (
678667
status: clusterStatus,
679668
costModuleConfig: {
680669
enabled: costModuleConfig?.enabled || false,
681-
config: sanitizedCostConfig,
670+
config: {
671+
...(costModuleConfig?.config || {}),
672+
detectedProvider: costModuleConfig?.config?.detectedProvider,
673+
},
682674
installationStatus: costModuleInstallationStatus,
683675
...(costModuleInstallationStatus === 'Failed'
684676
? {

src/Common/Constants.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const SOFTWARE_RELEASE_MANAGEMENT_ROOT = '/software-release-management'
5757
const COST_VISIBILITY_ROOT = '/cost-visibility'
5858
const SECURITY_CENTER_ROOT = '/security-center'
5959
const AUTOMATION_AND_ENABLEMENT_ROOT = '/automation-and-enablement'
60-
const BACKUP_AND_RESTORE_ROOT = '/backup-and-restore'
60+
const DATA_PROTECTION_ROOT = '/data-protection-management'
6161
const GLOBAL_CONFIG_ROOT = '/global-configuration'
6262
const AI_RECOMMENDATIONS_ROOT = '/ai-recommendations'
6363

@@ -100,6 +100,7 @@ export const URLS = {
100100
APPLICATION_MANAGEMENT_CONFIGURATIONS_DEPLOYMENT_CHARTS: `${APPLICATION_MANAGEMENT_CONFIGURATIONS}/deployment-charts`,
101101
APPLICATION_MANAGEMENT_CONFIGURATIONS_SCOPED_VARIABLES: `${APPLICATION_MANAGEMENT_CONFIGURATIONS}/scoped-variables`,
102102
APPLICATION_MANAGEMENT_CONFIGURATIONS_BUILD_INFRA: `${APPLICATION_MANAGEMENT_CONFIGURATIONS}/build-infra`,
103+
APPLICATION_MANAGEMENT_CONFIGURATIONS_BUILD_INFRA_PROFILES: `${APPLICATION_MANAGEMENT_CONFIGURATIONS}/build-infra/profiles`,
103104
APPLICATION_MANAGEMENT_CONFIGURATIONS_NOTIFICATIONS: `${APPLICATION_MANAGEMENT_CONFIGURATIONS}/notifications`,
104105
// INFRASTRUCTURE MANAGEMENT
105106
INFRASTRUCTURE_MANAGEMENT: INFRASTRUCTURE_MANAGEMENT_ROOT,
@@ -123,9 +124,12 @@ export const URLS = {
123124
// AUTOMATION AND ENABLEMENT
124125
AUTOMATION_AND_ENABLEMENT: AUTOMATION_AND_ENABLEMENT_ROOT,
125126
AUTOMATION_AND_ENABLEMENT_JOB: `${AUTOMATION_AND_ENABLEMENT_ROOT}/job`,
126-
// BACKUP AND RESTORE
127-
BACKUP_AND_RESTORE: BACKUP_AND_RESTORE_ROOT,
128-
BACKUP_AND_RESTORE_OVERVIEW: `${BACKUP_AND_RESTORE_ROOT}/overview`,
127+
// DATA PROTECTION
128+
DATA_PROTECTION: DATA_PROTECTION_ROOT,
129+
DATA_PROTECTION_OVERVIEW: `${DATA_PROTECTION_ROOT}/overview`,
130+
DATA_PROTECTION_BACKUP_AND_SCHEDULE: `${DATA_PROTECTION_ROOT}/backup-and-schedule`,
131+
DATA_PROTECTION_RESTORES: `${DATA_PROTECTION_ROOT}/restores`,
132+
DATA_PROTECTION_BACKUP_LOCATIONS: `${DATA_PROTECTION_ROOT}/backup-locations`,
129133
// GLOBAL CONFIGURATION
130134
GLOBAL_CONFIG: GLOBAL_CONFIG_ROOT,
131135
GLOBAL_CONFIG_DOCKER: `${GLOBAL_CONFIG_ROOT}/docker`,
@@ -134,6 +138,7 @@ export const URLS = {
134138
// AI RECOMMENDATIONS
135139
AI_RECOMMENDATIONS: AI_RECOMMENDATIONS_ROOT,
136140
AI_RECOMMENDATIONS_OVERVIEW: `${AI_RECOMMENDATIONS_ROOT}/overview`,
141+
EXTERNAL_APPS: 'ea',
137142
} as const
138143

139144
export const ROUTES = {

0 commit comments

Comments
 (0)