11<template >
2- <div class =" card w-100" ref =" workflowForm" >
3- <div class =" card-header" >
4- <div class =" card-title" >
5- <h1 >{{ mode === "new" ? "New" : "Detail" }} Workflow</h1 >
2+ <div >
3+ <!-- Page header -->
4+ <div class =" page-header" >
5+ <div class =" row align-items-center" >
6+ <div class =" col" >
7+ <h2 class =" page-title" >{{ mode === 'new' ? 'New' : 'Detail' }} Workflow</h2 >
8+ </div >
69 </div >
710 </div >
8- <div
11+
12+ <!-- Data card -->
13+ <div class =" card card-flush w-100" ref =" workflowForm" >
14+ <div
915 class =" card-body"
1016 v-if ="
1117 workflowInfoFormData &&
1218 workflowParamsFormData &&
1319 workflowStageMappingsFormData" >
14- <div class =" card-title" >
15- <!-- 워크플로우 명 -->
16- <div class =" mb-3" >
17- <label class =" form-label required" >
18- Workflow Name
19- </label >
20- <div class =" grid gap-0 column-gap-3" >
21- <input type =" text" ref =" workflowName" class =" form-control p-2 g-col-11" placeholder =" Enter the workflow name" v-model =" workflowInfoFormData.workflowName" />
22- <button v-if =" !duplicatedWorkflow" class =" btn btn-primary" @click =" onClickDuplicatWorkflowName(workflowInfoFormData.workflowName)" >Duplicate Check</button >
23- <button v-else class =" btn btn-success" >Duplicate Check</button >
20+ <div class =" card-title" >
21+ <!-- Workflow Name -->
22+ <div class =" mb-3" >
23+ <label class =" form-label required" >
24+ Workflow Name
25+ </label >
26+ <div class =" grid gap-0 column-gap-3" >
27+ <input type =" text" ref =" workflowName" class =" form-control p-2 g-col-11" placeholder =" Enter the workflow name" v-model =" workflowInfoFormData.workflowName" />
28+ <button
29+ v-if =" !duplicatedWorkflow"
30+ class =" btn btn-primary chk"
31+ @click =" onClickDuplicatWorkflowName(workflowInfoFormData.workflowName)"
32+ style =" margin :3px ; width : 150px ;"
33+ >Duplicate Check</button >
34+ <button
35+ v-else
36+ class =" btn btn-success"
37+ style =" margin :3px ; width : 150px ;"
38+ >Duplicate Check</button >
39+ </div >
2440 </div >
25- </div >
2641
27- <!-- 목적 -->
28- <div class =" mb-3" >
29- <label class =" form-label required" >Purpose</label >
30- <div class =" grid gap-0 column-gap-3" >
31- <select ref =" workflowPurpose" v-model =" workflowInfoFormData.workflowPurpose" class =" form-select p-2 g-col-12" >
32- <option value =" " >Select Workflow Purpose.</option >
33- <option v-for =" (purpose, idx) in workflowPurposeList" :value =" purpose.value" :key =" idx" >
34- {{ purpose.name }}
35- </option >
36- </select >
42+ <!-- Purpose -->
43+ <div class =" mb-3" >
44+ <label class =" form-label required" >Purpose</label >
45+ <div class =" grid gap-0 column-gap-3" >
46+ <select ref =" workflowPurpose" v-model =" workflowInfoFormData.workflowPurpose" class =" form-select p-2 g-col-12" >
47+ <option value =" " >Select Workflow Purpose.</option >
48+ <option v-for =" (purpose, idx) in workflowPurposeList" :value =" purpose.value" :key =" idx" >
49+ {{ purpose.name }}
50+ </option >
51+ </select >
52+ </div >
3753 </div >
38- </div >
3954
40- <!-- OSS URL -->
41- <!-- <div class="mb-3">
42- <label class="form-label required">OSS URL</label>
43- <div class="grid gap-0 column-gap-3">
44- <input type="text" class="form-control p-2 g-col-12" placeholder="Enter the OSS URL" :value="ossUrl" disabled/>
45- </div>
46- </div> -->
47- <!-- 파이프 라인 -->
48- <PipelineGenerator
49- :mode =" mode"
50- :workflow-stage-mappings-form-data =" workflowStageMappingsFormData"
51- @init-workflow-stage-mappings =" initWorkflowStageMappings"
52- @on-click-create-script =" onClickCreateScript"
53- @splice-workflow-stage-mappings-form-data =" spliceWorkflowStageMappingsFormData"
54- />
55-
56- <!-- 파라미터 -->
57- <ParamForm
58- :popup =" false"
59- :workflow-param-data =" workflowParamsFormData"
60- event-listener-yn =" N"
61- />
62-
63- <WorkflowHistoryList
64- :workflow-idx =" workflowInfoFormData.workflowIdx"
65- :workflow-name =" workflowInfoFormData.workflowName"
66- />
67-
68- <div class =" row align-items-center" >
69- <div id =" gap" class =" col" />
70- <div class =" col-auto ms-auto" >
71- <div class =" btn-list" >
72- <button class =" btn btn-primary" @click =" onClickSubmit" >
73- {{ mode === 'new' ? 'Regist' : 'Edit' }}
74- </button >
75- <!-- <button v-show="mode === 'edit'" class="btn btn-info" @click="onClickRun">
76- 실행
77- </button> -->
78- <button class =" btn btn-right border" @click =" onClickList" >
79- To List
80- </button >
55+ <!-- OSS URL -->
56+ <!-- <div class="mb-3">
57+ <label class="form-label required">OSS URL</label>
58+ <div class="grid gap-0 column-gap-3">
59+ <input type="text" class="form-control p-2 g-col-12" placeholder="Enter the OSS URL" :value="ossUrl" disabled/>
60+ </div>
61+ </div> -->
62+ <!-- Pipeline -->
63+ <PipelineGenerator
64+ :mode =" mode"
65+ :workflow-stage-mappings-form-data =" workflowStageMappingsFormData"
66+ @init-workflow-stage-mappings =" initWorkflowStageMappings"
67+ @on-click-create-script =" onClickCreateScript"
68+ @splice-workflow-stage-mappings-form-data =" spliceWorkflowStageMappingsFormData"
69+ />
70+
71+ <!-- Parameters -->
72+ <ParamForm
73+ :popup =" false"
74+ :workflow-param-data =" workflowParamsFormData"
75+ event-listener-yn =" N"
76+ />
77+
78+ <WorkflowHistoryList
79+ :workflow-idx =" workflowInfoFormData.workflowIdx"
80+ :workflow-name =" workflowInfoFormData.workflowName"
81+ />
82+
83+ <div class =" row align-items-center" >
84+ <div id =" gap" class =" col" />
85+ <div class =" col-auto ms-auto" >
86+ <div class =" btn-list" >
87+ <button class =" btn btn-primary" @click =" onClickSubmit" >
88+ {{ mode === 'new' ? 'Regist' : 'Edit' }}
89+ </button >
90+ <!-- <button v-show="mode === 'edit'" class="btn btn-info" @click="onClickRun">
91+ Run
92+ </button> -->
93+ <button class =" btn btn-secondary" @click =" onClickGoBack" >
94+ Go Back
95+ </button >
96+ <button class =" btn btn-right border" @click =" onClickList" >
97+ To List
98+ </button >
99+ </div >
81100 </div >
82101 </div >
83102 </div >
89108import { ref } from ' vue' ;
90109import { onMounted } from ' vue' ;
91110import { useRoute , useRouter } from ' vue-router' ;
111+ // @ts-ignore
92112import { getOssList } from ' @/api/oss'
113+ // @ts-ignore
93114import type { Workflow , WorkflowPurpose , Oss , WorkflowInfo , WorkflowParams , WorkflowStageMappings } from ' @/views/type/type'
115+ // @ts-ignore
94116import PipelineGenerator from ' @/views/workflow/components/PipelineGenerator.vue' ;
117+ // @ts-ignore
95118import { duplicateCheck , getWorkflowDetailInfo , registWorkflow , updateWorkflow , getTemplateStage } from ' @/api/workflow'
96119import { useToast } from ' vue-toastification' ;
120+ // @ts-ignore
97121import ParamForm from ' ./components/ParamForm.vue' ;
122+ // @ts-ignore
98123import WorkflowHistoryList from ' @/views/workflow/components/WorkflowHistoryList.vue' ;
99124import { reactive } from ' vue' ;
125+ // @ts-ignore
100126import _ from ' lodash' ;
101127import { watch } from ' vue' ;
102128
@@ -111,14 +137,14 @@ onMounted(() => {
111137 setWorkflowPurposeList ()
112138})
113139
114- // ================================================================================= 모드 set
140+ // ================================================================================= Set mode
115141const mode = ref (' new' as string )
116142const setMode = () => {
117143 mode .value = route .params .workflowIdx === undefined ? ' new' : ' detail'
118144}
119145
120- // ================================================================================= 생성 / 수정 데이터 set
121- // workflowInfo 데이터 ()
146+ // ================================================================================= Set create / edit data
147+ // workflowInfo data
122148let workflowInfoFormData = reactive ({} as WorkflowInfo )
123149const workflowParamsFormData = ref ([] as Array <WorkflowParams >)
124150const workflowStageMappingsFormData = ref ([] as Array <WorkflowStageMappings >)
@@ -156,37 +182,37 @@ const setWorkflowFormData = async () => {
156182}
157183
158184
159- // ================================================================================= 중복체크
185+ // ================================================================================= Duplicate check
160186const duplicatedWorkflow = ref (false as boolean )
161187const onClickDuplicatWorkflowName = async (workflowName : string ) => {
162188 const { data } = await duplicateCheck (workflowName )
163189 if (! data ) {
164- toast .success (' 사용 가능한 이름입니다 .' )
190+ toast .success (' Name is available .' )
165191 duplicatedWorkflow .value = true
166192 }
167193 else
168- toast .error (' 이미 사용중인 이름입니다 .' )
194+ toast .error (' Name is already in use .' )
169195}
170196
171- // ================================================================================= 목적 목록
197+ // ================================================================================= Purpose list
172198
173199const workflowPurposeList = ref ([] as Array <WorkflowPurpose >)
174200const setWorkflowPurposeList = () => {
175201 workflowPurposeList .value = [
176202 {
177- name: " 배포용 " ,
203+ name: " For Deployment " ,
178204 value: " deploy"
179205 },
180206 {
181- name: " 실행용 " ,
207+ name: " For Execution " ,
182208 value: " run"
183209 },
184210 {
185- name: " 테스트용 " ,
211+ name: " For Testing " ,
186212 value: " test"
187213 },
188214 {
189- name: " 웹훅용 " ,
215+ name: " For Webhook " ,
190216 value: " webhook"
191217 },
192218 ]
@@ -200,13 +226,13 @@ const setOssInfo = async () => {
200226
201227 if (data ) {
202228 if (workflowInfoFormData ) {
203- // 등록
229+ // Create
204230 if (mode .value === ' new' ) {
205- workflowInfoFormData .ossIdx = data ? data [0 ].ossIdx : ' OSS 정보가 없습니다. '
231+ workflowInfoFormData .ossIdx = data ? data [0 ].ossIdx : ' No OSS information '
206232 ossUrl .value = data ? data [0 ].ossUrl : ' NULL'
207233 }
208234
209- // 수정
235+ // Edit
210236 else {
211237 data .forEach ((oss : Oss ) => {
212238 if (oss .ossIdx === workflowInfoFormData .ossIdx ) {
@@ -221,8 +247,21 @@ const setOssInfo = async () => {
221247 }
222248}
223249
224- // ================================================================================= 등록 Action
250+ // ================================================================================= Registration Action
225251const onClickSubmit = async () => {
252+ // ================= Validation =================
253+ if (! workflowInfoFormData .workflowName ) {
254+ toast .error (' Please enter Workflow Name.' );
255+ return ;
256+ }
257+ if (! workflowInfoFormData .workflowPurpose ) {
258+ toast .error (' Please select Purpose.' );
259+ return ;
260+ }
261+ if (! workflowStageMappingsFormData .value || workflowStageMappingsFormData .value .length === 0 ) {
262+ toast .error (' Please create Pipeline script.' );
263+ return ;
264+ }
226265 setSubmitParam ()
227266 if (mode .value === ' new' )
228267 await _registWorkflow ()
@@ -237,11 +276,11 @@ const _registWorkflow = async () => {
237276 }
238277 const { data } = await registWorkflow (param )
239278 if (data ) {
240- toast .success (' 등록 되었습니다 .' )
279+ toast .success (' Registered successfully .' )
241280 router .push (' /web/workflow/list' )
242281 }
243282 else {
244- toast .error (' 등록하지 못했습니다 .' )
283+ toast .error (' Failed to register .' )
245284 }
246285}
247286
@@ -255,11 +294,11 @@ const _updateWorkflow = async () => {
255294 const { data } = await updateWorkflow (param )
256295
257296 if (data ) {
258- toast .success (' 수정 되었습니다 .' )
297+ toast .success (' Updated successfully .' )
259298 router .push (' /web/workflow/list' )
260299 }
261300 else {
262- toast .error (' 수정하지 못했습니다 .' )
301+ toast .error (' Failed to update .' )
263302 }
264303}
265304const setSubmitParam = () => {
@@ -291,48 +330,53 @@ const setRemoveWorkflowParamIdx = () => {
291330 delete param [' paramIdx' ]
292331 })
293332}
294- // ================================================================================= 실행 Action
333+ // ================================================================================= Run Action
295334const onClickRun = () => {
296- toast .success (' 실행 !' )
335+ toast .success (' Executed !' )
297336}
298337
299- // ================================================================================= 목록으로 이동
338+ // ================================================================================= Go to list
300339const onClickList = () => {
301340 router .push (' /web/workflow/list' )
302341}
303342
343+ // ================================================================================= Go back
344+ const onClickGoBack = () => {
345+ router .push (' /web/workflow/list' )
346+ }
347+
304348// ================================================================================= PipelineGenerator
305349const initWorkflowStageMappings = () => {
306350 workflowStageMappingsFormData .value = []
307351}
308352
309- // Template 스테이지 목록
353+ // Template stage list
310354const onClickCreateScript = async () => {
311355
312356 if (workflowInfoFormData .workflowName === ' ' ) {
313- toast .error (' 워크플로우 명을 입력해주세요 .' )
357+ toast .error (' Please enter workflow name .' )
314358 return
315359 }
316360
317361 else if (! workflowInfoFormData .workflowPurpose ) {
318- toast .error (' 목적을 선택해주세요 .' )
362+ toast .error (' Please select purpose .' )
319363 return
320364 }
321365 await _getTemplateStage (workflowInfoFormData .workflowName );
322366}
323367
324- // 기본 스크립트 시작 / 끝 표시를 위한 변수
368+ // Variable for marking default script start / end
325369const defaultScriptTagFlags = [" DEFAULT_START" , " DEFAULT_END" ]
326- // '스크립트 생성' 클릭시 validation 이 끝나고 기본 스크립트 생성
370+ // Generate default script after validation when 'Create Script' is clicked
327371const _getTemplateStage = async (workflowName : string ) => {
328372 try {
329373 initWorkflowStageMappings ()
330374
331375 const { data } = await getTemplateStage (workflowName )
332376 const list: Array <WorkflowStageMappings > = data || []
333377
334- // 기초 스크립트 Flag
335- // 스크립트 시작과 끝 표시를 위한 변수를 생성해줄때 넣어줄 데이터
378+ // Default script flag
379+ // Data to be included when creating variables to mark script start and end
336380 list .forEach ((item : WorkflowStageMappings , index : number ) => {
337381 item .isDefaultScript = true ;
338382 item .defaultScriptTag = defaultScriptTagFlags [index ];
0 commit comments