Skip to content

Commit 32225c0

Browse files
committed
fix: skip deployment if strategy not selected
1 parent a4a2a95 commit 32225c0

File tree

5 files changed

+44
-28
lines changed

5 files changed

+44
-28
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ src/App.tsx
1010
src/Pages/GlobalConfigurations/Authorization/APITokens/__tests__/ApiTokens.test.tsx
1111
src/components/AppSelector/ChartSelector.tsx
1212
src/components/ApplicationGroup/AppGroup.service.ts
13-
src/components/ApplicationGroup/AppGroup.types.ts
1413
src/components/ApplicationGroup/AppGroup.utils.ts
1514
src/components/ApplicationGroup/AppGroupAppFilter.components.tsx
16-
src/components/ApplicationGroup/AppGroupAppFilter.tsx
1715
src/components/ApplicationGroup/AppGroupDetailsRoute.tsx
1816
src/components/ApplicationGroup/AppGroupRoute.tsx
1917
src/components/ApplicationGroup/Constants.ts

src/components/ApplicationGroup/AppGroup.types.ts

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,35 +14,39 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { Dispatch, SetStateAction } from 'react'
18+
import { MultiValue } from 'react-select'
19+
1720
import {
1821
ACTION_STATE,
22+
AppInfoListType,
23+
ApprovalConfigDataType,
1924
CDModalTabType,
25+
CommonNodeAttr,
2026
DeploymentNodeType,
27+
DeploymentStrategyTypeWithDefault,
2128
FilterConditionsListType,
29+
GVKType,
2230
MODAL_TYPE,
31+
PipelineIdsVsDeploymentStrategyMap,
2332
ResponseType,
33+
RuntimePluginVariables,
34+
UseUrlFiltersReturnType,
2435
WorkflowNodeType,
2536
WorkflowType,
26-
AppInfoListType,
27-
GVKType,
28-
UseUrlFiltersReturnType,
29-
CommonNodeAttr,
30-
ApprovalConfigDataType,
31-
RuntimePluginVariables,
32-
PipelineIdsVsDeploymentStrategyMap,
3337
} from '@devtron-labs/devtron-fe-common-lib'
34-
import { CDMaterialProps, RuntimeParamsErrorState } from '../app/details/triggerView/types'
35-
import { EditDescRequest, NodeType, Nodes, OptionType } from '../app/types'
36-
import { MultiValue } from 'react-select'
37-
import { AppFilterTabs, BulkResponseStatus } from './Constants'
38-
import { WorkloadCheckType } from '../v2/appDetails/sourceInfo/scaleWorkloads/scaleWorkloadsModal.type'
38+
39+
import { TIME_STAMP_ORDER } from '@Components/app/details/triggerView/Constants'
40+
import { CDMaterialProps, RuntimeParamsErrorState, WebhookPayloadType } from '@Components/app/details/triggerView/types'
3941
import {
4042
AppConfigState,
4143
EnvConfigurationsNavProps,
4244
EnvConfigurationState,
4345
} from '@Pages/Applications/DevtronApps/Details/AppConfigurations/AppConfig.types'
44-
import { WebhookPayloadType } from '@Components/app/details/triggerView/types'
45-
import { TIME_STAMP_ORDER } from '@Components/app/details/triggerView/Constants'
46+
47+
import { EditDescRequest, Nodes, NodeType, OptionType } from '../app/types'
48+
import { WorkloadCheckType } from '../v2/appDetails/sourceInfo/scaleWorkloads/scaleWorkloadsModal.type'
49+
import { AppFilterTabs, BulkResponseStatus } from './Constants'
4650

