changeset 4910:ab184888d58b fairway-marks-import

wiring of import endpoints for fairwaymarks
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 10 Feb 2020 17:07:18 +0100
parents 6f244b5eb716
children bcb8b69e4358
files client/src/components/importconfiguration/ScheduledImports.vue client/src/components/importconfiguration/types/Fairwaymarks.vue client/src/store/importschedule.js
diffstat 3 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/importconfiguration/ScheduledImports.vue	Mon Feb 10 14:56:43 2020 +0100
+++ b/client/src/components/importconfiguration/ScheduledImports.vue	Mon Feb 10 17:07:18 2020 +0100
@@ -927,9 +927,13 @@
       if (this.trys) data["trys"] = Number(this.trys);
       data["send-email"] = this.eMailNotification;
       this.triggerActive = false;
+      const type =
+        this.import_ === "fairwaymarks"
+          ? `fm_${this.selectedMark.toLowerCase()}`
+          : IMPORTTYPEKIND[this.import_];
       this.$store
         .dispatch("importschedule/triggerImport", {
-          type: IMPORTTYPEKIND[this.import_],
+          type: type,
           data
         })
         .then(response => {
@@ -963,8 +967,10 @@
       }
       let data = {};
       let config = {};
-      data["kind"] = IMPORTTYPEKIND[this.import_];
-
+      data["kind"] =
+        this.import_ === "fairwaymarks"
+          ? `fm_${this.selectedMark.toLowerCase()}`
+          : IMPORTTYPEKIND[this.import_];
       if (this.isURLRequired) {
         if (!this.url) return;
         config["url"] = this.url;
--- a/client/src/components/importconfiguration/types/Fairwaymarks.vue	Mon Feb 10 14:56:43 2020 +0100
+++ b/client/src/components/importconfiguration/types/Fairwaymarks.vue	Mon Feb 10 17:07:18 2020 +0100
@@ -121,14 +121,12 @@
   FAIRWAYMARKS: {
     BCNISD: "Beacon, isolated danger (MARITIME/Hydro feature)",
     BCNLAT: "Beacon, lateral (MARITIME/Hydro feature)",
-    bcnlat: "Beacon, lateral (IENC feature)",
     BOYCAR: "Buoy, cardinal (MARITIME/Hydro feature)",
     BOYISD: "Buoy, isolated danger (MARITIME/Hydro feature)",
     BOYLAT: "Buoy, lateral (MARITIME/Hydro feature)",
     BOYSAW: "Buoy, safe water (MARITIME/Hydro feature)",
     BOYSPP: "Buoy, special purpose/general (MARITIME/Hydro feature)",
     DAYMAR: "Daymark (MARITIME/Hydro feature)",
-    daymar: "Daymark (IENC feature)",
     LIGHTS: "Light (MARITIME/Hydro feature)",
     RTPBCN: "Radar transponder beacon (MARITIME/Hydro feature)",
     TOPMAR: "Topmark (MARITIME/Hydro feature)",
--- a/client/src/store/importschedule.js	Mon Feb 10 14:56:43 2020 +0100
+++ b/client/src/store/importschedule.js	Mon Feb 10 17:07:18 2020 +0100
@@ -60,6 +60,21 @@
   distancemarksashore: "dma"
 };
 
+const FAIRWAYMARKKINDS = {
+  fm_bcnisd: "BCNISD",
+  fm_bcnlat: "BCNLAT",
+  fm_boycar: "BOYCAR",
+  fm_boyisd: "BOYISD",
+  fm_boylat: "BOYLAT",
+  fm_boysaw: "BOYSAW",
+  fm_boyspp: "BOYSPP",
+  fm_daymar: "DAYMAR",
+  fm_lights: "LIGHTS",
+  fm_rtpbcn: "RTPBCN",
+  fm_topmar: "TOPMAR",
+  fm_notmrk: "notmrk"
+};
+
 const initializeCurrentSchedule = () => {
   return {
     id: null,
@@ -142,7 +157,13 @@
       const { kind, config, id } = payload;
       const eMailNotification = config["send-email"];
       const { cron, url } = config;
-      Vue.set(state.currentSchedule, "importType", KINDIMPORTTYPE[kind]);
+      if (FAIRWAYMARKKINDS[kind]) {
+        Vue.set(state.currentSchedule, "importType", "fairwaymarks");
+        Vue.set(state.selectedMark), FAIRWAYMARKKINDS[kind];
+      } else {
+        Vue.set(state.currentSchedule, "importType", KINDIMPORTTYPE[kind]);
+      }
+
       Vue.set(state.currentSchedule, "id", id);
       Vue.set(state.currentSchedule, "trys", config["trys"]);
       Vue.set(state.currentSchedule, "waitRetry", config["wait-retry"]);