diff --git a/client/src/components/apps/form.vue b/client/src/components/apps/form.vue index fba28b1d..ebb67032 100644 --- a/client/src/components/apps/form.vue +++ b/client/src/components/apps/form.vue @@ -679,7 +679,11 @@ mdi-plus - + + + + + @@ -1170,6 +1174,7 @@ export default defineComponent({ advanced: false, panel: [0], valid: false, + envFile: [], buildpacks: [] as { text: string, value: Buildpack }[], buildpack: { run: { @@ -1973,6 +1978,34 @@ export default defineComponent({ } } }, + handleFileInput() { + for (let i = 0; i < this.envFile.length; i++) { + const file = this.envFile[i]; + const reader = new FileReader(); + reader.onload = () => { + const text = reader.result; + this.parseEnvFile(text); + }; + reader.readAsText(file); + } + + // clear file input + this.envFile = []; + }, + + + parseEnvFile(text: any) { + const lines = text.split('\n'); + for (const line of lines) { + const [name, value] = line.split('='); + // check if name isn't commented out + if (name && !name.startsWith('#') && value) { + if (!this.envvars.some(envvar => envvar.name === name.trim())) { + this.envvars.push({ name: name.trim(), value: value.trim() }); + } + } + } + }, addVolumeLine() { this.extraVolumes.push({ name: 'example-volume', diff --git a/client/src/components/pipelines/form.vue b/client/src/components/pipelines/form.vue index 371d3afa..8eea872d 100644 --- a/client/src/components/pipelines/form.vue +++ b/client/src/components/pipelines/form.vue @@ -332,6 +332,7 @@ export default defineComponent({ (v: any) => !!v || 'Name is required', (v: any) => v.length <= 60 || 'Name must be less than 60 characters', (v: any) => /^[a-z0-9][a-z0-9-]*$/.test(v) || 'Allowed characters : [a-z0-9-]', + (v: any) => v !== 'new' || 'Name cannot be "new"', ], domainRules: [ (v: any) => v.length <= 253 || 'Name must be less than 253 characters',