5
5
<div class =" content" >
6
6
<label class =" label" >Copy the link of your <strong >git repo</strong > here.</label >
7
7
<p class =" control has-icons-left" v-bind:class =" { 'has-icons-right': gitSuccess }" >
8
- <input class =" input is-medium input-bar" v-focus v-model.lazy =" gitURL " type =" text" placeholder =" Link to git repo ..." >
8
+ <input class =" input is-medium input-bar" v-focus v-model.lazy =" giturl " type =" text" placeholder =" Link to git repo ..." >
9
9
<span class =" icon is-small is-left" >
10
10
<i class =" fa fa-git" ></i >
11
11
</span >
17
17
<div v-if =" gitBranches.length > 0" >
18
18
<span >Branch:</span >
19
19
<div class =" select is-fullwidth" >
20
- <select v-model =" gitBranchSelected " >
20
+ <select v-model =" pipeline.gitrepo.selectedbranch " >
21
21
<option v-for =" branch in gitBranches" :key =" branch" :value =" branch" >{{ branch }}</option >
22
22
</select >
23
23
</div >
33
33
<hr class =" dotted-line" >
34
34
<label class =" label" >Type the name of your pipeline. You can put your pipelines into folders by defining a path. For example <strong >MyFolder/MyAwesomePipeline</strong >.</label >
35
35
<p class =" control has-icons-left" >
36
- <input class =" input is-medium input-bar" v-model =" pipelineName " type =" text" placeholder =" Pipeline name ..." >
36
+ <input class =" input is-medium input-bar" v-model =" pipeline.pipelinename " type =" text" placeholder =" Pipeline name ..." >
37
37
<span class =" icon is-small is-left" >
38
38
<i class =" fa fa-book" ></i >
39
39
</span >
40
40
</p >
41
41
<hr class =" dotted-line" >
42
- <a class =" button is-primary" v-on:click =" createPipeline" v-bind:class =" { 'is-loading': createPipelineStatus }" >
42
+ <a class =" button is-primary is-disabled " v-on:click =" createPipeline" v-bind:class =" { 'is-loading': createPipelineStatus }" >
43
43
<span class =" icon" >
44
44
<i class =" fa fa-plus" ></i >
45
45
</span >
48
48
</div >
49
49
</article >
50
50
51
- <div class =" tile is-child" >
51
+ <div class =" tile is-child" v-if = " createPipelineStatus " >
52
52
<article class =" tile is-child notification content-article" >
53
53
<div class =" content" >
54
54
Current Status: Some-Status-Here
55
- <progress-bar :type =" 'info'" :size =" 'medium'" :value =" 45 " :max =" 100" :show-label =" true" ></progress-bar >
55
+ <progress-bar :type =" 'info'" :size =" 'medium'" :value =" createPipelineStatus " :max =" 100" :show-label =" true" ></progress-bar >
56
56
</div >
57
57
</article >
58
58
</div >
77
77
<div class =" credentials-modal-content" >
78
78
<label class =" label" style =" text-align : left ;" >Add credentials for basic authentication:</label >
79
79
<p class =" control has-icons-left" style =" padding-bottom : 5px ;" >
80
- <input class =" input is-medium input-bar" v-focus type =" text" v-model =" gitUsername " placeholder =" Username" >
80
+ <input class =" input is-medium input-bar" v-focus type =" text" v-model =" pipeline.gitrepo.gituser " placeholder =" Username" >
81
81
<span class =" icon is-small is-left" >
82
82
<i class =" fa fa-user-circle" ></i >
83
83
</span >
84
84
</p >
85
85
<p class =" control has-icons-left" >
86
- <input class =" input is-medium input-bar" type =" password" v-model =" gitPassword " placeholder =" Password" >
86
+ <input class =" input is-medium input-bar" type =" password" v-model =" pipeline.gitrepo.password " placeholder =" Password" >
87
87
<span class =" icon is-small is-left" >
88
88
<i class =" fa fa-lock" ></i >
89
89
</span >
94
94
<label class =" label" style =" text-align : left ;" >Instead of using basic authentication, provide a pem encoded private key.</label >
95
95
<div class =" block credentials-modal-content" >
96
96
<p class =" control" >
97
- <textarea class =" textarea input-bar" v-model =" privateKey " ></textarea >
97
+ <textarea class =" textarea input-bar" v-model =" pipeline.gitrepo.privatekey.key " ></textarea >
98
98
</p >
99
99
</div >
100
100
<h2 ><span >Additional:</span ></h2 >
101
101
<p class =" control has-icons-left" style =" padding-bottom : 5px ;" >
102
- <input class =" input is-medium input-bar" v-focus type =" text" v-model =" keyUsername " placeholder =" Username" >
102
+ <input class =" input is-medium input-bar" v-focus type =" text" v-model =" pipeline.gitrepo.privatekey.username " placeholder =" Username" >
103
103
<span class =" icon is-small is-left" >
104
104
<i class =" fa fa-user-circle" ></i >
105
105
</span >
106
106
</p >
107
107
<p class =" control has-icons-left" >
108
- <input class =" input is-medium input-bar" type =" password" v-model =" keyPassword " placeholder =" Password" >
108
+ <input class =" input is-medium input-bar" type =" password" v-model =" pipeline.gitrepo.privatekey.password " placeholder =" Password" >
109
109
<span class =" icon is-small is-left" >
110
110
<i class =" fa fa-lock" ></i >
111
111
</span >
@@ -135,19 +135,26 @@ export default {
135
135
136
136
data () {
137
137
return {
138
- gitURL: ' ' ,
139
138
gitErrorMsg: ' ' ,
140
139
gitSuccess: false ,
141
140
gitCredentialsModal: false ,
142
- gitUsername: ' ' ,
143
- gitPassword: ' ' ,
144
- privateKey: ' ' ,
145
- keyUsername: ' ' ,
146
- keyPassword: ' ' ,
147
141
gitBranches: [],
148
- gitBranchSelected: ' ' ,
149
- pipelineName: ' ' ,
150
- createPipelineStatus: ' 20'
142
+ createPipelineStatus: 0 ,
143
+ giturl: ' ' ,
144
+ pipeline: {
145
+ pipelinename: ' ' ,
146
+ gitrepo: {
147
+ giturl: ' ' ,
148
+ gituser: ' ' ,
149
+ gitpassword: ' ' ,
150
+ selectedbranch: ' ' ,
151
+ privatekey: {
152
+ key: ' ' ,
153
+ username: ' ' ,
154
+ password: ' '
155
+ }
156
+ }
157
+ }
151
158
}
152
159
},
153
160
@@ -159,34 +166,26 @@ export default {
159
166
},
160
167
161
168
watch: {
162
- gitURL : function () {
169
+ giturl : function () {
163
170
this .checkGitRepo ()
164
171
}
165
172
},
166
173
167
174
methods: {
168
175
checkGitRepo () {
169
- if (this .gitURL === ' ' ) {
176
+ if (this .giturl === ' ' ) {
170
177
return
171
178
}
172
179
180
+ // copy giturl into our struct
181
+ this .pipeline .gitrepo .giturl = this .giturl
182
+
173
183
// Reset last fetches
174
184
this .gitBranches = []
175
- this .gitBranchSelected = ' '
185
+ this .pipeline . gitrepo . selectedbranch = ' '
176
186
this .gitSuccess = false
177
187
178
- var gitrepo = {
179
- giturl: this .gitURL ,
180
- gituser: this .gitUsername ,
181
- gitpassword: this .gitPassword ,
182
- privatekey: {
183
- key: this .privateKey ,
184
- username: this .keyUsername ,
185
- password: this .keyPassword
186
- }
187
- }
188
-
189
- this .$http .post (' /api/v1/pipelines/gitlsremote' , gitrepo)
188
+ this .$http .post (' /api/v1/pipelines/gitlsremote' , this .pipeline .gitrepo )
190
189
.then ((response ) => {
191
190
// Reset error message before
192
191
this .gitErrorMsg = ' '
@@ -196,13 +195,13 @@ export default {
196
195
this .gitBranches = response .data .gitbranches
197
196
for (var i = 0 ; i < this .gitBranches .length ; i++ ) {
198
197
if (this .gitBranches [i] === ' refs/heads/master' ) {
199
- this .gitBranchSelected = this .gitBranches [i]
198
+ this .pipeline . gitrepo . selectedbranch = this .gitBranches [i]
200
199
}
201
200
}
202
201
203
202
// if we cannot find master
204
- if (! this .gitBranchSelected && this .gitBranches .length > 0 ) {
205
- this .gitBranchSelected = this .gitBranches [0 ]
203
+ if (! this .pipeline . gitrepo . selectedbranch && this .gitBranches .length > 0 ) {
204
+ this .pipeline . gitrepo . selectedbranch = this .gitBranches [0 ]
206
205
}
207
206
})
208
207
.catch ((error ) => {
@@ -212,32 +211,24 @@ export default {
212
211
},
213
212
214
213
createPipeline () {
215
- var gitrepo = {
216
- giturl: this .gitURL ,
217
- gituser: this .gitUsername ,
218
- gitpassword: this .gitPassword ,
219
- selectedbranch: this .gitBranchSelected ,
220
- privatekey: {
221
- key: this .privateKey ,
222
- username: this .keyUsername ,
223
- password: this .keyPassword
224
- }
225
- }
214
+ // let's start with 10% for the progress bar
215
+ this .createPipelineStatus = 10
226
216
227
- var pipeline = {
228
- pipelinename: this .pipelineName ,
229
- gitrepo: gitrepo
230
- }
217
+ // copy giturl into our struct
218
+ this .pipeline .gitrepo .giturl = this .giturl
231
219
232
- this . createPipelineStatus = ' 20 '
233
- this .$http .post (' /api/v1/pipelines/create' , pipeline)
220
+ // Checkout git repo
221
+ this .$http .post (' /api/v1/pipelines/create' , this . pipeline )
234
222
.then ((response ) => {
235
223
console .log (' Pipeline successful created!' )
224
+ this .createPipelineStatus = 30
236
225
})
237
226
.catch ((error ) => {
238
227
console .log (error .response .data )
239
228
})
240
- this .createPipelineStatus = ' 100'
229
+
230
+ // finish
231
+ this .createPipelineStatus = 100
241
232
},
242
233
243
234
close () {
@@ -248,11 +239,11 @@ export default {
248
239
249
240
cancel () {
250
241
// cancel means reset all stuff
251
- this .gitUsername = ' '
252
- this .gitPassword = ' '
253
- this .privateKey = ' '
254
- this .keyUsername = ' '
255
- this .keyPassword = ' '
242
+ this .pipeline . gitrepo . gituser = ' '
243
+ this .pipeline . gitrepo . gitpassword = ' '
244
+ this .pipeline . gitrepo . privatekey . key = ' '
245
+ this .pipeline . gitrepo . privatekey . username = ' '
246
+ this .pipeline . gitrepo . privatekey . password = ' '
256
247
257
248
this .close ()
258
249
},
0 commit comments