Mercurial > gemma
comparison client/src/components/importschedule/Importscheduledetail.vue @ 1731:8dd7452929ca
WIP: edit scheduled imports
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 09 Jan 2019 13:57:36 +0100 |
parents | 647195199dc8 |
children | 549337e6facd |
comparison
equal
deleted
inserted
replaced
1730:7c54babe10f7 | 1731:8dd7452929ca |
---|---|
361 import_: null, | 361 import_: null, |
362 importSource: null, | 362 importSource: null, |
363 eMailNotification: false, | 363 eMailNotification: false, |
364 scheduled: false, | 364 scheduled: false, |
365 easyCron: true, | 365 easyCron: true, |
366 cronstring: null, | |
366 cronMode: "", | 367 cronMode: "", |
367 minutes: null, | 368 minutes: null, |
368 month: null, | 369 month: null, |
369 hour: null, | 370 hour: null, |
370 day: null, | 371 day: null, |
418 }, | 419 }, |
419 mounted() { | 420 mounted() { |
420 this.initialize(); | 421 this.initialize(); |
421 }, | 422 }, |
422 watch: { | 423 watch: { |
423 currentSchedule() { | 424 importScheduleDetailVisible() { |
424 this.initialize(); | 425 this.initialize(); |
425 }, | 426 }, |
426 cronString() { | 427 cronString() { |
427 if (this.isWeekly(this.cronString)) { | 428 if (this.isWeekly(this.cronString)) { |
428 this.simple = "weekly"; | 429 this.simple = "weekly"; |
547 if (cron) data["cron"] = cron; | 548 if (cron) data["cron"] = cron; |
548 break; | 549 break; |
549 default: | 550 default: |
550 break; | 551 break; |
551 } | 552 } |
552 this.$store | 553 if (!this.id) { |
553 .dispatch("imports/saveCurrentSchedule", data) | 554 this.$store |
554 .then(response => { | 555 .dispatch("imports/saveCurrentSchedule", data) |
555 const { id } = response.data; | 556 .then(response => { |
556 displayInfo({ | 557 const { id } = response.data; |
557 title: this.$gettext("Import"), | 558 displayInfo({ |
558 message: this.$gettext("Saved import: #") + id | 559 title: this.$gettext("Import"), |
559 }); | 560 message: this.$gettext("Saved import: #") + id |
560 this.closeDetailview(); | 561 }); |
561 this.$store.dispatch("imports/loadSchedules").catch(error => { | 562 this.closeDetailview(); |
563 this.$store.dispatch("imports/loadSchedules").catch(error => { | |
564 const { status, data } = error.response; | |
565 displayError({ | |
566 title: this.gettext("Backend Error"), | |
567 message: `${status}: ${data.message || data}` | |
568 }); | |
569 }); | |
570 }) | |
571 .catch(error => { | |
562 const { status, data } = error.response; | 572 const { status, data } = error.response; |
563 displayError({ | 573 displayError({ |
564 title: this.gettext("Backend Error"), | 574 title: this.$gettext("Backend Error"), |
565 message: `${status}: ${data.message || data}` | 575 message: `${status}: ${data.message || data}` |
566 }); | 576 }); |
567 }); | 577 }); |
568 }) | 578 } else { |
569 .catch(error => { | 579 this.$store |
570 const { status, data } = error.response; | 580 .dispatch("imports/updateCurrentSchedule", { |
571 displayError({ | 581 data: data, |
572 title: this.$gettext("Backend Error"), | 582 id: this.id |
573 message: `${status}: ${data.message || data}` | 583 }) |
584 .then(response => { | |
585 const { id } = response.data; | |
586 displayInfo({ | |
587 title: this.$gettext("Import"), | |
588 message: this.$gettext("update import: #") + id | |
589 }); | |
590 this.closeDetailview(); | |
591 this.$store.dispatch("imports/loadSchedules").catch(error => { | |
592 const { status, data } = error.response; | |
593 displayError({ | |
594 title: this.gettext("Backend Error"), | |
595 message: `${status}: ${data.message || data}` | |
596 }); | |
597 }); | |
598 }) | |
599 .catch(error => { | |
600 const { status, data } = error.response; | |
601 displayError({ | |
602 title: this.$gettext("Backend Error"), | |
603 message: `${status}: ${data.message || data}` | |
604 }); | |
574 }); | 605 }); |
575 }); | 606 } |
576 }, | 607 }, |
577 closeDetailview() { | 608 closeDetailview() { |
578 this.$store.commit("imports/clearCurrentSchedule"); | 609 this.$store.commit("imports/clearCurrentSchedule"); |
579 this.$store.commit("imports/setImportScheduleDetailInvisible"); | 610 this.$store.commit("imports/setImportScheduleDetailInvisible"); |
580 } | 611 } |