Skip to content

Commit e5a5133

Browse files
authored
Merge branch 'develop' into fix/deployment-history-config-compare
2 parents 1c7b62a + add977f commit e5a5133

33 files changed

+483
-233
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ src/Common/Common.service.ts
1616
src/Common/CustomInput/CustomInput.tsx
1717
src/Common/CustomTagSelector/PropagateTagInfo.tsx
1818
src/Common/CustomTagSelector/TagDetails.tsx
19-
src/Common/CustomTagSelector/TagLabelSelect.tsx
2019
src/Common/CustomTagSelector/TagLabelValueSelector.tsx
21-
src/Common/CustomTagSelector/TagSelector.utils.ts
2220
src/Common/CustomTagSelector/ValidationRules.ts
2321
src/Common/DebouncedSearch/DebouncedSearch.tsx
2422
src/Common/DebouncedSearch/Utils.ts

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.2.17",
3+
"version": "1.3.2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/CIPipeline.Types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,15 @@ export enum RefVariableStageType {
9999
POST_CI = 'POST_CI',
100100
}
101101

102+
export enum FilePropertyTypeSizeUnit {
103+
KB = 'KB',
104+
MB = 'MB',
105+
}
106+
102107
export interface FilePropertyType {
103108
allowedExtensions: string[]
104109
maxUploadSize: number
110+
sizeUnit: FilePropertyTypeSizeUnit
105111
}
106112

