Skip to content

Commit 0811994

Browse files
committed
Small improvements on ui design
1 parent 18e7802 commit 0811994

File tree

1 file changed

+52
-61
lines changed

1 file changed

+52
-61
lines changed

frontend/client/views/pipelines/create.vue

+52-61
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="content">
66
<label class="label">Copy the link of your <strong>git repo</strong> here.</label>
77
<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 ...">
99
<span class="icon is-small is-left">
1010
<i class="fa fa-git"></i>
1111
</span>
@@ -17,7 +17,7 @@
1717
<div v-if="gitBranches.length > 0">
1818
<span>Branch:</span>
1919
<div class="select is-fullwidth">
20-
<select v-model="gitBranchSelected">
20+
<select v-model="pipeline.gitrepo.selectedbranch">
2121
<option v-for="branch in gitBranches" :key="branch" :value="branch">{{ branch }}</option>
2222
</select>
2323
</div>
@@ -33,13 +33,13 @@
3333
<hr class="dotted-line">
3434
<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>
3535
<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 ...">
3737
<span class="icon is-small is-left">
3838
<i class="fa fa-book"></i>
3939
</span>
4040
</p>
4141
<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 }">
4343
<span class="icon">
4444
<i class="fa fa-plus"></i>
4545
</span>
@@ -48,11 +48,11 @@
4848
</div>
4949
</article>
5050

51-
<div class="tile is-child">
51+
<div class="tile is-child" v-if="createPipelineStatus">
5252
<article class="tile is-child notification content-article">
5353
<div class="content">
5454
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>
5656
</div>
5757
</article>
5858
</div>
@@ -77,13 +77,13 @@
7777
<div class="credentials-modal-content">
7878
<label class="label" style="text-align: left;">Add credentials for basic authentication:</label>
7979
<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">
8181
<span class="icon is-small is-left">
8282
<i class="fa fa-user-circle"></i>
8383
</span>
8484
</p>
8585
<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">
8787
<span class="icon is-small is-left">
8888
<i class="fa fa-lock"></i>
8989
</span>
@@ -94,18 +94,18 @@
9494
<label class="label" style="text-align: left;">Instead of using basic authentication, provide a pem encoded private key.</label>
9595
<div class="block credentials-modal-content">
9696
<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>
9898
</p>
9999
</div>
100100
<h2><span>Additional:</span></h2>
101101
<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">
103103
<span class="icon is-small is-left">
104104
<i class="fa fa-user-circle"></i>
105105
</span>
106106
</p>
107107
<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">
109109
<span class="icon is-small is-left">
110110
<i class="fa fa-lock"></i>
111111
</span>
@@ -135,19 +135,26 @@ export default {
135135
136136
data () {
137137
return {
138-
gitURL: '',
139138
gitErrorMsg: '',
140139
gitSuccess: false,
141140
gitCredentialsModal: false,
142-
gitUsername: '',
143-
gitPassword: '',
144-
privateKey: '',
145-
keyUsername: '',
146-
keyPassword: '',
147141
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+
}
151158
}
152159
},
153160
@@ -159,34 +166,26 @@ export default {
159166
},
160167
161168
watch: {
162-
gitURL: function () {
169+
giturl: function () {
163170
this.checkGitRepo()
164171
}
165172
},
166173
167174
methods: {
168175
checkGitRepo () {
169-
if (this.gitURL === '') {
176+
if (this.giturl === '') {
170177
return
171178
}
172179
180+
// copy giturl into our struct
181+
this.pipeline.gitrepo.giturl = this.giturl
182+
173183
// Reset last fetches
174184
this.gitBranches = []
175-
this.gitBranchSelected = ''
185+
this.pipeline.gitrepo.selectedbranch = ''
176186
this.gitSuccess = false
177187
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)
190189
.then((response) => {
191190
// Reset error message before
192191
this.gitErrorMsg = ''
@@ -196,13 +195,13 @@ export default {
196195
this.gitBranches = response.data.gitbranches
197196
for (var i = 0; i < this.gitBranches.length; i++) {
198197
if (this.gitBranches[i] === 'refs/heads/master') {
199-
this.gitBranchSelected = this.gitBranches[i]
198+
this.pipeline.gitrepo.selectedbranch = this.gitBranches[i]
200199
}
201200
}
202201
203202
// 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]
206205
}
207206
})
208207
.catch((error) => {
@@ -212,32 +211,24 @@ export default {
212211
},
213212
214213
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
226216
227-
var pipeline = {
228-
pipelinename: this.pipelineName,
229-
gitrepo: gitrepo
230-
}
217+
// copy giturl into our struct
218+
this.pipeline.gitrepo.giturl = this.giturl
231219
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)
234222
.then((response) => {
235223
console.log('Pipeline successful created!')
224+
this.createPipelineStatus = 30
236225
})
237226
.catch((error) => {
238227
console.log(error.response.data)
239228
})
240-
this.createPipelineStatus = '100'
229+
230+
// finish
231+
this.createPipelineStatus = 100
241232
},
242233
243234
close () {
@@ -248,11 +239,11 @@ export default {
248239
249240
cancel () {
250241
// 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 = ''
256247
257248
this.close()
258249
},

0 commit comments

Comments
 (0)