comparison 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
comparison
equal deleted inserted replaced
1713:d4702b0ff15f 1714:1b25e7a3a92e
29 const SCHEDULES = { 29 const SCHEDULES = {
30 DAILY: "daily", 30 DAILY: "daily",
31 MONTHLY: "monthly" 31 MONTHLY: "monthly"
32 }; 32 };
33 33
34 const initializeCurrentSchedule = () => {
35 return {
36 importType: null,
37 schedule: null,
38 import_: null,
39 importSource: null,
40 eMailNotification: false,
41 scheduled: false,
42 easyCron: true,
43 cronMode: "",
44 minutes: null,
45 month: null,
46 hour: null,
47 day: null,
48 dayOfMonth: null,
49 simple: null,
50 url: null,
51 insecure: false
52 };
53 };
54
34 // initial state 55 // initial state
35 const init = () => { 56 const init = () => {
36 return { 57 return {
37 imports: [], 58 imports: [],
38 staging: [], 59 staging: [],
39 schedules: [], 60 schedules: [],
40 importScheduleDetailVisible: false, 61 importScheduleDetailVisible: false,
62 currentSchedule: initializeCurrentSchedule(),
41 importToReview: null 63 importToReview: null
42 }; 64 };
43 }; 65 };
44 66
45 const imports = { 67 const imports = {
46 init, 68 init,
47 namespaced: true, 69 namespaced: true,
48 state: init(), 70 state: init(),
49 mutations: { 71 mutations: {
72 clearCurrentSchedule: state => {
73 state.currentSchedule = initializeCurrentSchedule();
74 },
50 deleteSchedule: (state, index) => { 75 deleteSchedule: (state, index) => {
51 state.schedules.splice(index, 1); 76 state.schedules.splice(index, 1);
52 }, 77 },
53 setImportScheduleDetailInvisible: state => { 78 setImportScheduleDetailInvisible: state => {
54 state.importScheduleDetailVisible = false; 79 state.importScheduleDetailVisible = false;