Mercurial > gemma
diff client/src/store/importschedule.js @ 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 | cc3ad4aa9b2f |
children | 5a898da60b87 |
line wrap: on
line diff
--- a/client/src/store/importschedule.js Tue Jan 29 14:15:34 2019 +0100 +++ b/client/src/store/importschedule.js Tue Jan 29 14:46:57 2019 +0100 @@ -29,6 +29,17 @@ DISTANCEMARKSVIRTUAL: "distancemarksvirtual" }; +const KINDIMPORTTYPE = { + bn: "bottleneck", + fa: "fairwayavailability", + gm: "gaugemeasurement", + wx: "waterwayaxis", + wa: "waterwayarea", + fd: "fairwaydimension", + wg: "waterwaygauge", + dmv: "distancemarksvirtual" +}; + const IMPORTTYPEKIND = { bottleneck: "bn", fairwayavailability: "fa", @@ -40,17 +51,6 @@ distancemarksvirtual: "dmv" }; -const KINDIMPORTTYPE = { - bn: "bottleneck", - fa: "fairwayavailability", - gm: "gaugemeasurement", - wx: "waterwayaxis", - wa: "waterwayarea", - fd: "fairwaydimension", - wg: "waterwaygauge", - dmv: "distancemarksvirtual" -}; - const initializeCurrentSchedule = () => { return { id: null, @@ -111,8 +111,9 @@ state.schedules = schedules; }, unmarshallCurrentSchedule: (state, payload) => { - const { kind, id, cron, url, attributes } = payload; - const eMailNotification = payload["send-email"]; + const { kind, config, id } = payload; + const eMailNotification = config["send-email"]; + const { cron, url } = config; Vue.set(state.currentSchedule, "import_", KINDIMPORTTYPE[kind]); Vue.set(state.currentSchedule, "id", id); if (cron) { @@ -126,48 +127,46 @@ if (url) { Vue.set(state.currentSchedule, "url", url); } - if (attributes) { - let { insecure, username, password, los, depth } = attributes; - let sortBy = attributes["sort-by"]; - let minWidth = attributes["min-width"]; - let maxWidth = attributes["max-width"]; - let sourceOrganization = attributes["source-organization"]; - 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); - } - if (username) { - Vue.set(state.currentSchedule, "username", username); - } - if (password) { - Vue.set(state.currentSchedule, "password", password); - } - if (los) { - Vue.set(state.currentSchedule, "LOS", los); - } - if (minWidth) { - Vue.set(state.currentSchedule, "minWidth", minWidth); - } - if (maxWidth) { - Vue.set(state.currentSchedule, "maxWidth", maxWidth); - } - if (depth) { - Vue.set(state.currentSchedule, "depth", depth); - } - if (sourceOrganization) { - Vue.set( - state.currentSchedule, - "sourceOrganization", - sourceOrganization - ); - } + let { insecure, username, password, los, depth } = config; + let sortBy = config["sort-by"]; + let minWidth = config["min-width"]; + let maxWidth = config["max-width"]; + let sourceOrganization = config["source-organization"]; + const featureType = config["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); + } + if (username) { + Vue.set(state.currentSchedule, "username", username); + } + if (password) { + Vue.set(state.currentSchedule, "password", password); + } + if (los) { + Vue.set(state.currentSchedule, "LOS", los); + } + if (minWidth) { + Vue.set(state.currentSchedule, "minWidth", minWidth); + } + if (maxWidth) { + Vue.set(state.currentSchedule, "maxWidth", maxWidth); + } + if (depth) { + Vue.set(state.currentSchedule, "depth", depth); + } + if (sourceOrganization) { + Vue.set( + state.currentSchedule, + "sourceOrganization", + sourceOrganization + ); } } },