Mercurial > gemma
comparison client/src/components/gauge/HydrologicalConditions.vue @ 4473:3543af71d04c
client: pdf-gen: improve file naming for the exported pdf
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Tue, 24 Sep 2019 16:39:06 +0200 |
parents | acb21e7362ce |
children | 3632cfc44b69 |
comparison
equal
deleted
inserted
replaced
4472:4dad1d448876 | 4473:3543af71d04c |
---|---|
106 import { startOfYear, endOfYear } from "date-fns"; | 106 import { startOfYear, endOfYear } from "date-fns"; |
107 import { diagram, pdfgen, templateLoader } from "@/lib/mixins"; | 107 import { diagram, pdfgen, templateLoader } from "@/lib/mixins"; |
108 import { HTTP } from "@/lib/http"; | 108 import { HTTP } from "@/lib/http"; |
109 import { displayError } from "@/lib/errors"; | 109 import { displayError } from "@/lib/errors"; |
110 import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; | 110 import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; |
111 import sanitize from "sanitize-filename"; | |
111 | 112 |
112 export default { | 113 export default { |
113 mixins: [diagram, pdfgen, templateLoader], | 114 mixins: [diagram, pdfgen, templateLoader], |
114 components: { | 115 components: { |
115 DiagramLegend: () => import("@/components/DiagramLegend") | 116 DiagramLegend: () => import("@/components/DiagramLegend") |
221 | 222 |
222 this.generatePDF({ | 223 this.generatePDF({ |
223 templateData: this.templateData, | 224 templateData: this.templateData, |
224 diagramTitle: diagramTitle | 225 diagramTitle: diagramTitle |
225 }); | 226 }); |
226 | 227 const filename = `HydrologicalCondition-${sanitize( |
227 this.pdf.doc.save( | 228 this.selectedGaugeD.properties.objname |
228 this.selectedGaugeD.properties.objname + | 229 )}-${this.dateForPDF()}.pdf`; |
229 " Hydrological-condition Diagram.pdf" | 230 this.pdf.doc.save(filename); |
230 ); | |
231 }, | 231 }, |
232 applyChange() { | 232 applyChange() { |
233 if (this.form.template.hasOwnProperty("properties")) { | 233 if (this.form.template.hasOwnProperty("properties")) { |
234 this.templateData = this.defaultTemplate; | 234 this.templateData = this.defaultTemplate; |
235 return; | 235 return; |