# HG changeset patch # User Thomas Junk # Date 1547044889 -3600 # Node ID 549337e6facda58047dbce98317a8ef26a45d4d8 # Parent 4cf4d31eae0afc99fff81f6df7b904b66da41270 importschedule: POC edit functionality diff -r 4cf4d31eae0a -r 549337e6facd client/src/components/importschedule/Importscheduledetail.vue --- a/client/src/components/importschedule/Importscheduledetail.vue Wed Jan 09 15:19:04 2019 +0100 +++ b/client/src/components/importschedule/Importscheduledetail.vue Wed Jan 09 15:41:29 2019 +0100 @@ -304,7 +304,7 @@ @@ -363,7 +363,6 @@ eMailNotification: false, scheduled: false, easyCron: true, - cronstring: null, cronMode: "", minutes: null, month: null, @@ -373,7 +372,8 @@ simple: null, url: null, insecure: false, - triggerActive: true + triggerActive: true, + cronString: "* * * * " }; }, IMPORTTYPES: IMPORTTYPES, @@ -421,6 +421,24 @@ this.initialize(); }, watch: { + cronMode() { + this.cronString = this.calcCronString(); + }, + minutes() { + this.cronString = this.calcCronString(); + }, + hour() { + this.cronString = this.calcCronString(); + }, + month() { + this.cronString = this.calcCronString(); + }, + day() { + this.cronString = this.calcCronString(); + }, + dayOfMonth() { + this.cronString = this.calcCronString(); + }, importScheduleDetailVisible() { this.initialize(); }, @@ -444,26 +462,24 @@ if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) return true; return false; }, - cronString: { - get() { - let getValue = value => { - return this[value] ? this[value] : "*"; - }; - if (this.cronMode === "15minutes") return "*/15 * * * *"; - const min = getValue("minutes"); - const h = getValue("hour"); - const dm = getValue("dayOfMonth"); - const m = getValue("month"); - const wd = getValue("day"); - return `${min} ${h} ${dm} ${m} ${wd}`; - } - }, fixedSource() { if (this.import_ === this.$options.IMPORTTYPES.BOTTLENECK) return true; return false; } }, methods: { + calcCronString() { + let getValue = value => { + return this[value] ? this[value] : "*"; + }; + if (this.cronMode === "15minutes") return "*/15 * * * *"; + const min = getValue("minutes"); + const h = getValue("hour"); + const dm = getValue("dayOfMonth"); + const m = getValue("month"); + const wd = getValue("day"); + return `${min} ${h} ${dm} ${m} ${wd}`; + }, validateBottleneckfields() { return !!this.url; }, @@ -471,6 +487,7 @@ this.id = this.currentSchedule.id; this.importType = this.currentSchedule.importType; this.schedule = this.currentSchedule.schedule; + this.scheduled = this.currentSchedule.scheduled; this.import_ = this.currentSchedule.import_; this.importSource = this.currentSchedule.importSource; this.eMailNotification = this.currentSchedule.eMailNotification; @@ -484,6 +501,7 @@ this.simple = this.currentSchedule.simple; this.url = this.currentSchedule.url; this.insecure = this.currentSchedule.insecure; + this.cronString = this.currentSchedule.cronString; }, isWeekly(cron) { return /\d{1,2} \d{1,2} \* \* \d{1}/.test(cron); diff -r 4cf4d31eae0a -r 549337e6facd client/src/store/imports.js --- a/client/src/store/imports.js Wed Jan 09 15:19:04 2019 +0100 +++ b/client/src/store/imports.js Wed Jan 09 15:41:29 2019 +0100 @@ -56,7 +56,7 @@ eMailNotification: false, scheduled: false, easyCron: true, - cronstring: null, + cronString: null, cronMode: "", minutes: null, month: null, @@ -129,7 +129,9 @@ Vue.set(state.currentSchedule, "import_", KINDIMPORTTYPE[kind]); Vue.set(state.currentSchedule, "id", id); if (cron) { - Vue.set(state.currentSchedule, "cronstring", cron); + Vue.set(state.currentSchedule, "scheduled", true); + Vue.set(state.currentSchedule, "easyCron", false); + Vue.set(state.currentSchedule, "cronString", cron); } if (eMailNotification) { Vue.set(state.currentSchedule, "eMailNotification", eMailNotification);