Mercurial > gemma
diff 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 |
line wrap: on
line diff
--- a/client/src/components/gauge/HydrologicalConditions.vue Tue Sep 24 13:37:39 2019 +0200 +++ b/client/src/components/gauge/HydrologicalConditions.vue Tue Sep 24 16:39:06 2019 +0200 @@ -108,6 +108,7 @@ import { HTTP } from "@/lib/http"; import { displayError } from "@/lib/errors"; import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate"; +import sanitize from "sanitize-filename"; export default { mixins: [diagram, pdfgen, templateLoader], @@ -223,11 +224,10 @@ templateData: this.templateData, diagramTitle: diagramTitle }); - - this.pdf.doc.save( - this.selectedGaugeD.properties.objname + - " Hydrological-condition Diagram.pdf" - ); + const filename = `HydrologicalCondition-${sanitize( + this.selectedGaugeD.properties.objname + )}-${this.dateForPDF()}.pdf`; + this.pdf.doc.save(filename); }, applyChange() { if (this.form.template.hasOwnProperty("properties")) {