diff client/src/store/imports.js @ 1714:1b25e7a3a92e

importschedule: manage initial data from detailsview via store
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 08 Jan 2019 16:58:00 +0100
parents aec17976528e
children 79a18eb1672b
line wrap: on
line diff
--- a/client/src/store/imports.js	Tue Jan 08 16:07:25 2019 +0100
+++ b/client/src/store/imports.js	Tue Jan 08 16:58:00 2019 +0100
@@ -31,6 +31,27 @@
   MONTHLY: "monthly"
 };
 
+const initializeCurrentSchedule = () => {
+  return {
+    importType: null,
+    schedule: null,
+    import_: null,
+    importSource: null,
+    eMailNotification: false,
+    scheduled: false,
+    easyCron: true,
+    cronMode: "",
+    minutes: null,
+    month: null,
+    hour: null,
+    day: null,
+    dayOfMonth: null,
+    simple: null,
+    url: null,
+    insecure: false
+  };
+};
+
 // initial state
 const init = () => {
   return {
@@ -38,6 +59,7 @@
     staging: [],
     schedules: [],
     importScheduleDetailVisible: false,
+    currentSchedule: initializeCurrentSchedule(),
     importToReview: null
   };
 };
@@ -47,6 +69,9 @@
   namespaced: true,
   state: init(),
   mutations: {
+    clearCurrentSchedule: state => {
+      state.currentSchedule = initializeCurrentSchedule();
+    },
     deleteSchedule: (state, index) => {
       state.schedules.splice(index, 1);
     },