4751
interface BulkTriggerAppDetailType {
4852
workFlowId: string
@@ -158,6 +162,8 @@ export interface BulkCDTriggerType extends BulkRuntimeParamsType {
158162
isVirtualEnv?: boolean
159163
uniqueReleaseTags: string[]
160164
feasiblePipelineIds: Set<number>
165+
bulkDeploymentStrategy: DeploymentStrategyTypeWithDefault
166+
setBulkDeploymentStrategy: Dispatch<SetStateAction<DeploymentStrategyTypeWithDefault>>
161167
}
162168

163169
export interface ProcessWorkFlowStatusType {

src/components/ApplicationGroup/AppGroupAppFilter.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@
1515
*/
1616

1717
import { useEffect, useRef, useState } from 'react'
18-
import ReactSelect, { SelectInstance } from 'react-select'
1918
import ReactGA from 'react-ga4'
20-
import { useAppGroupAppFilterContext } from './AppGroupDetailsRoute'
21-
import { appGroupAppSelectorStyle } from './AppGroup.utils'
22-
import { AppGroupAppFilterContextType, FilterParentType } from './AppGroup.types'
23-
import { AppFilterTabs } from './Constants'
24-
import { MenuList, Option, ValueContainer } from './AppGroupAppFilter.components'
19+
import ReactSelect, { SelectInstance } from 'react-select'
20+
2521
import { OptionType, ReactSelectInputAction, useRegisterShortcut } from '@devtron-labs/devtron-fe-common-lib'
22+
2623
import { setAppGroupFilterInLocalStorage } from '@Components/common'
2724

28-
export default function AppGroupAppFilter() {
25+
import { AppGroupAppFilterContextType, FilterParentType } from './AppGroup.types'
26+
import { appGroupAppSelectorStyle } from './AppGroup.utils'
27+
import { MenuList, Option, ValueContainer } from './AppGroupAppFilter.components'
28+
import { useAppGroupAppFilterContext } from './AppGroupDetailsRoute'
29+
import { AppFilterTabs } from './Constants'
30+
31+
const AppGroupAppFilter = () => {
2932
const {
3033
resourceId,
3134
appListOptions,
@@ -171,3 +174,5 @@ export default function AppGroupAppFilter() {
171174
/>
172175
)
173176
}
177+
178+
export default AppGroupAppFilter

src/components/ApplicationGroup/Details/TriggerView/BulkCDTrigger.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ const BulkCDTrigger = ({
123123
uniqueReleaseTags,
124124
runtimeParams,
125125
setRuntimeParams,
126+
bulkDeploymentStrategy,
127+
setBulkDeploymentStrategy,
126128
runtimeParamsErrorState,
127129
setRuntimeParamsErrorState,
128130
}: BulkCDTriggerType) => {
@@ -144,7 +146,6 @@ const BulkCDTrigger = ({
144146
const [showResistanceBox, setShowResistanceBox] = useState(false)
145147
const [currentSidebarTab, setCurrentSidebarTab] = useState<CDMaterialSidebarType>(CDMaterialSidebarType.IMAGE)
146148
const [skipHibernatedApps, setSkipHibernatedApps] = useState<boolean>(false)
147-
const [bulkDeploymentStrategy, setBulkDeploymentStrategy] = useState<DeploymentStrategyTypeWithDefault>('DEFAULT')
148149
const [showStrategyFeasibilityPage, setShowStrategyFeasibilityPage] = useState<boolean>(false)
149150
const [pipelineIdVsStrategyMap, setPipelineIdVsStrategyMap] = useState<PipelineIdsVsDeploymentStrategyMap>({})
150151

src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
ComponentSizeType,
5858
API_STATUS_CODES,
5959
PipelineIdsVsDeploymentStrategyMap,
60+
DeploymentStrategyTypeWithDefault,
6061
} from '@devtron-labs/devtron-fe-common-lib'
6162
import Tippy from '@tippyjs/react'
6263
import { BUILD_STATUS, DEFAULT_GIT_BRANCH_VALUE, NO_COMMIT_SELECTED, URLS, ViewType } from '../../../../config'
@@ -198,6 +199,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
198199
const [runtimeParamsErrorState, setRuntimeParamsErrorState] = useState<Record<string, RuntimeParamsErrorState>>({})
199200
const [isBulkTriggerLoading, setIsBulkTriggerLoading] = useState<boolean>(false)
200201
const [selectedWebhookNode, setSelectedWebhookNode] = useState<{ appId: number; id: number }>(null)
202+
const [bulkDeploymentStrategy, setBulkDeploymentStrategy] = useState<DeploymentStrategyTypeWithDefault>('DEFAULT')
201203

202204
const enableRoutePrompt = isBranchChangeLoading || isBulkTriggerLoading
203205
usePrompt({ shouldPrompt: enableRoutePrompt })
@@ -1498,9 +1500,11 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
14981500
ciArtifact = artifact
14991501
}
15001502
})
1501-
if (ciArtifact) {
1502-
const pipelineId = Number(node.id)
1503-
const strategy = pipelineIdVsStrategyMap[pipelineId]
1503+
const pipelineId = Number(node.id)
1504+
const strategy = pipelineIdVsStrategyMap[pipelineId]
1505+
1506+
// skip app if bulkDeploymentStrategy is not default and strategy is not configured for app
1507+
if (ciArtifact && (bulkDeploymentStrategy === 'DEFAULT' || !!strategy)) {
15041508
_CDTriggerPromiseFunctionList.push(() =>
15051509
triggerCDNode({
15061510
pipelineId,
@@ -2102,7 +2106,9 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou
21022106
setRuntimeParams={setRuntimeParams}
21032107
runtimeParamsErrorState={runtimeParamsErrorState}
21042108
setRuntimeParamsErrorState={setRuntimeParamsErrorState}
2105-
/>
2109+
bulkDeploymentStrategy={bulkDeploymentStrategy}
2110+
setBulkDeploymentStrategy={setBulkDeploymentStrategy}
2111+
/>
21062112
)
21072113
}
21082114

0 commit comments

Comments
 (0)