Skip to content

Commit 81df981

Browse files
check module installed for cd
1 parent fb20c42 commit 81df981

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/components/cdPipeline/NewCDPipeline.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import React, { useEffect, useMemo, useRef, useState } from 'react'
1717
import { ReactComponent as Close } from '../../assets/icons/ic-close.svg'
1818
import { NavLink, Redirect, Route, Switch, useParams, useRouteMatch } from 'react-router-dom'
19-
import { CDDeploymentTabText, DELETE_ACTION, SourceTypeMap, TriggerType, ViewType } from '../../config'
19+
import { CDDeploymentTabText, DELETE_ACTION, ModuleNameMap, SourceTypeMap, TriggerType, ViewType } from '../../config'
2020
import { ButtonWithLoader, FloatingVariablesSuggestions, sortObjectArrayAlphabetically } from '../common'
2121
import BuildCD from './BuildCD'
2222
import { CD_PATCH_ACTION, Environment, GeneratedHelmPush } from './cdPipeline.types'
@@ -52,6 +52,8 @@ import { calculateLastStepDetailsLogic, checkUniqueness, validateTask } from './
5252
import { pipelineContext } from '../workflowEditor/workflowEditor'
5353
import { PipelineFormDataErrorType, PipelineFormType } from '../workflowEditor/types'
5454
import { getDockerRegistryMinAuth } from '../ciConfig/service'
55+
import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
56+
import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
5557

5658
export enum deleteDialogType {
5759
showForceDeleteDialog = 'showForceDeleteDialog',
@@ -176,6 +178,8 @@ export default function NewCDPipeline({
176178
preBuildStage: Map<string, VariableType>[]
177179
postBuildStage: Map<string, VariableType>[]
178180
}>({ preBuildStage: [], postBuildStage: [] })
181+
const [isSecurityModuleInstalled, setSecurityModuleInstalled] = useState<boolean>(false)
182+
179183

180184
useEffect(() => {
181185
getInit()
@@ -195,6 +199,7 @@ export default function NewCDPipeline({
195199
}
196200

197201
const getInit = () => {
202+
getSecurityModuleStatus()
198203
Promise.all([
199204
getDeploymentStrategyList(appId),
200205
getGlobalVariable(Number(appId), true),
@@ -276,6 +281,15 @@ export default function NewCDPipeline({
276281
})
277282
}
278283

284+
const getSecurityModuleStatus = async (): Promise<void> => {
285+
try {
286+
const { result } = await getModuleInfo(ModuleNameMap.SECURITY)
287+
if (result?.status === ModuleStatus.INSTALLED) {
288+
setSecurityModuleInstalled(true)
289+
}
290+
} catch (error) {}
291+
}
292+
279293
const calculateLastStepDetail = (
280294
isFromAddNewTask: boolean,
281295
_formData: PipelineFormType,
@@ -1028,12 +1042,12 @@ export default function NewCDPipeline({
10281042
<Switch>
10291043
{isAdvanced && (
10301044
<Route path={`${path}/pre-build`}>
1031-
<PreBuild presetPlugins={presetPlugins} sharedPlugins={sharedPlugins} />
1045+
<PreBuild presetPlugins={presetPlugins} sharedPlugins={sharedPlugins} isSecurityModuleInstalled={isSecurityModuleInstalled} />
10321046
</Route>
10331047
)}
10341048
{isAdvanced && (
10351049
<Route path={`${path}/post-build`}>
1036-
<PreBuild presetPlugins={presetPlugins} sharedPlugins={sharedPlugins} />
1050+
<PreBuild presetPlugins={presetPlugins} sharedPlugins={sharedPlugins} isSecurityModuleInstalled={isSecurityModuleInstalled} />
10371051
</Route>
10381052
)}
10391053
<Route path={`${path}/build`}>

0 commit comments

Comments
 (0)