Skip to content

Commit c1dce2d

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/dashboard into fix/trigger-view
2 parents 150de2e + 7e55bb9 commit c1dce2d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1090
-913
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.test.tsx
55
.eslintrc.js
66
vite.config.mts
7+
scripts/
78

89
# The following files have eslint errors/warnings
910
src/Pages/GlobalConfigurations/Authorization/APITokens/__tests__/ApiTokens.test.tsx
@@ -126,7 +127,6 @@ src/components/app/list/appList.modal.ts
126127
src/components/app/list/emptyView/Empty.tsx
127128
src/components/app/list/expandedRow/ExpandedRow.tsx
128129
src/components/app/service.ts
129-
src/components/bulkEdits/BulkEdits.tsx
130130
src/components/bulkEdits/bulkedit.utils.tsx
131131
src/components/cdPipeline/BuildCD.tsx
132132
src/components/cdPipeline/CDPipeline.tsx

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,6 @@ yalc.lock
5252
!.yarn/sdks
5353
!.yarn/versions
5454
.pnp.*
55+
56+
.env.secrets
57+
scripts/

package.json

Lines changed: 2 additions & 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.18.0-beta-0",
7+
"@devtron-labs/devtron-fe-common-lib": "1.18.1-pre-6",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",
@@ -49,6 +49,7 @@
4949
"lint": "tsc --noEmit && eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
5050
"lint-fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
5151
"start": "vite --open",
52+
"dev": "node scripts/secrets-mgr.js",
5253
"build": "NODE_OPTIONS=--max_old_space_size=8192 vite build",
5354
"serve": "vite preview",
5455
"build-light": "NODE_OPTIONS=--max_old_space_size=8192 GENERATE_SOURCEMAP=false vite build",

