Mercurial > gemma
comparison client/src/components/importschedule/Importscheduledetail.vue @ 2061:4a0d4e50768d unify_imports
frontend adapted to new backend
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 29 Jan 2019 14:46:57 +0100 |
parents | 2f6cadcb3558 |
children | a47943348865 |
comparison
equal
deleted
inserted
replaced
2060:f9d13ce57893 | 2061:4a0d4e50768d |
---|---|
628 data["depth"] = this.depth * 1; | 628 data["depth"] = this.depth * 1; |
629 data["source-organization"] = this.sourceOrganization; | 629 data["source-organization"] = this.sourceOrganization; |
630 } | 630 } |
631 this.triggerActive = false; | 631 this.triggerActive = false; |
632 this.$store | 632 this.$store |
633 .dispatch("importschedule/triggerImport", { type: this.import_, data }) | 633 .dispatch("importschedule/triggerImport", { |
634 type: IMPORTTYPEKIND[this.import_], | |
635 data | |
636 }) | |
634 .then(response => { | 637 .then(response => { |
635 const { id } = response.data; | 638 const { id } = response.data; |
636 displayInfo({ | 639 displayInfo({ |
637 title: this.$gettext("Import"), | 640 title: this.$gettext("Import"), |
638 message: this.$gettext("Manually triggered import: #") + id | 641 message: this.$gettext("Manually triggered import: #") + id |
648 .finally(() => { | 651 .finally(() => { |
649 this.triggerActive = true; | 652 this.triggerActive = true; |
650 }); | 653 }); |
651 }, | 654 }, |
652 save() { | 655 save() { |
653 const addAttribute = (data, attribute) => { | |
654 if (!data["attributes"]) data.attributes = {}; | |
655 data["attributes"] = { ...data["attributes"], ...attribute }; | |
656 }; | |
657 if (!this.import_) return; | 656 if (!this.import_) return; |
658 let cron = this.cronString; | 657 let cron = this.cronString; |
659 if (this.easyCron) { | 658 if (this.easyCron) { |
660 if (this.simple === "weekly") cron = "0 0 0 * * 0"; | 659 if (this.simple === "weekly") cron = "0 0 0 * * 0"; |
661 if (this.simple === "monthly") cron = "0 0 0 1 * *"; | 660 if (this.simple === "monthly") cron = "0 0 0 1 * *"; |
662 } | 661 } |
663 let data = {}; | 662 let data = {}; |
663 let config = {}; | |
664 data["kind"] = IMPORTTYPEKIND[this.import_]; | |
665 | |
664 if (this.isURLRequired) { | 666 if (this.isURLRequired) { |
665 if (!this.url) return; | 667 if (!this.url) return; |
666 data["url"] = this.url; | 668 config["url"] = this.url; |
667 addAttribute(data, { | 669 config["insecure"] = this.insecure; |
668 insecure: this.insecure + "" | |
669 }); | |
670 } | 670 } |
671 if (this.isSortbyRequired) { | 671 if (this.isSortbyRequired) { |
672 if (!this.sortBy) return; | 672 if (!this.sortBy) return; |
673 addAttribute(data, { | 673 config["sort-by"] = this.sortBy; |
674 "sort-by": this.sortBy | |
675 }); | |
676 } | 674 } |
677 if (this.isFeatureTypeRequired) { | 675 if (this.isFeatureTypeRequired) { |
678 if (!this.featureType) return; | 676 if (!this.featureType) return; |
679 addAttribute(data, { | 677 config["feature-type"] = this.featureType; |
680 "feature-type": this.featureType | |
681 }); | |
682 } | 678 } |
683 if (this.isCredentialsRequired) { | 679 if (this.isCredentialsRequired) { |
684 if (!this.username || !this.password) return; | 680 if (!this.username || !this.password) return; |
685 addAttribute(data, { | 681 config = { |
682 ...config, | |
686 username: this.username, | 683 username: this.username, |
687 password: this.password | 684 password: this.password |
688 }); | 685 }; |
689 } | 686 } |
690 if (this.import_ == this.$options.IMPORTTYPES.FAIRWAYDIMENSION) { | 687 if (this.import_ == this.$options.IMPORTTYPES.FAIRWAYDIMENSION) { |
691 if ( | 688 if ( |
692 !this.LOS || | 689 !this.LOS || |
693 !this.minWidth || | 690 !this.minWidth || |
694 !this.maxWidth || | 691 !this.maxWidth || |
695 !this.depth || | 692 !this.depth || |
696 !this.sourceOrganization | 693 !this.sourceOrganization |
697 ) | 694 ) |
698 return; | 695 return; |
699 const values = { | 696 config = { ...config, los: this.LOS, depth: this.depth }; |
700 los: this.LOS + "", | 697 config["min-width"] = this.minWidth; |
701 depth: this.depth + "" | 698 config["max-width"] = this.maxWidth; |
702 }; | 699 config["source-organization"] = this.sourceOrganization; |
703 values["min-width"] = this.minWidth + ""; | 700 } |
704 values["max-width"] = this.maxWidth + ""; | 701 if (this.scheduled) config["cron"] = cron; |
705 values["source-organization"] = this.sourceOrganization; | 702 config["send-email"] = this.eMailNotification; |
706 addAttribute(data, values); | 703 data["config"] = config; |
707 } | |
708 if (this.scheduled) data["cron"] = cron; | |
709 data["kind"] = IMPORTTYPEKIND[this.import_]; | |
710 data["send-email"] = this.eMailNotification; | |
711 if (!this.id) { | 704 if (!this.id) { |
712 this.$store | 705 this.$store |
713 .dispatch("importschedule/saveCurrentSchedule", data) | 706 .dispatch("importschedule/saveCurrentSchedule", data) |
714 .then(response => { | 707 .then(response => { |
715 const { id } = response.data; | 708 const { id } = response.data; |