Skip to content

Commit 1be717e

Browse files
committed
feat: CreateCICDPipeline - add support for TemplateView
1 parent be01382 commit 1be717e

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/CreateCICDPipeline.tsx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ export const CreateCICDPipeline = ({
6060
isGitOpsInstalledButNotConfigured,
6161
isGitOpsRepoNotConfigured,
6262
envIds,
63+
isTemplateView,
6364
reloadAppConfig,
6465
}: CreateCICDPipelineProps) => {
6566
// STATES
@@ -79,8 +80,8 @@ export const CreateCICDPipeline = ({
7980

8081
// ASYNC CALLS
8182
const [isCiCdPipelineLoading, ciCdPipelineRes, ciCdPipelineErr, reloadCiCdPipeline, setter] = useAsync(
82-
() => getCICDPipelineInitData(appId),
83-
[open],
83+
() => getCICDPipelineInitData(appId, isTemplateView),
84+
[open, isTemplateView],
8485
open,
8586
)
8687

@@ -202,6 +203,21 @@ export const CreateCICDPipeline = ({
202203
},
203204
{
204205
pipelineType: CIPipelineBuildType.CI_BUILD,
206+
name: '',
207+
active: true,
208+
ciMaterial: [],
209+
dockerArgs: {},
210+
externalCiConfig: {},
211+
id: 0,
212+
isExternal: false,
213+
isManual: false,
214+
linkedCount: 0,
215+
scanEnabled: false,
216+
environmentId: 0,
217+
customTag: {
218+
tagPattern: '',
219+
counterX: '',
220+
},
205221
},
206222
materialsPayload,
207223
+appId,
@@ -210,7 +226,7 @@ export const CreateCICDPipeline = ({
210226
webhookConditionList,
211227
ciPipelineSourceTypeOptions,
212228
null,
213-
false,
229+
isTemplateView,
214230
)
215231

216232
ciPipelineResRef.current = {
@@ -229,7 +245,7 @@ export const CreateCICDPipeline = ({
229245
ciPipelineId: ciPipelineResRef.current.id,
230246
}),
231247
},
232-
{ isTemplateView: false },
248+
{ isTemplateView },
233249
),
234250
])
235251

src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/service.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const getSavedStrategies = (strategies: DeploymentStrategy[]): SavedDeploymentSt
4545
return []
4646
}
4747

48-
const getCDInitData = async (appId: string): Promise<CreateCICDPipelineData['cd']> => {
48+
const getCDInitData = async (appId: string, isTemplateView: boolean): Promise<CreateCICDPipelineData['cd']> => {
4949
const [pipelineStrategyResponse, cpPipelineName, envList] = await Promise.all([
50-
getDeploymentStrategyList(appId, false),
51-
getCDPipelineNameSuggestion(appId, false),
50+
getDeploymentStrategyList(appId, isTemplateView),
51+
getCDPipelineNameSuggestion(appId, isTemplateView),
5252
getEnvironmentListMinPublic(true),
5353
])
5454
const strategies = pipelineStrategyResponse.result.pipelineStrategy || []
@@ -104,15 +104,18 @@ const getCDInitData = async (appId: string): Promise<CreateCICDPipelineData['cd'
104104
}
105105
}
106106

107-
const getCIInitData = async (appId: string) => {
107+
const getCIInitData = async (appId: string, isTemplateView: boolean) => {
108108
const [
109109
{
110110
result: { form, isBlobStorageConfigured },
111111
},
112112
{
113113
result: { status },
114114
},
115-
] = await Promise.all([getInitData(appId.toString(), true, false, false), getModuleInfo(ModuleNameMap.SECURITY)])
115+
] = await Promise.all([
116+
getInitData(appId.toString(), true, false, isTemplateView),
117+
getModuleInfo(ModuleNameMap.SECURITY),
118+
])
116119

117120
return {
118121
...form,
@@ -121,9 +124,12 @@ const getCIInitData = async (appId: string) => {
121124
}
122125
}
123126

124-
export const getCICDPipelineInitData = async (appId: string): Promise<CreateCICDPipelineData> => {
127+
export const getCICDPipelineInitData = async (
128+
appId: string,
129+
isTemplateView: boolean,
130+
): Promise<CreateCICDPipelineData> => {
125131
try {
126-
const [ci, cd] = await Promise.all([getCIInitData(appId), getCDInitData(appId)])
132+
const [ci, cd] = await Promise.all([getCIInitData(appId, isTemplateView), getCDInitData(appId, isTemplateView)])
127133

128134
return { ci, cd }
129135
} catch (err) {

src/Pages/App/Configurations/WorkflowEditor/CreateCICDPipeline/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface CreateCICDPipelineProps extends Pick<GenericModalProps, 'open'
1818
isGitOpsRepoNotConfigured: boolean
1919
envIds: number[]
2020
reloadAppConfig: () => void
21+
isTemplateView: boolean
2122
}
2223

2324
export interface CICDStepperProps {

src/components/ciPipeline/ciPipeline.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export function saveCIPipeline(
325325
undefined,
326326
ciPipelineSourceTypeOptions,
327327
false,
328-
response.result.appWorkflowId,
328+
response.result.appWorkflowId ?? ciPipelineFromRes.appWorkflowId,
329329
)
330330
})
331331
}

src/components/workflowEditor/workflowEditor.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ class WorkflowEdit extends Component<WorkflowEditProps, WorkflowEditState> {
608608
isGitOpsRepoNotConfigured={this.state.isGitOpsRepoNotConfigured}
609609
envIds={this.state.envIds}
610610
reloadAppConfig={this.props.reloadAppConfig}
611+
isTemplateView={this.props.isTemplateView}
611612
/>
612613
)}
613614
<Switch>

0 commit comments

Comments
 (0)