@@ -16,7 +16,7 @@ import {
1616import React , { useEffect , useMemo , useRef , useState } from 'react'
1717import { ReactComponent as Close } from '../../assets/icons/ic-close.svg'
1818import { 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'
2020import { ButtonWithLoader , FloatingVariablesSuggestions , sortObjectArrayAlphabetically } from '../common'
2121import BuildCD from './BuildCD'
2222import { CD_PATCH_ACTION , Environment , GeneratedHelmPush } from './cdPipeline.types'
@@ -52,6 +52,8 @@ import { calculateLastStepDetailsLogic, checkUniqueness, validateTask } from './
5252import { pipelineContext } from '../workflowEditor/workflowEditor'
5353import { PipelineFormDataErrorType , PipelineFormType } from '../workflowEditor/types'
5454import { getDockerRegistryMinAuth } from '../ciConfig/service'
55+ import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
56+ import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
5557
5658export 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