# HG changeset patch # User Fadi Abbud # Date 1557757015 -7200 # Node ID d91c1200dc6b38c264998f182e2f5356ec7c9fce # Parent 3159ee3bcb16194e714db0d447d82f37455b6a34 client: diagram-template: cleanup code * remove unnecessary form.papersize data diff -r 3159ee3bcb16 -r d91c1200dc6b client/src/components/gauge/HydrologicalConditions.vue --- a/client/src/components/gauge/HydrologicalConditions.vue Mon May 13 13:13:37 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Mon May 13 16:16:55 2019 +0200 @@ -349,7 +349,6 @@ }) .then(response => { this.templateData = response.data.template_data; - this.form.paperSize = this.templateData.properties.paperSize; }) .catch(e => { const { status, data } = e.response; diff -r 3159ee3bcb16 -r d91c1200dc6b client/src/components/gauge/Waterlevel.vue --- a/client/src/components/gauge/Waterlevel.vue Mon May 13 13:13:37 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Mon May 13 16:16:55 2019 +0200 @@ -107,8 +107,7 @@ scale: null, axes: null, form: { - template: null, - form: null + template: null }, templates: [], defaultTemplate: { @@ -196,9 +195,15 @@ ); }, downloadPDF() { - this.pdf.doc = new jsPDF("l", "mm", this.form.paperSize); - this.pdf.width = this.form.paperSize === "a3" ? 420 : 297; - this.pdf.height = this.form.paperSize === "a3" ? 297 : 210; + this.pdf.doc = new jsPDF( + "l", + "mm", + this.templateData.properties.paperSize + ); + this.pdf.width = + this.templateData.properties.paperSize === "a3" ? 420 : 297; + this.pdf.height = + this.templateData.properties.paperSize === "a3" ? 297 : 210; // check the template elements if (this.templateData) { let defaultFontSize = 11, @@ -293,7 +298,6 @@ applyChange() { if (this.form.template.hasOwnProperty("properties")) { this.templateData = this.defaultTemplate; - this.form.paperSize = this.defaultTemplate.properties.paperSize; return; } if (this.form.template) { @@ -305,7 +309,6 @@ }) .then(response => { this.templateData = response.data.template_data; - this.form.paperSize = this.templateData.properties.paperSize; }) .catch(e => { const { status, data } = e.response; @@ -351,10 +354,10 @@ var imgData = canvas.toDataURL("image/png"); // landscape format is used for both a3,a4 papersize if (!width) { - width = this.form.paperSize === "a3" ? 380 : 290; + width = this.templateData.properties.paperSize === "a3" ? 380 : 290; } if (!height) { - height = this.form.paperSize === "a3" ? 130 : 100; + height = this.templateData.properties.paperSize === "a3" ? 130 : 100; } if (["topright", "bottomright"].indexOf(position) !== -1) { x = this.pdf.width - offset.x - width;