Mercurial > gemma
changeset 3805:36add6adf09b yworks-svg2pdf
x-cuts_diagram: use mixin for template loading and image processing
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 04 Jul 2019 11:25:25 +0200 |
parents | 7f2c5576ec0a |
children | cc80a37173f8 |
files | client/src/components/fairway/Fairwayprofile.vue |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/fairway/Fairwayprofile.vue Thu Jul 04 11:21:59 2019 +0200 +++ b/client/src/components/fairway/Fairwayprofile.vue Thu Jul 04 11:25:25 2019 +0200 @@ -149,7 +149,7 @@ import { mapState, mapGetters } from "vuex"; import debounce from "debounce"; import canvg from "canvg"; -import { pdfgen } from "@/lib/mixins"; +import { pdfgen, templateLoader } from "@/lib/mixins"; import { HTTP } from "@/lib/http"; import { displayError } from "@/lib/errors"; @@ -157,7 +157,7 @@ const WATER_COLOR = "#005DFF"; export default { - mixins: [pdfgen], + mixins: [pdfgen, templateLoader], name: "fairwayprofile", components: { DiagramLegend: () => import("@/components/DiagramLegend") @@ -331,14 +331,16 @@ return; } if (this.form.template) { - HTTP.get("/templates/diagram/" + this.form.template.name, { - headers: { - "X-Gemma-Auth": localStorage.getItem("token"), - "Content-type": "text/xml; charset=UTF-8" - } - }) + this.loadTemplates("/templates/diagram/" + this.form.template.name) .then(response => { - this.templateData = response.data.template_data; + this.prepareImages(response.data.template_data.elements).then( + values => { + values.forEach(v => { + response.data.template_data.elements[v.index].url = v.url; + }); + this.templateData = response.data.template_data; + } + ); }) .catch(e => { const { status, data } = e.response;