Mercurial > gemma
diff client/src/components/importschedule/Importscheduledetail.vue @ 2061:4a0d4e50768d unify_imports
frontend adapted to new backend
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 29 Jan 2019 14:46:57 +0100 |
parents | 2f6cadcb3558 |
children | a47943348865 |
line wrap: on
line diff
--- a/client/src/components/importschedule/Importscheduledetail.vue Tue Jan 29 14:15:34 2019 +0100 +++ b/client/src/components/importschedule/Importscheduledetail.vue Tue Jan 29 14:46:57 2019 +0100 @@ -630,7 +630,10 @@ } this.triggerActive = false; this.$store - .dispatch("importschedule/triggerImport", { type: this.import_, data }) + .dispatch("importschedule/triggerImport", { + type: IMPORTTYPEKIND[this.import_], + data + }) .then(response => { const { id } = response.data; displayInfo({ @@ -650,10 +653,6 @@ }); }, save() { - const addAttribute = (data, attribute) => { - if (!data["attributes"]) data.attributes = {}; - data["attributes"] = { ...data["attributes"], ...attribute }; - }; if (!this.import_) return; let cron = this.cronString; if (this.easyCron) { @@ -661,31 +660,29 @@ if (this.simple === "monthly") cron = "0 0 0 1 * *"; } let data = {}; + let config = {}; + data["kind"] = IMPORTTYPEKIND[this.import_]; + if (this.isURLRequired) { if (!this.url) return; - data["url"] = this.url; - addAttribute(data, { - insecure: this.insecure + "" - }); + config["url"] = this.url; + config["insecure"] = this.insecure; } if (this.isSortbyRequired) { if (!this.sortBy) return; - addAttribute(data, { - "sort-by": this.sortBy - }); + config["sort-by"] = this.sortBy; } if (this.isFeatureTypeRequired) { if (!this.featureType) return; - addAttribute(data, { - "feature-type": this.featureType - }); + config["feature-type"] = this.featureType; } if (this.isCredentialsRequired) { if (!this.username || !this.password) return; - addAttribute(data, { + config = { + ...config, username: this.username, password: this.password - }); + }; } if (this.import_ == this.$options.IMPORTTYPES.FAIRWAYDIMENSION) { if ( @@ -696,18 +693,14 @@ !this.sourceOrganization ) return; - const values = { - los: this.LOS + "", - depth: this.depth + "" - }; - values["min-width"] = this.minWidth + ""; - values["max-width"] = this.maxWidth + ""; - values["source-organization"] = this.sourceOrganization; - addAttribute(data, values); + config = { ...config, los: this.LOS, depth: this.depth }; + config["min-width"] = this.minWidth; + config["max-width"] = this.maxWidth; + config["source-organization"] = this.sourceOrganization; } - if (this.scheduled) data["cron"] = cron; - data["kind"] = IMPORTTYPEKIND[this.import_]; - data["send-email"] = this.eMailNotification; + if (this.scheduled) config["cron"] = cron; + config["send-email"] = this.eMailNotification; + data["config"] = config; if (!this.id) { this.$store .dispatch("importschedule/saveCurrentSchedule", data)