107113
export interface ConstraintType {

src/Common/CodeEditor/CodeEditor.reducer.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,16 @@ export const parseValueToCode = (value: string, mode: string, tabSize: number) =
5252
let final = value
5353

5454
if (obj) {
55-
final = mode === MODES.JSON ? JSON.stringify(obj, null, tabSize) : YAMLStringify(obj)
55+
switch (mode) {
56+
case MODES.JSON:
57+
final = JSON.stringify(obj, null, tabSize)
58+
break
59+
case MODES.YAML:
60+
final = YAMLStringify(obj)
61+
break
62+
default:
63+
break
64+
}
5665
}
5766

5867
return final
@@ -68,7 +77,7 @@ export const initialState = ({
6877
}: CodeEditorInitialValueType): CodeEditorState => ({
6978
mode: mode as MODES,
7079
theme: (theme || CodeEditorThemesKeys.vs) as CodeEditorThemesKeys,
71-
code: parseValueToCode(value, mode, tabSize),
80+
code: noParsing ? value : parseValueToCode(value, mode, tabSize),
7281
diffMode: diffView,
7382
noParsing: [MODES.JSON, MODES.YAML].includes(mode as MODES) ? noParsing : true,
7483
})

src/Common/CodeEditor/CodeEditor.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ const CodeEditor: React.FC<CodeEditorInterface> & CodeEditorComposition = React.
9292
const monacoRef = useRef(null)
9393
const { width, height: windowHeight } = useWindowSize()
9494
const memoisedReducer = React.useCallback(CodeEditorReducer, [])
95-
const [state, dispatch] = useReducer(memoisedReducer, initialState({ mode, theme, value, diffView, noParsing, tabSize }))
95+
const [state, dispatch] = useReducer(
96+
memoisedReducer,
97+
initialState({ mode, theme, value, diffView, noParsing, tabSize }),
98+
)
9699
const [, json, yamlCode, error] = useJsonYaml(state.code, tabSize, state.mode, !state.noParsing)
97100
const [, originalJson, originlaYaml] = useJsonYaml(defaultValue, tabSize, state.mode, !state.noParsing)
98101
const [contentHeight, setContentHeight] = useState(

src/Common/Common.service.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
import { MutableRefObject } from 'react'
1818
import moment from 'moment'
19-
import { RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
19+
import { PolicyBlockInfo, RuntimeParamsAPIResponseType, RuntimePluginVariables } from '@Shared/types'
2020
import { getIsManualApprovalSpecific, sanitizeUserApprovalConfig, stringComparatorBySortOrder } from '@Shared/Helpers'
21-
import { get, getIsRequestAborted, post } from './Api'
22-
import { API_STATUS_CODES, GitProviderType, ROUTES } from './Constants'
21+
import { get, post } from './Api'
22+
import { GitProviderType, ROUTES } from './Constants'
2323
import { getUrlWithSearchParams, showError, sortCallback } from './Helper'
2424
import {
2525
TeamList,
@@ -49,8 +49,6 @@ import { ApiResourceType } from '../Pages'
4949
import { API_TOKEN_PREFIX } from '@Shared/constants'
5050
import { DefaultUserKey } from '@Shared/types'
5151
import { RefVariableType } from './CIPipeline.Types'
52-
import { ServerErrors } from './ServerError'
53-
import { ToastManager, ToastVariantType } from '@Shared/Services'
5452

5553
export const getTeamListMin = (): Promise<TeamList> => {
5654
// ignore active field
@@ -118,6 +116,21 @@ const sanitizeApprovalConfigFromApprovalMetadata = (
118116
}
119117
}
120118

119+
const sanitizeDeploymentBlockedState = (deploymentBlockedState: PolicyBlockInfo) => {
120+
if (!deploymentBlockedState) {
121+
return {
122+
isBlocked: false,
123+
blockedBy: null,
124+
reason: '',
125+
}
126+
}
127+
return {
128+
isBlocked: deploymentBlockedState.isBlocked || false,
129+
blockedBy: deploymentBlockedState.blockedBy || null,
130+
reason: deploymentBlockedState.reason || '',
131+
}
132+
}
133+
121134
const cdMaterialListModal = ({
122135
artifacts,
123136
offset,
@@ -212,6 +225,7 @@ const cdMaterialListModal = ({
212225
deploymentWindowArtifactMetadata: material.deploymentWindowArtifactMetadata ?? null,
213226
configuredInReleases: material.configuredInReleases ?? [],
214227
appWorkflowId: material.appWorkflowId ?? null,
228+
deploymentBlockedState: sanitizeDeploymentBlockedState(material.deploymentBlockedState)
215229
}
216230
})
217231
return materials
@@ -567,16 +581,6 @@ export const getGlobalVariables = async ({
567581

568582
return variableList
569583
} catch (err) {
570-
if (!getIsRequestAborted(err)) {
571-
if (err instanceof ServerErrors && err.code === API_STATUS_CODES.PERMISSION_DENIED) {
572-
ToastManager.showToast({
573-
variant: ToastVariantType.notAuthorized,
574-
description: 'You are not authorized to access global variables',
575-
})
576-
} else {
577-
showError(err)
578-
}
579-
}
580584
throw err
581585
}
582586
}

src/Common/Constants.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ export const DOCUMENTATION = {
3333
}
3434

3535
export const PATTERNS = {
36+
STRING: /^[a-zA-Z0-9_]+$/,
37+
DECIMAL_NUMBERS: /^-?\d*\.?\d*$/,
3638
NATURAL_NUMBERS: /^\d*\.?\d*$/,
3739
KUBERNETES_KEY_PREFIX: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/,
3840
KUBERNETES_KEY_NAME: /^(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$/,
39-
START_END_ALPHANUMERIC: /^([Az09].*[A-Za-z0-9])$|[A-Za-z0-9]$/,
41+
START_END_ALPHANUMERIC: /^(([A-Za-z0-9].*[A-Za-z0-9])|[A-Za-z0-9])$/,
4042
ALPHANUMERIC_WITH_SPECIAL_CHAR: /^[A-Za-z0-9._-]+$/, // allow alphanumeric,(.) ,(-),(_)
4143
ESCAPED_CHARACTERS: /[.*+?^${}()|[\]\\]/g,
4244
NUMBERS_WITH_SCOPE_VARIABLES: /^(\d+(\.\d+)?|@{{[a-zA-Z0-9-]+}})$/,

src/Common/CustomTagSelector/PropagateTagInfo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default function PropagateTagInfo({ isCreateApp }: { isCreateApp: boolean
3939
<TippyCustomized
4040
theme={TippyTheme.white}
4141
className="w-300"
42-
placement="top"
42+
placement="left"
4343
Icon={InjectTag}
4444
heading="Propagate tags to K8s resources"
4545
infoText=""

src/Common/CustomTagSelector/TagLabelSelect.tsx

Lines changed: 0 additions & 73 deletions
This file was deleted.

0 commit comments

Comments
 (0)