Skip to content

Commit 2c74b93

Browse files
authored
Merge pull request #429 from devtron-labs/feat/mandatory-tags-cd
feat: add type for trigger block state due to mandatory tags
2 parents f7bed74 + 3fb38d1 commit 2c74b93

File tree

21 files changed

+313
-188
lines changed

21 files changed

+313
-188
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.3.0",
3+
"version": "1.3.0-beta-8",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Common.service.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
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'
2121
import { get, post } from './Api'
2222
import { GitProviderType, ROUTES } from './Constants'
@@ -116,6 +116,21 @@ const sanitizeApprovalConfigFromApprovalMetadata = (
116116
}
117117
}
118118

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+
119134
const cdMaterialListModal = ({
120135
artifacts,
121136
offset,
@@ -210,6 +225,7 @@ const cdMaterialListModal = ({
210225
deploymentWindowArtifactMetadata: material.deploymentWindowArtifactMetadata ?? null,
211226
configuredInReleases: material.configuredInReleases ?? [],
212227
appWorkflowId: material.appWorkflowId ?? null,
228+
deploymentBlockedState: sanitizeDeploymentBlockedState(material.deploymentBlockedState)
213229
}
214230
})
215231
return materials

src/Common/CustomTagSelector/TagLabelSelect.tsx

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

src/Common/CustomTagSelector/TagSelector.utils.ts

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

src/Common/CustomTagSelector/Types.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,6 @@ export interface TagType {
4949
valueConstraint?: VariableValueConstraintTypes
5050
}
5151

52-
export interface TagErrorType {
53-
isValid: boolean
54-
messages: string[]
55-
}
56-
export interface TagLabelSelectType {
57-
isCreateApp?: boolean
58-
labelTags: TagType[]
59-
setLabelTags: (tagList: TagType[]) => void
60-
tabIndex?: number
61-
selectedProjectId?: number
62-
suggestedTagsOptions?: SuggestedTagOptionType[]
63-
reloadProjectTags?: boolean
64-
hidePropagateTag?: boolean
65-
}
66-
6752
export interface TagDetailType {
6853
index: number
6954
tagData: TagType

src/Common/CustomTagSelector/index.ts

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

1717
export { default as PropagateTagInfo } from './PropagateTagInfo'
1818
export * from './TagDetails'
19-
export * from './TagLabelSelect'
2019
export * from './TagLabelValueSelector'
2120
export * from './ResizableTagTextArea'
2221
export * from './Types'
23-
export { validateTagKeyValue } from './tags.utils'
22+
export { validateTagKeyValue, validateTagValue } from './tags.utils'

src/Common/CustomTagSelector/tags.utils.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,10 @@ export const validateTagKeyValue = (value: string): { isValid: boolean; errorMes
2727
const { isValid, messages } = propagateTagKey(value)
2828
return { isValid, errorMessages: messages }
2929
}
30+
31+
export const validateTagValue = (value: string, key: string): { isValid: boolean; errorMessages: string[] } => {
32+
const { propagateTagValue } = new ValidationRules()
33+
34+
const { isValid, messages } = propagateTagValue(value, key)
35+
return { isValid, errorMessages: messages }
36+
}

src/Common/DraggableWrapper/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export interface DraggableWrapperProps {
3939
childDivProps?: HTMLAttributes<HTMLDivElement>
4040
/**
4141
* Delta for fixing the scrollable layout positioning
42+
* @deprecated
4243
*/
4344
layoutFixDelta?: number
4445
}

0 commit comments

Comments
 (0)