2
2
<div class =" tile is-ancestor" >
3
3
<div class =" tile is-vertical" >
4
4
<div class =" tile is-parent" >
5
- <a class =" button is-primary" @click =" startPipeline(pipelineID) " style =" margin-right : 10px ;" >
5
+ <a class =" button is-primary" @click =" checkPipelineArgs " style =" margin-right : 10px ;" >
6
6
<span class =" icon" >
7
7
<i class =" fa fa-play-circle" ></i >
8
8
</span >
@@ -120,7 +120,8 @@ export default {
120
120
},
121
121
arrows: {to: true }
122
122
}
123
- }
123
+ },
124
+ pipeline: null
124
125
}
125
126
},
126
127
@@ -183,6 +184,7 @@ export default {
183
184
this .drawPipelineDetail (pipeline .data , pipelineRun .data )
184
185
}
185
186
this .runsRows = pipelineRuns .data
187
+ this .pipeline = pipeline .data
186
188
}.bind (this )))
187
189
.catch ((error ) => {
188
190
this .$store .commit (' clearIntervals' )
@@ -201,6 +203,7 @@ export default {
201
203
if (pipelineRuns .data ) {
202
204
this .runsRows = pipelineRuns .data
203
205
}
206
+ this .pipeline = pipeline .data
204
207
}.bind (this )))
205
208
.catch ((error ) => {
206
209
this .$store .commit (' clearIntervals' )
@@ -355,13 +358,27 @@ export default {
355
358
this .$router .push ({path: ' /pipeline/log' , query: { pipelineid: this .pipelineID , runid: this .runID }})
356
359
},
357
360
358
- startPipeline (pipelineid ) {
361
+ checkPipelineArgs () {
362
+ // check if this pipeline has args
363
+ for (let x = 0 , y = this .pipeline .jobs .length ; x < y; x++ ) {
364
+ if (this .pipeline .jobs [x].args && this .pipeline .jobs [x].args .type !== ' vault' ) {
365
+ // we found args. Redirect user to params view.
366
+ this .$router .push ({path: ' /pipeline/params' , query: { pipelineid: this .pipeline .id }})
367
+ return
368
+ }
369
+ }
370
+
371
+ // No args. Just start pipeline.
372
+ this .startPipeline ()
373
+ },
374
+
375
+ startPipeline () {
359
376
// Send start request
360
377
this .$http
361
- .post (' /api/v1/pipeline/' + pipelineid + ' /start' )
378
+ .post (' /api/v1/pipeline/' + this . pipeline . id + ' /start' )
362
379
.then (response => {
363
380
if (response .data ) {
364
- this .$router .push ({path: ' /pipeline/detail' , query: { pipelineid: pipelineid , runid: response .data .id }})
381
+ this .$router .push ({path: ' /pipeline/detail' , query: { pipelineid: this . pipeline . id , runid: response .data .id }})
365
382
}
366
383
})
367
384
.catch ((error ) => {
@@ -370,7 +387,6 @@ export default {
370
387
})
371
388
}
372
389
}
373
-
374
390
}
375
391
</script >
376
392
0 commit comments