1
1
<template >
2
2
<div class =" tile is-ancestor" >
3
- <div class =" tile is-vertical is-5" >
4
- <div class =" tile" >
5
- <div class =" tile is-parent is-vertical" >
6
- <article class =" tile is-child notification content-article" >
7
- <div class =" content" >
8
- <label class =" label" >Copy the link of your <strong >git repo</strong > here.</label >
9
- <p class =" control has-icons-left" >
10
- <input class =" input is-medium input-bar" v-focus v-model.lazy =" gitURL" type =" text" placeholder =" Link to git repo ..." >
11
- <span class =" icon is-small is-left" >
12
- <i class =" fa fa-git" ></i >
13
- </span >
14
- <span style =" color : red ;" v-if =" gitNeedAuth" >You are not authorized. Invalid username and/or password!</span >
15
- <span style =" color : red ;" v-if =" gitInvalidURL" >Invalid link to git repo provided!</span >
16
- <div v-if =" gitBranches.length > 0" >
17
- <span >Branch:</span >
18
- <div class =" select is-fullwidth" >
19
- <select v-model =" gitBranchSelected" >
20
- <option v-for =" branch in gitBranches" :key =" branch" :value =" branch" >{{ branch }}</option >
21
- </select >
22
- </div >
23
- </div >
24
- </p >
25
- <p class =" control" >
26
- <a class =" button is-primary" v-on:click =" showCredentialsModal" >
27
- <span class =" icon" >
28
- <i class =" fa fa-certificate" ></i >
29
- </span >
30
- <span >Add credentials</span >
31
- </a >
32
- </p >
33
- <hr class =" dotted-line" >
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
- <p class =" control has-icons-left" >
36
- <input class =" input is-medium input-bar" v-model =" pipelineName" type =" text" placeholder =" Pipeline name ..." >
37
- <span class =" icon is-small is-left" >
38
- <i class =" fa fa-book" ></i >
39
- </span >
40
- </p >
41
- <hr class =" dotted-line" >
42
- <a class =" button is-primary" v-on:click =" createPipeline" >
43
- <span class =" icon" >
44
- <i class =" fa fa-plus" ></i >
45
- </span >
46
- <span >Create Pipeline</span >
47
- </a >
3
+ <div class =" tile is-vertical is-parent is-5" >
4
+ <article class =" tile is-child notification content-article" >
5
+ <div class =" content" >
6
+ <label class =" label" >Copy the link of your <strong >git repo</strong > here.</label >
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 ..." >
9
+ <span class =" icon is-small is-left" >
10
+ <i class =" fa fa-git" ></i >
11
+ </span >
12
+ <span v-if =" gitSuccess" class =" icon is-small is-right is-blue" >
13
+ <i class =" fa fa-check" ></i >
14
+ </span >
15
+ </p >
16
+ <span style =" color : red " v-if =" gitErrorMsg" >Cannot access git repo: {{ gitErrorMsg }}</span >
17
+ <div v-if =" gitBranches.length > 0" >
18
+ <span >Branch:</span >
19
+ <div class =" select is-fullwidth" >
20
+ <select v-model =" gitBranchSelected" >
21
+ <option v-for =" branch in gitBranches" :key =" branch" :value =" branch" >{{ branch }}</option >
22
+ </select >
48
23
</div >
49
- </article >
24
+ </div >
25
+ <p class =" control" style =" padding-top : 10px ;" >
26
+ <a class =" button is-primary" v-on:click =" showCredentialsModal" >
27
+ <span class =" icon" >
28
+ <i class =" fa fa-certificate" ></i >
29
+ </span >
30
+ <span >Add credentials</span >
31
+ </a >
32
+ </p >
33
+ <hr class =" dotted-line" >
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
+ <p class =" control has-icons-left" >
36
+ <input class =" input is-medium input-bar" v-model =" pipelineName" type =" text" placeholder =" Pipeline name ..." >
37
+ <span class =" icon is-small is-left" >
38
+ <i class =" fa fa-book" ></i >
39
+ </span >
40
+ </p >
41
+ <hr class =" dotted-line" >
42
+ <a class =" button is-primary" v-on:click =" createPipeline" v-bind:class =" { 'is-loading': createPipelineStatus }" >
43
+ <span class =" icon" >
44
+ <i class =" fa fa-plus" ></i >
45
+ </span >
46
+ <span >Create Pipeline</span >
47
+ </a >
50
48
</div >
49
+ </article >
50
+
51
+ <div class =" tile is-child" >
52
+ <article class =" tile is-child notification content-article" >
53
+ <div class =" content" >
54
+ Current Status: Some-Status-Here
55
+ <progress-bar :type =" 'info'" :size =" 'medium'" :value =" 45" :max =" 100" :show-label =" true" ></progress-bar >
56
+ </div >
57
+ </article >
58
+ </div >
59
+ </div >
60
+
61
+ <div class =" tile is-vertical is-parent is-3" >
62
+ <div class =" tile is-child" >
63
+ <article class =" tile is-child notification content-article" >
64
+ <div class =" content" >
65
+ Plugin Types here *TODO*
66
+ </div >
67
+ </article >
51
68
</div >
52
69
</div >
53
70
112
129
<script >
113
130
import { Modal } from ' vue-bulma-modal'
114
131
import { Collapse , Item as CollapseItem } from ' vue-bulma-collapse'
132
+ import ProgressBar from ' vue-bulma-progress-bar'
115
133
116
134
export default {
117
135
118
136
data () {
119
137
return {
120
138
gitURL: ' ' ,
121
- gitNeedAuth : false ,
122
- gitInvalidURL : false ,
139
+ gitErrorMsg : ' ' ,
140
+ gitSuccess : false ,
123
141
gitCredentialsModal: false ,
124
142
gitUsername: ' ' ,
125
143
gitPassword: ' ' ,
@@ -128,14 +146,16 @@ export default {
128
146
keyPassword: ' ' ,
129
147
gitBranches: [],
130
148
gitBranchSelected: ' ' ,
131
- pipelineName: ' '
149
+ pipelineName: ' ' ,
150
+ createPipelineStatus: ' 20'
132
151
}
133
152
},
134
153
135
154
components: {
136
155
Modal,
137
156
Collapse,
138
- CollapseItem
157
+ CollapseItem,
158
+ ProgressBar
139
159
},
140
160
141
161
watch: {
@@ -150,6 +170,11 @@ export default {
150
170
return
151
171
}
152
172
173
+ // Reset last fetches
174
+ this .gitBranches = []
175
+ this .gitBranchSelected = ' '
176
+ this .gitSuccess = false
177
+
153
178
var gitrepo = {
154
179
giturl: this .gitURL ,
155
180
gituser: this .gitUsername ,
@@ -164,8 +189,8 @@ export default {
164
189
this .$http .post (' /api/v1/pipelines/gitlsremote' , gitrepo)
165
190
.then ((response ) => {
166
191
// Reset error message before
167
- this .gitNeedAuth = false
168
- this .gitInvalidURL = false
192
+ this .gitErrorMsg = ' '
193
+ this .gitSuccess = true
169
194
170
195
// Get branches and set to master if available
171
196
this .gitBranches = response .data .gitbranches
@@ -179,19 +204,10 @@ export default {
179
204
if (! this .gitBranchSelected && this .gitBranches .length > 0 ) {
180
205
this .gitBranchSelected = this .gitBranches [0 ]
181
206
}
182
-
183
- console .log (response .data )
184
207
})
185
208
.catch ((error ) => {
186
- // Need authentication
187
- if (error .response && error .response .status === 403 ) {
188
- this .gitNeedAuth = true
189
- this .gitInvalidURL = false
190
- } else if (error .response && error .response .status === 400 ) {
191
- this .gitInvalidURL = true
192
- this .gitNeedAuth = false
193
- }
194
- console .log (error .response .data )
209
+ // Add error message
210
+ this .gitErrorMsg = error .response .data
195
211
})
196
212
},
197
213
@@ -213,13 +229,15 @@ export default {
213
229
gitrepo: gitrepo
214
230
}
215
231
232
+ this .createPipelineStatus = ' 20'
216
233
this .$http .post (' /api/v1/pipelines/create' , pipeline)
217
234
.then ((response ) => {
218
- console .log (" Pipeline successful created!" )
235
+ console .log (' Pipeline successful created!' )
219
236
})
220
237
.catch ((error ) => {
221
- console .log (error)
238
+ console .log (error . response . data )
222
239
})
240
+ this .createPipelineStatus = ' 100'
223
241
},
224
242
225
243
close () {
0 commit comments