src/Pages/ChartStore/ChartDetails/ChartDetailsAbout.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,18 @@ export const ChartDetailsAbout = ({ chartDetails, isLoading }: ChartDetailsAbout
118118
return (
119119
<div className="flexbox-col dc__gap-20 mw-none">
120120
<div className="flexbox-col dc__gap-12">
121-
<ImageWithFallback
122-
imageProps={{
123-
src: icon,
124-
alt: 'chart-icon',
125-
className: 'br-6',
126-
height: 48,
127-
width: 48,
128-
}}
129-
fallbackImage={<Icon name="ic-helm" color="N700" size={48} />}
130-
/>
121+
<div className="h-48 dc__mxw-200">
122+
<ImageWithFallback
123+
imageProps={{
124+
src: icon,
125+
alt: 'chart-icon',
126+
className: 'br-6',
127+
height: '100%',
128+
width: 'auto',
129+
}}
130+
fallbackImage={<Icon name="ic-helm" color="N700" size={48} />}
131+
/>
132+
</div>
131133
<h2 className="m-0 fs-16 lh-24 fw-6 cn-9">{name}</h2>
132134
<p className="m-0 fs-13 lh-20 cn-9">{description}</p>
133135
</div>

src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/ClusterEnvironmentDrawer.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,6 @@ export const ClusterEnvironmentDrawer = ({
105105
error: ServerErrors
106106
}>(INITIAL_NAMESPACES)
107107

108-
// Need different state since validations change on basis of this state
109-
const [isSelectedClusterVirtual, setIsSelectedClusterVirtual] = useState(isVirtualCluster ?? false)
110-
111108
const [clusterListLoading, clusterListResult, clusterListError, reloadClusterList] = useAsync(
112109
() => getClusterListing(true),
113110
[],
@@ -123,8 +120,9 @@ export const ClusterEnvironmentDrawer = ({
123120
isProduction: !!isProduction,
124121
category: category ?? null,
125122
description: description ?? '',
123+
isVirtualCluster,
126124
},
127-
validations: clusterEnvironmentDrawerFormValidationSchema({ isNamespaceMandatory: !isSelectedClusterVirtual }),
125+
validations: clusterEnvironmentDrawerFormValidationSchema(),
128126
})
129127

130128
const [, clusterDetails] = useAsync(
@@ -135,10 +133,10 @@ export const ClusterEnvironmentDrawer = ({
135133

136134
useEffect(() => {
137135
if (clusterDetails) {
138-
setIsSelectedClusterVirtual(clusterDetails[0].isVirtualCluster)
139136
setClusterNamespaces(INITIAL_NAMESPACES)
140137
setNamespaceLabels(INITIAL_NAMESPACE_LABELS)
141-
reset(data, { keepErrors: false })
138+
const updatedData = { ...data, isVirtualCluster: clusterDetails[0]?.isVirtualCluster ?? false }
139+
reset(updatedData, { keepErrors: false })
142140
}
143141
}, [clusterDetails])
144142

@@ -209,11 +207,10 @@ export const ClusterEnvironmentDrawer = ({
209207
envId,
210208
namespaceLabels: namespaceLabels.labels,
211209
resourceVersion: namespaceLabels.resourceVersion,
212-
isVirtualCluster: isSelectedClusterVirtual,
213210
})
214211

215212
let api
216-
if (isSelectedClusterVirtual) {
213+
if (data.isVirtualCluster) {
217214
api = getVirtualClusterSaveUpdate(envId)
218215
} else {
219216
api = envId ? updateEnvironment : saveEnvironment
@@ -284,7 +281,6 @@ export const ClusterEnvironmentDrawer = ({
284281
const onDelete = async () => {
285282
const payload = getClusterEnvironmentUpdatePayload({
286283
data,
287-
isVirtualCluster: isSelectedClusterVirtual,
288284
envId,
289285
})
290286
await deleteEnvironment(payload)
@@ -369,7 +365,7 @@ export const ClusterEnvironmentDrawer = ({
369365
{...register('namespace')}
370366
label="Namespace"
371367
shouldTrim={false}
372-
required={!isSelectedClusterVirtual}
368+
required
373369
/>
374370

375371
<CustomInput
@@ -423,7 +419,7 @@ export const ClusterEnvironmentDrawer = ({
423419
</div>
424420
)}
425421

426-
{EnvironmentLabels && !isSelectedClusterVirtual && (
422+
{EnvironmentLabels && !data.isVirtualCluster && (
427423
<div className="dc__border-top-n1 pt-16">
428424
<EnvironmentLabels
429425
tags={namespaceLabels.labels}

src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/schema.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ import { UseFormValidations } from '@devtron-labs/devtron-fe-common-lib'
1818

1919
import { EnvironmentFormType } from './types'
2020

21-
export const clusterEnvironmentDrawerFormValidationSchema = ({
22-
isNamespaceMandatory,
23-
}: {
24-
isNamespaceMandatory: boolean
25-
}): UseFormValidations<EnvironmentFormType> => ({
21+
export const clusterEnvironmentDrawerFormValidationSchema = (): UseFormValidations<EnvironmentFormType> => ({
2622
clusterId: {
2723
required: true,
2824
pattern: [{ message: 'Please select a cluster', value: /^(?!0$)\d+$/ }],
@@ -36,19 +32,15 @@ export const clusterEnvironmentDrawerFormValidationSchema = ({
3632
{ message: 'Minimum 1 and Maximum 16 characters required', value: /^.{1,16}$/ },
3733
],
3834
},
39-
...(isNamespaceMandatory
40-
? {
41-
namespace: {
42-
required: true,
43-
pattern: [
44-
{ message: 'Namespace is required', value: /^.*$/ },
45-
{ message: "Use only lowercase alphanumeric characters or '-'", value: /^[a-z0-9-]+$/ },
46-
{ message: "Cannot start/end with '-'", value: /^(?![-]).*[^-]$/ },
47-
{ message: 'Maximum 63 characters required', value: /^.{1,63}$/ },
48-
],
49-
},
50-
}
51-
: {}),
35+
namespace: {
36+
required: true,
37+
pattern: [
38+
{ message: 'Namespace is required', value: /^.*$/ },
39+
{ message: "Use only lowercase alphanumeric characters or '-'", value: /^[a-z0-9-]+$/ },
40+
{ message: "Cannot start/end with '-'", value: /^(?![-]).*[^-]$/ },
41+
{ message: 'Maximum 63 characters required', value: /^.{1,63}$/ },
42+
],
43+
},
5244
isProduction: {
5345
required: true,
5446
pattern: { message: 'token is required', value: /[^]+/ },

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,14 @@ export type EnvDrawerProps = { reload: () => void; hideClusterDrawer: () => void
3636
| ({ drawerType: 'editEnv'; clusterId: number; clusterName: string } & EnvDetails)
3737
)
3838

39-
export type EnvironmentFormType = Omit<EnvDetails, 'isVirtualCluster' | 'envId'> & {
39+
export type EnvironmentFormType = Omit<EnvDetails, 'envId'> & {
4040
clusterId: number
4141
}
4242

4343
export type GetClusterEnvironmentUpdatePayloadType = Partial<Pick<ClusterNamespacesDTO, 'resourceVersion'>> & {
4444
data: EnvironmentFormType
4545
envId: number
4646
namespaceLabels?: TagType[]
47-
isVirtualCluster: boolean
4847
}
4948

5049
interface ClusterNamespacesLabel {

src/Pages/GlobalConfigurations/ClustersAndEnvironments/ClusterEnvironmentDrawer/utils.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,8 @@ export const getClusterEnvironmentUpdatePayload = ({
2525
envId,
2626
namespaceLabels,
2727
resourceVersion,
28-
isVirtualCluster,
2928
}: GetClusterEnvironmentUpdatePayloadType) =>
30-
isVirtualCluster
29+
data.isVirtualCluster
3130
? {
3231
id: envId,
3332
environment_name: data.envName,

0 commit comments

Comments
 (0)