@@ -16,7 +16,7 @@ import {
16
16
import React , { useEffect , useMemo , useRef , useState } from 'react'
17
17
import { ReactComponent as Close } from '../../assets/icons/ic-close.svg'
18
18
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'
20
20
import { ButtonWithLoader , FloatingVariablesSuggestions , sortObjectArrayAlphabetically } from '../common'
21
21
import BuildCD from './BuildCD'
22
22
import { CD_PATCH_ACTION , Environment , GeneratedHelmPush } from './cdPipeline.types'
@@ -52,6 +52,8 @@ import { calculateLastStepDetailsLogic, checkUniqueness, validateTask } from './
52
52
import { pipelineContext } from '../workflowEditor/workflowEditor'
53
53
import { PipelineFormDataErrorType , PipelineFormType } from '../workflowEditor/types'
54
54
import { getDockerRegistryMinAuth } from '../ciConfig/service'
55
+ import { getModuleInfo } from '../v2/devtronStackManager/DevtronStackManager.service'
56
+ import { ModuleStatus } from '../v2/devtronStackManager/DevtronStackManager.type'
55
57
56
58
export enum deleteDialogType {
57
59
showForceDeleteDialog = 'showForceDeleteDialog' ,
@@ -176,6 +178,8 @@ export default function NewCDPipeline({
176
178
preBuildStage : Map < string , VariableType > [ ]
177
179
postBuildStage : Map < string , VariableType > [ ]
178
180
} > ( { preBuildStage : [ ] , postBuildStage : [ ] } )
181
+ const [ isSecurityModuleInstalled , setSecurityModuleInstalled ] = useState < boolean > ( false )
182
+
179
183
180
184
useEffect ( ( ) => {
181
185
getInit ( )
@@ -195,6 +199,7 @@ export default function NewCDPipeline({
195
199
}
196
200
197
201
const getInit = ( ) => {
202
+ getSecurityModuleStatus ( )
198
203
Promise . all ( [
199
204
getDeploymentStrategyList ( appId ) ,
200
205
getGlobalVariable ( Number ( appId ) , true ) ,
@@ -276,6 +281,15 @@ export default function NewCDPipeline({
276
281
} )
277
282
}
278
283
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
+
279
293
const calculateLastStepDetail = (
280
294
isFromAddNewTask : boolean ,
281
295
_formData : PipelineFormType ,
@@ -1028,12 +1042,12 @@ export default function NewCDPipeline({
1028
1042
< Switch >
1029
1043
{ isAdvanced && (
1030
1044
< Route path = { `${ path } /pre-build` } >
1031
- < PreBuild presetPlugins = { presetPlugins } sharedPlugins = { sharedPlugins } />
1045
+ < PreBuild presetPlugins = { presetPlugins } sharedPlugins = { sharedPlugins } isSecurityModuleInstalled = { isSecurityModuleInstalled } />
1032
1046
</ Route >
1033
1047
) }
1034
1048
{ isAdvanced && (
1035
1049
< Route path = { `${ path } /post-build` } >
1036
- < PreBuild presetPlugins = { presetPlugins } sharedPlugins = { sharedPlugins } />
1050
+ < PreBuild presetPlugins = { presetPlugins } sharedPlugins = { sharedPlugins } isSecurityModuleInstalled = { isSecurityModuleInstalled } />
1037
1051
</ Route >
1038
1052
) }
1039
1053
< Route path = { `${ path } /build` } >
0 commit comments