# HG changeset patch # User Thomas Junk # Date 1547127190 -3600 # Node ID 90178f4ce2553458423ad96d98def3f4206dee84 # Parent 09f51f2b3b0d82d82ee1e9deff7963678d016df9 import waterway axis diff -r 09f51f2b3b0d -r 90178f4ce255 client/src/components/importschedule/Importscheduledetail.vue --- a/client/src/components/importschedule/Importscheduledetail.vue Thu Jan 10 14:27:03 2019 +0100 +++ b/client/src/components/importschedule/Importscheduledetail.vue Thu Jan 10 14:33:10 2019 +0100 @@ -14,7 +14,7 @@
-
+
@@ -25,24 +25,30 @@ +
-
+
- Importtype + Email Notification
- +
+ +
@@ -55,7 +61,7 @@
-
+
Insecure @@ -89,24 +95,46 @@ >
-
-
- - Email Notification - -
-
- +
+
+
+
+ + Featuretype + +
+
+ +
+
+ Please enter a Featuretype +
+
+
+
+ + SortBy + +
+
+ +
+
+ Please enter SortBy +
+
@@ -373,13 +401,12 @@ url: null, insecure: false, triggerActive: true, - cronString: "* * * * " + cronString: "* * * * ", + featureType: null, + sortBy: null }; }, IMPORTTYPES: IMPORTTYPES, - IMPORTSOURCES: { - SOAP: "SOAP" - }, EVERY: app.$gettext("Every"), MINUTESPAST: app.$gettext("minutes past"), ON: app.$gettext("on"), @@ -449,18 +476,34 @@ if (this.isMonthly(this.cronString)) { this.simple = "monthly"; } - }, - import_() { - if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) { - this.importSource = this.$options.IMPORTSOURCES.SOAP; - } } }, computed: { ...mapState("imports", ["importScheduleDetailVisible", "currentSchedule"]), isURLRequired() { - if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) return true; - return false; + switch (this.import_) { + case this.$options.IMPORTTYPES.BOTTLENECK: + case this.$options.IMPORTTYPES.WATERWAYAXIS: + return true; + default: + return false; + } + }, + isFeatureTypeRequired() { + switch (this.import_) { + case this.$options.IMPORTTYPES.WATERWAYAXIS: + return true; + default: + return false; + } + }, + isSortbyRequired() { + switch (this.import_) { + case this.$options.IMPORTTYPES.WATERWAYAXIS: + return true; + default: + return false; + } }, fixedSource() { if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) return true; @@ -502,6 +545,8 @@ this.url = this.currentSchedule.url; this.insecure = this.currentSchedule.insecure; this.cronString = this.currentSchedule.cronString; + this.featureType = this.currentSchedule.featureType; + this.sortBy = this.currentSchedule.sortBy; }, isWeekly(cron) { return /0 \d{1,2} \d{1,2} \* \* \d{1}/.test(cron); @@ -520,11 +565,19 @@ if (!this.triggerActive) return; if (!this.import_) return; let data = {}; - if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) { + if (this.isURLRequired) { if (!this.url) return; data["url"] = this.url; data["insecure"] = this.insecure; } + if (this.isFeatureTypeRequired) { + if (!this.featureType) return; + data["feature-type"] = this.featureType; + } + if (this.isSortbyRequired) { + if (!this.sortBy) return; + data["sort-by"] = this.sortBy; + } this.triggerActive = false; this.$store .dispatch("imports/triggerImport", { type: this.import_, data }) @@ -547,27 +600,39 @@ }); }, save() { - let data = {}; + 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) { if (this.simple === "weekly") cron = "0 0 0 * * 0"; if (this.simple === "monthly") cron = "0 0 0 1 * *"; } - switch (this.import_) { - case this.$options.IMPORTTYPES.BOTTLENECK: - if (!this.validateBottleneckfields()) return; - data["url"] = this.url; - data["kind"] = IMPORTTYPEKIND[this.import_]; - data["send-email"] = this.eMailNotification; - data["attributes"] = { - insecure: this.insecure + "" - }; - if (this.scheduled) data["cron"] = cron; - break; - default: - break; + let data = {}; + if (this.isURLRequired) { + if (!this.url) return; + data["url"] = this.url; + addAttribute(data, { + insecure: this.insecure + "" + }); } + if (this.isSortbyRequired) { + if (!this.sortBy) return; + addAttribute(data, { + sortBy: this.sortBy + }); + } + if (this.isFeatureTypeRequired) { + if (!this.featureType) return; + addAttribute(data, { + "feature-type": this.featureType + }); + } + if (this.scheduled) data["cron"] = cron; + data["kind"] = IMPORTTYPEKIND[this.import_]; + data["send-email"] = this.eMailNotification; if (!this.id) { this.$store .dispatch("imports/saveCurrentSchedule", data) diff -r 09f51f2b3b0d -r 90178f4ce255 client/src/store/imports.js --- a/client/src/store/imports.js Thu Jan 10 14:27:03 2019 +0100 +++ b/client/src/store/imports.js Thu Jan 10 14:33:10 2019 +0100 @@ -24,7 +24,8 @@ }; const IMPORTTYPES = { - BOTTLENECK: "bottleneck" + BOTTLENECK: "bottleneck", + WATERWAYAXIS: "waterwayaxis" }; const SCHEDULES = { @@ -65,7 +66,9 @@ dayOfMonth: null, simple: null, url: null, - insecure: false + insecure: false, + featureType: null, + sortBy: null }; }; @@ -140,11 +143,18 @@ Vue.set(state.currentSchedule, "url", url); } if (attributes) { - let { insecure } = attributes; + let { insecure, sortBy } = attributes; + const featureType = attributes["feature-type"]; insecure = insecure == "true"; if (insecure) { Vue.set(state.currentSchedule, "insecure", insecure); } + if (featureType) { + Vue.set(state.currentSchedule, "featureType", featureType); + } + if (sortBy) { + Vue.set(state.currentSchedule, "sortBy", sortBy); + } } } },