Mercurial > gemma
changeset 1734:549337e6facd
importschedule: POC edit functionality
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 09 Jan 2019 15:41:29 +0100 |
parents | 4cf4d31eae0a |
children | eeb291c3f9b0 |
files | client/src/components/importschedule/Importscheduledetail.vue client/src/store/imports.js |
diffstat | 2 files changed, 39 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ <input :disabled="!scheduled" class="form-control" - :value="cronString" + v-model="cronString" type="text" /> </div> @@ -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);
--- 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);