47
47
</p >
48
48
<span style =" color : red " v-if =" pipelineErrorMsg" >Pipeline Name incorrect: {{ pipelineErrorMsg }}</span >
49
49
<hr class =" dotted-line" >
50
- <a class =" button is-primary" v-on:click =" createPipeline" v-bind:class =" { 'is-loading': createPipelineStatus, 'is- disabled': !gitSuccess || !pipelineNameSuccess }" >
50
+ <a class =" button is-primary" v-on:click =" createPipeline" v-bind:class =" { 'is-disabled': !gitSuccess || !pipelineNameSuccess }" >
51
51
<span class =" icon" >
52
52
<i class =" fa fa-plus" ></i >
53
53
</span >
85
85
86
86
<div class =" tile is-parent is-8" >
87
87
<article class =" tile is-child notification content-article box" >
88
- <p class =" subtitle" >Created pipelines </p >
88
+ <p class =" subtitle" >Pipelines history </p >
89
89
<div class =" content" >
90
90
<div class =" table-responsive" >
91
91
<table class =" table" >
97
97
<th class =" th" >Creation date</th >
98
98
</tr >
99
99
</thead >
100
- <tfoot >
101
- <tr >
102
- <th class =" th" >Name</th >
103
- <th class =" th" >Status</th >
104
- <th class =" th" >Type</th >
105
- <th class =" th" >Creation date</th >
106
- </tr >
107
- </tfoot >
108
100
<tbody >
109
- <tr class =" blink" >
101
+ <tr class =" blink" v-for = " pipeline in createdPipelines " :key = " pipeline " >
110
102
<td >
111
- Pipeline Name
103
+ {{ pipeline.pipelinename }}
112
104
</td >
113
105
<td class =" th" >
114
- <progress-bar :type =" 'info'" :size =" 'small'" :value =" 80" :max =" 100" :show-label =" false" ></progress-bar >
106
+ <div v-if =" pipeline.status < 100" >
107
+ <progress-bar :type =" 'info'" :size =" 'small'" :value =" pipeline.status" :max =" 100" :show-label =" false" ></progress-bar >
108
+ </div >
109
+ <div v-if =" pipeline.status === 100" >
110
+ <span style =" color : green ;" >Completed</span >
111
+ </div >
115
112
</td >
116
113
<td >
117
- Pipeline Type
114
+ {{ pipeline.pipelinetype }}
118
115
</td >
119
116
<td >
120
- Pipeline Date
117
+ {{ pipeline.creationdate }}
121
118
</td >
122
119
</tr >
123
120
</tbody >
@@ -201,11 +198,11 @@ export default {
201
198
gitSuccess: false ,
202
199
gitCredentialsModal: false ,
203
200
gitBranches: [],
204
- createPipelineStatus: 0 ,
205
201
giturl: ' ' ,
206
202
pipelinename: ' ' ,
207
203
pipelineNameSuccess: false ,
208
204
pipelineErrorMsg: ' ' ,
205
+ createdPipelines: [],
209
206
pipeline: {
210
207
pipelinename: ' ' ,
211
208
pipelinetype: ' golang' ,
@@ -240,6 +237,9 @@ export default {
240
237
duration: 500 ,
241
238
arrow: true
242
239
})
240
+
241
+ // created pipelines history
242
+ this .fetchData ()
243
243
},
244
244
245
245
watch: {
@@ -248,10 +248,22 @@ export default {
248
248
},
249
249
pipelinename : function () {
250
250
this .checkPipelineNameAvailable ()
251
- }
251
+ },
252
+ ' $route' : ' fetchData'
252
253
},
253
254
254
255
methods: {
256
+ fetchData () {
257
+ this .$http
258
+ .get (' /api/v1/pipelines/created' )
259
+ .then (response => {
260
+ this .createdPipelines = response .data
261
+ })
262
+ .catch (error => {
263
+ console .log (error .response .data )
264
+ })
265
+ },
266
+
255
267
checkGitRepo () {
256
268
if (this .giturl === ' ' ) {
257
269
return
@@ -300,7 +312,7 @@ export default {
300
312
301
313
// Request for availability
302
314
this .$http
303
- .post (' /api/v1/pipelines/nameavailable ' , this .pipeline )
315
+ .post (' /api/v1/pipelines/name ' , this .pipeline )
304
316
.then (response => {
305
317
// pipeline name valid and available
306
318
this .pipelineErrorMsg = ' '
@@ -313,26 +325,20 @@ export default {
313
325
},
314
326
315
327
createPipeline () {
316
- // let's start with 10% for the progress bar
317
- this .createPipelineStatus = 10
318
-
319
328
// copy giturl into our struct and pipeline name
320
329
this .pipeline .gitrepo .giturl = this .giturl
321
330
this .pipeline .pipelinename = this .pipelinename
322
331
323
- // Checkout git repo
332
+ // Start the create pipeline process in the backend
324
333
this .$http
325
334
.post (' /api/v1/pipelines/create' , this .pipeline )
326
335
.then (response => {
327
- console . log ( ' Pipeline successful created! ' )
328
- this .createPipelineStatus = 30
336
+ // Run fetchData to see the pipeline in our history table
337
+ this .fetchData ()
329
338
})
330
339
.catch (error => {
331
340
console .log (error .response .data )
332
341
})
333
-
334
- // finish
335
- this .createPipelineStatus = 100
336
342
},
337
343
338
344
close () {
0 commit comments