comparison client/src/components/importschedule/Importscheduledetail.vue @ 2344:a5b87a695469

client: imports: fixed cron string The inputs are now correctly converted to a cron string and the cron string coming from the backend for an existing schedule is now correctly parsed back to the individual inputs for editing a schedule.
author Markus Kottlaender <markus@intevation.de>
date Wed, 20 Feb 2019 10:21:16 +0100
parents b87211f595ae
children b9c317236ebc
comparison
equal deleted inserted replaced
2343:33d2ef9f9e5d 2344:a5b87a695469
613 setSourceOrganization(value) { 613 setSourceOrganization(value) {
614 this.sourceOrganization = value; 614 this.sourceOrganization = value;
615 }, 615 },
616 calcCronString() { 616 calcCronString() {
617 let getValue = value => { 617 let getValue = value => {
618 return this[value] ? this[value] : "*"; 618 return this[value] !== null ? this[value] : "*";
619 }; 619 };
620 if (this.cronMode === "15minutes") return "0 */15 * * * *"; 620
621 const min = getValue("minutes"); 621 const min = getValue("minutes");
622 const h = getValue("hour"); 622 const h = getValue("hour");
623 const dm = getValue("dayOfMonth"); 623 const dm = getValue("dayOfMonth");
624 const m = getValue("month"); 624 const m = getValue("month");
625 const wd = getValue("day"); 625 const wd = getValue("day");
626 return `0 ${min} ${h} ${dm} ${m} ${wd}`; 626
627 if (this.cronMode === "15minutes") return "0 */15 * * * *";
628 if (this.cronMode === "hour") return `0 ${min} * * * *`;
629 if (this.cronMode === "day") return `0 ${min} ${h} * * *`;
630 if (this.cronMode === "week") return `0 ${min} ${h} * * ${wd}`;
631 if (this.cronMode === "month") return `0 ${min} ${h} ${dm} * *`;
632 if (this.cronMode === "year") return `0 ${min} ${h} ${dm} ${m} *`;
633 return this.cronString;
627 }, 634 },
628 validateBottleneckfields() { 635 validateBottleneckfields() {
629 return !!this.url; 636 return !!this.url;
630 }, 637 },
631 initialize() { 638 initialize() {
662 }, 669 },
663 isMonthly(cron) { 670 isMonthly(cron) {
664 return /0 \d{1,2} \d{1,2} \d{1,2} \* \*/.test(cron); 671 return /0 \d{1,2} \d{1,2} \d{1,2} \* \*/.test(cron);
665 }, 672 },
666 clearInputs() { 673 clearInputs() {
667 this.minutes = null; 674 this.minutes = this.currentSchedule.minutes;
668 this.month = null; 675 this.month = this.currentSchedule.month;
669 this.hour = null; 676 this.hour = this.currentSchedule.hour;
670 this.day = null; 677 this.day = this.currentSchedule.day;
671 this.dayOfMonth = null; 678 this.dayOfMonth = this.currentSchedule.dayOfMonth;
672 }, 679 },
673 triggerFileUpload() { 680 triggerFileUpload() {
674 if (!this.uploadFile) return; 681 if (!this.uploadFile) return;
675 let formData = new FormData(); 682 let formData = new FormData();
676 let routeParam = ""; 683 let routeParam = "";