Mercurial > gemma
changeset 2353:b9c317236ebc
client: imports: disabled save/trigger buttons if form is invalid/not filled
The validation itself still needs to be improved.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Wed, 20 Feb 2019 12:11:54 +0100 |
parents | 0d7b51930028 |
children | eebe0a8ddc82 |
files | client/src/components/importschedule/Importscheduledetail.vue |
diffstat | 1 files changed, 25 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importschedule/Importscheduledetail.vue Wed Feb 20 12:09:19 2019 +0100 +++ b/client/src/components/importschedule/Importscheduledetail.vue Wed Feb 20 12:11:54 2019 +0100 @@ -396,6 +396,7 @@ </div> <button v-if="!directImport" + :disabled="!isValid" type="submit" class="shadow-sm btn btn-info submit-button" > @@ -405,7 +406,7 @@ @click="triggerManualImport" type="button" class="shadow-sm btn btn-outline-info trigger" - :disabled="!triggerActive" + :disabled="!triggerActive || !isValid" > <font-awesome-icon class="fa-fw mr-2" @@ -574,6 +575,28 @@ default: return false; } + }, + isValid() { + if (!this.import_) return false; + if (this.directImport && !this.uploadFile) return false; + else if (!this.directImport) { + if (this.isURLRequired && !this.url) return false; + if (this.isSortbyRequired && !this.sortBy) return false; + if (this.isFeatureTypeRequired && !this.featureType) return false; + if (this.isCredentialsRequired && (!this.username || !this.password)) + return false; + if (this.import_ == this.$options.IMPORTTYPES.FAIRWAYDIMENSION) { + if ( + !this.LOS || + !this.minWidth || + !this.maxWidth || + !this.depth || + !this.sourceOrganization + ) + return false; + } + } + return true; } }, methods: { @@ -663,6 +686,7 @@ this.maxWidth = this.currentSchedule.maxWidth; this.depth = this.currentSchedule.depth; this.sourceOrganization = this.currentSchedule.sourceOrganization; + this.directImport = false; }, isWeekly(cron) { return /0 \d{1,2} \d{1,2} \* \* \d{1}/.test(cron);