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' ,
0 commit comments