Skip to content

Commit cd9af4a

Browse files
authored
Merge pull request #71 from kubero-dev/release/v1.6.0
Release/v1.6.0
2 parents b490ec5 + 281ba30 commit cd9af4a

File tree

14 files changed

+481
-42
lines changed

14 files changed

+481
-42
lines changed

client/src/components/apps/new.vue

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,89 @@
366366
</v-col>
367367
</v-row>
368368

369+
<v-divider class="ma-5"></v-divider>
370+
<!-- EXTRAVOLUMES -->
371+
<h4 class="text-uppercase">Volumes</h4>
372+
<div v-for="volume in extraVolumes" v-bind:key="volume.id">
373+
<v-row>
374+
<v-col
375+
cols="12"
376+
md="3"
377+
>
378+
<v-text-field
379+
v-model="volume.name"
380+
label="name"
381+
:readonly="app!='new'"
382+
></v-text-field>
383+
</v-col>
384+
<v-col
385+
cols="12"
386+
md="2"
387+
>
388+
<v-text-field
389+
v-model="volume.size"
390+
label="size"
391+
:readonly="app!='new'"
392+
></v-text-field>
393+
</v-col>
394+
<v-col
395+
cols="12"
396+
md="1"
397+
>
398+
<v-btn
399+
elevation="2"
400+
icon
401+
small
402+
@click="removeVolumeLine(volume.name)"
403+
>
404+
<v-icon dark >
405+
mdi-minus
406+
</v-icon>
407+
</v-btn>
408+
</v-col>
409+
</v-row>
410+
411+
<v-row>
412+
<v-col
413+
cols="12"
414+
md="3"
415+
>
416+
<v-select
417+
v-model="volume.storageClass"
418+
:items="storageclasses"
419+
label="Storage Class"
420+
:readonly="app!='new'"
421+
></v-select>
422+
</v-col>
423+
<v-col
424+
cols="12"
425+
md="3"
426+
>
427+
<v-text-field
428+
v-model="volume.mountPath"
429+
label="Mount Path"
430+
></v-text-field>
431+
</v-col>
432+
</v-row>
433+
</div>
434+
435+
<v-row>
436+
<v-col
437+
cols="12"
438+
>
439+
<v-btn
440+
elevation="2"
441+
icon
442+
small
443+
@click="addVolumeLine()"
444+
>
445+
<v-icon dark >
446+
mdi-plus
447+
</v-icon>
448+
</v-btn>
449+
</v-col>
450+
</v-row>
451+
369452
<v-divider class="ma-5"></v-divider>
370453
<!-- CRONJOBS -->
371454
<h4 class="text-uppercase">Cronjobs</h4>
@@ -615,6 +698,24 @@ export default {
615698
},
616699
*/
617700
],
701+
storageclasses : [
702+
/*
703+
'standard',
704+
'standard-fast',
705+
*/
706+
],
707+
extraVolumes: [
708+
/*
709+
{
710+
name: 'example-volume',
711+
emptyDir: false,
712+
storageClass: 'standard',
713+
size: '1Gi',
714+
accessMode: ['ReadWriteOnce']
715+
mountPath: '/example/path',
716+
},
717+
*/
718+
],
618719
addons: [
619720
/*
620721
{
@@ -660,6 +761,7 @@ export default {
660761
}
661762
},
662763
mounted() {
764+
this.loadStorageClasses();
663765
this.loadPipeline();
664766
this.loadPodsizeList();
665767
this.loadApp(); // this may lead into a race condition with the buildpacks loaded in loadPipeline
@@ -703,6 +805,13 @@ export default {
703805
704806
});
705807
},
808+
loadStorageClasses() {
809+
axios.get('/api/config/storageclasses').then(response => {
810+
for (let i = 0; i < response.data.length; i++) {
811+
this.storageclasses.push(response.data[i].name);
812+
}
813+
});
814+
},
706815
loadBranches() {
707816
708817
// encode string to base64 (for ssh url)
@@ -786,6 +895,7 @@ export default {
786895
this.autodeploy = response.data.spec.autodeploy;
787896
this.domain = response.data.spec.domain;
788897
this.envvars = response.data.spec.envVars;
898+
this.extraVolumes = response.data.spec.extraVolumes;
789899
this.containerPort = response.data.spec.image.containerPort;
790900
this.podsize = response.data.spec.podsize;
791901
this.autoscale = response.data.spec.autoscale;
@@ -838,6 +948,7 @@ export default {
838948
targetMemoryUtilizationPercentage : 80,
839949
},
840950
},
951+
extraVolumes: this.extraVolumes,
841952
cronjobs: this.cronjobFormat(this.cronjobs),
842953
addons: this.addons,
843954
@@ -899,6 +1010,7 @@ export default {
8991010
targetMemoryUtilizationPercentage : 80,
9001011
},
9011012
},
1013+
extraVolumes: this.extraVolumes,
9021014
cronjobs: this.cronjobFormat(this.cronjobs),
9031015
addons: this.addons,
9041016
})
@@ -924,6 +1036,25 @@ export default {
9241036
}
9251037
}
9261038
},
1039+
addVolumeLine() {
1040+
this.extraVolumes.push({
1041+
name: 'example-volume',
1042+
emptyDir: false,
1043+
storageClass: 'standard',
1044+
size: '1Gi',
1045+
accessModes: [
1046+
'ReadWriteOnce',
1047+
],
1048+
mountPath: '/example/path',
1049+
});
1050+
},
1051+
removeVolumeLine(index) {
1052+
for (let i = 0; i < this.extraVolumes.length; i++) {
1053+
if (this.extraVolumes[i].name === index) {
1054+
this.extraVolumes.splice(i, 1);
1055+
}
1056+
}
1057+
},
9271058
addCronjobLine() {
9281059
this.cronjobs.push({
9291060
name: 'hello world',

client/src/components/pipelines/list.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,27 @@
5858
<v-btn
5959
elevation="2"
6060
fab
61+
small
62+
class="ma-2"
63+
color="grey lighten-2"
6164
@click="deletePipeline(item.name)"
6265
>
6366
<v-icon dark>
6467
mdi-delete
6568
</v-icon>
6669
</v-btn>
70+
<v-btn
71+
elevation="2"
72+
fab
73+
small
74+
class="ma-2"
75+
color="grey lighten-2"
76+
:href="'#/pipeline/'+item.name"
77+
>
78+
<v-icon dark>
79+
mdi-pencil
80+
</v-icon>
81+
</v-btn>
6782
</v-col>
6883

6984
</v-row>
@@ -112,6 +127,9 @@ export default {
112127
console.log(error);
113128
});
114129
},
130+
editPipeline(app) {
131+
this.$router.push({ name: 'Edit Pipeline', params: { name: app } });
132+
},
115133
},
116134
}
117135
</script>

client/src/components/pipelines/new.vue

Lines changed: 74 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
:rules="nameRules"
2222
:counter="60"
2323
label="Pipeline name *"
24+
:disabled="!newPipeline"
2425
required
2526
></v-text-field>
2627
</v-col>
@@ -43,12 +44,12 @@
4344
md="8"
4445
>
4546
<v-tabs icons-and-text v-model="repotab" color="#8560A9" @change="loadRepository">
46-
<v-tab href="#github" :disabled="this.repositoriesList.github == false">Github <v-icon>mdi-github</v-icon> </v-tab>
47-
<v-tab href="#gitea" :disabled="this.repositoriesList.gitea == false">Gitea <v-icon class="gitea"></v-icon></v-tab>
48-
<v-tab href="#gitlab" :disabled="this.repositoriesList.gitlab == false">Gitlab <v-icon>mdi-gitlab</v-icon></v-tab>
47+
<v-tab href="#github" :disabled="this.repositoriesList.github == false || !newPipeline">Github <v-icon>mdi-github</v-icon> </v-tab>
48+
<v-tab href="#gitea" :disabled="this.repositoriesList.gitea == false || !newPipeline">Gitea <v-icon class="gitea"></v-icon></v-tab>
49+
<v-tab href="#gitlab" :disabled="this.repositoriesList.gitlab == false || !newPipeline">Gitlab <v-icon>mdi-gitlab</v-icon></v-tab>
4950
<!--<v-tab href="#onedev" disabled>oneDev <v-icon class="onedev"></v-icon></v-tab>-->
50-
<v-tab href="#gogs" :disabled="this.repositoriesList.gogs == false">Gogs <v-icon class="gogs"></v-icon></v-tab>
51-
<v-tab href="#bitbucket" :disabled="this.repositoriesList.bitbucket == false">Bitbucket <v-icon>mdi-bitbucket</v-icon></v-tab>
51+
<v-tab href="#gogs" :disabled="this.repositoriesList.gogs == false || !newPipeline">Gogs <v-icon class="gogs"></v-icon></v-tab>
52+
<v-tab href="#bitbucket" :disabled="this.repositoriesList.bitbucket == false || !newPipeline">Bitbucket <v-icon>mdi-bitbucket</v-icon></v-tab>
5253
</v-tabs>
5354
</v-col>
5455
</v-row>
@@ -64,7 +65,7 @@
6465
:counter="60"
6566
:items="gitrepoItems"
6667
label="Repository *"
67-
:disabled="repository_status.connected"
68+
:disabled="repository_status.connected || !newPipeline"
6869
required
6970
></v-combobox>
7071
</v-col>
@@ -160,12 +161,22 @@
160161
>
161162
<v-btn
162163
color="primary"
164+
v-if="newPipeline"
163165
elevation="2"
164-
@click="saveForm()"
166+
@click="createPipeline()"
165167
:disabled="!valid
166168
|| !gitrepo
167169
|| !buildpack"
168-
>Sumbit</v-btn>
170+
>Create</v-btn>
171+
<v-btn
172+
color="primary"
173+
v-if="!newPipeline"
174+
elevation="2"
175+
@click="updatePipeline()"
176+
:disabled="!valid
177+
|| !gitrepo
178+
|| !buildpack"
179+
>Update</v-btn>
169180
</v-col>
170181
</v-row>
171182
</v-container>
@@ -175,7 +186,15 @@
175186
<script>
176187
import axios from "axios";
177188
export default {
189+
props: {
190+
pipeline: {
191+
type: String,
192+
default: "new"
193+
}
194+
},
178195
data: () => ({
196+
newPipeline: true,
197+
resourceVersion: undefined,
179198
repotab: 'github', //selected tab
180199
buildpack: undefined,
181200
buildpackList: [],
@@ -270,6 +289,7 @@ export default {
270289
this.listRepositories();
271290
this.listBuildpacks();
272291
this.loadRepository();
292+
this.loadPipeline();
273293
},
274294
methods: {
275295
updateBuildpack(buildpack) {
@@ -412,7 +432,29 @@ export default {
412432
this.repository_status.statusTxt = "Failed to connect to repository API";
413433
});
414434
},
415-
saveForm() {
435+
loadPipeline() {
436+
if (this.pipeline !== 'new') {
437+
axios.get(`/api/pipelines/${this.pipeline}`)
438+
.then(response => {
439+
this.newPipeline = false;
440+
const p = response.data;
441+
442+
this.resourceVersion = p.resourceVersion;
443+
this.pipelineName = p.name;
444+
this.domain = p.domain;
445+
this.gitrepo = p.git.repository.ssh_url;
446+
this.phases = p.phases;
447+
this.reviewapps = p.reviewapps;
448+
this.git = p.git;
449+
this.dockerimage = p.dockerimage;
450+
this.deploymentstrategy = p.deploymentstrategy;
451+
this.buildpack = p.buildpack;
452+
}).catch(error => {
453+
console.log(error);
454+
});
455+
}
456+
},
457+
createPipeline() {
416458
417459
// fake the minimal requirements to create a pipeline if the repo is not connectedd
418460
if (!this.repository_status.connected) {
@@ -448,7 +490,29 @@ export default {
448490
.catch(error => {
449491
console.log(error);
450492
});
451-
}
493+
},
494+
updatePipeline() {
495+
axios.put(`/api/pipelines/${this.pipeline}`, {
496+
resourceVersion: this.resourceVersion,
497+
pipelineName: this.pipelineName,
498+
domain: this.domain,
499+
gitrepo: this.gitrepo,
500+
phases: this.phases,
501+
reviewapps: this.reviewapps,
502+
git: this.git,
503+
dockerimage: '',
504+
deploymentstrategy: "git",
505+
buildpack: this.buildpack,
506+
})
507+
.then(response => {
508+
this.pipelineName = '';
509+
console.log(response);
510+
this.$router.push({path: '/'});
511+
})
512+
.catch(error => {
513+
console.log(error);
514+
});
515+
},
452516
},
453517
}
454518
</script>

client/src/router/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ export default new VueRouter({
3333
component: AppsNew,
3434
props: true
3535
},
36+
{
37+
path: "/pipeline/:pipeline",
38+
name: "Edit Pipeline",
39+
component: PipelineNew,
40+
props: true
41+
},
3642
{
3743
path: "/pipeline/:pipeline/:phase/:app",
3844
name: "Edit App",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kubero",
3-
"version": "1.5.3",
3+
"version": "1.6.0",
44
"description": "Heroku clone on Kubernetes",
55
"main": "dist/index.js",
66
"author": "Gianni Carafa",

0 commit comments

Comments
 (0)