# HG changeset patch # User Fadi Abbud # Date 1548152537 -3600 # Node ID 8e6f6c376b757b162f46195150284623b46d3247 # Parent 4235fa8f59d7122652f22b7911d8337e08bfde02# Parent 99196fbc3897857e09f38a9324b60a22530006ec merge translations from weblate diff -r 99196fbc3897 -r 8e6f6c376b75 .hgtags --- a/.hgtags Fri Jan 18 06:51:49 2019 +0000 +++ b/.hgtags Tue Jan 22 11:22:17 2019 +0100 @@ -1,2 +1,4 @@ 532c8392048fe720bf31b7efb475591ab95a74ec v1-uat1 136aaa7f00af0b500c5c75f9fd9aabfc7fa526ee v1.1.0 +724758455a4e44d25b096f00bcb353ceda0e0d57 v2-preview20190111 +0059aa870a396e2112efae43f822c0c133454d7a v2 diff -r 99196fbc3897 -r 8e6f6c376b75 client/.env --- a/client/.env Fri Jan 18 06:51:49 2019 +0000 +++ b/client/.env Tue Jan 22 11:22:17 2019 +0100 @@ -5,8 +5,9 @@ VUE_APP_API_URL=/api/ VUE_BACKEND_API_URL=http://gemma_backend:8000 -#URL of secondary logo -VUE_APP_SECONDARY_LOGO_URL= - #Path of vendored images is copied during a webpack build VUE_APP_VENDOR_IMG_PATH= + +#Logos to be potentially loaded by the SPA. Can be left blank. +VUE_APP_SECONDARY_LOGO_URL= +VUE_APP_LOGO_FOR_PDF_URL= diff -r 99196fbc3897 -r 8e6f6c376b75 client/package.json --- a/client/package.json Fri Jan 18 06:51:49 2019 +0000 +++ b/client/package.json Tue Jan 22 11:22:17 2019 +0100 @@ -32,6 +32,7 @@ "debounce": "^1.2.0", "font-awesome": "^4.7.0", "glob-all": "^3.1.0", + "jspdf": "^1.5.3", "locale2": "^2.2.0", "ol": "^5.3.0", "path": "^0.12.7", diff -r 99196fbc3897 -r 8e6f6c376b75 client/src/components/ImportStretches.vue --- a/client/src/components/ImportStretches.vue Fri Jan 18 06:51:49 2019 +0000 +++ b/client/src/components/ImportStretches.vue Tue Jan 22 11:22:17 2019 +0100 @@ -2,193 +2,231 @@
- Define section and stretches + Define stretches
-
-
-
- ID - - - - Please enter an id - - -
-
- Function - - - - Please enter a function - - -
+
+ + + + + + + + + + + + + + + + + + + +
NameDatumSource organization  
+ {{ + stretch.properties.name + }} + + {{ formatSurveyDate(stretch.properties["date_info"]) }} + {{ stretch.properties["source_organization"] }} + + + +
+
+ No results.
-
-
- Start rhm -
+
+
+
+
+
+ ID - - + + + Please enter an id + + +
+
+
+ + Countrycode + + + + + Please enter a countrycode + + +
+
+
+
+
+
+ Start rhm +
+ + + + +
+ + + Please enter a start point +
- - - Please enter a start point - - +
+ End rhm +
+ + + + +
+ + + Please enter an end point + + +
-
- End rhm -
+
+
+ + Object name + - - + + + Please enter an objectname + + +
+
+ + National Object name + + + + + Please enter an objectname +
- - - Please enter an end point - - +
+
+
+ Date info + + + + Please enter a date + + +
+
+ Source + + + + Please enter a source + + +
-
-
- Object name - - - - Please enter an objectname - - -
-
- - National Object name - - - - - Please enter an objectname - - -
-
-
-
- Date info - - - - Please enter a date - - -
-
- Source - - - - Please enter a source - - -
-
-
-
- Countrycode - - - - Please enter a countrycode - - -
-
+
+ +
-
-
@@ -209,12 +247,15 @@ * Thomas Junk */ import { mapState, mapGetters } from "vuex"; -import { displayInfo } from "@/lib/errors.js"; +import { displayError, displayInfo } from "@/lib/errors.js"; +import { formatSurveyDate } from "@/lib/date.js"; +import center from "@turf/center"; export default { name: "importstretches", data() { return { + edit: false, id: "", funktion: "", startrhm: "", @@ -237,7 +278,74 @@ countryCodeError: false }; }, + mounted() { + this.edit = false; + this.loadStretches(); + }, methods: { + editStretch(index) { + const { date_info, name, objnam, nobjnam } = this.stretches[ + index + ].properties; + this.date_info = date_info; + this.id = name; + this.nobjbn = nobjnam; + this.objbn = objnam; + this.source = this.stretches[index]; + this.edit = true; + }, + deleteStretch(index) { + displayInfo({ + title: this.$gettext("Not implemented"), + message: this.$gettext("Deleting " + this.stretches[index].id) + }); + }, + moveMapToStretch(index) { + const { coordinates } = center(this.stretches[index]).geometry; + this.$store.commit("map/moveMap", { + coordinates: coordinates, + zoom: 17, + preventZoomOut: true + }); + }, + formatSurveyDate(d) { + return formatSurveyDate(d); + }, + loadStretches() { + this.$store.dispatch("imports/loadStretches").catch(error => { + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); + }, + clean() { + this.id = ""; + this.funktion = ""; + this.startrhm = ""; + this.endrhm = ""; + this.objbn = ""; + this.nobjbn = ""; + this.countryCode = ""; + this.date_info = new Date().toISOString().split("T")[0]; + this.source = ""; + this.pipetteStart = false; + this.pipetteEnd = false; + this.idError = false; + this.funktionError = false; + this.startrhmError = false; + this.endrhmError = false; + this.objbnError = false; + this.nobjbnError = false; + this.date_infoError = false; + this.sourceError = false; + this.countryCodeError = false; + }, + startEdit() { + this.clean(); + this.edit = true; + }, togglePipette(t) { if (t === "start") { this.pipetteStart = !this.pipetteStart; @@ -254,7 +362,6 @@ "startrhm", "endrhm", "objbn", - "nobjbn", "date_info", "source" ]; @@ -266,12 +373,37 @@ } }); }, - submit() { + save() { this.validate(); - displayInfo({ - title: this.$gettext("Sections"), - message: this.$gettext("Not implemented!") - }); + const data = { + name: this.id, + from: this.startrhm, + to: this.endrhm, + "source-organization": this.source, + "date-info": this.date_info, + objnam: this.objbn, + nobjnam: this.nobjbn, + countries: this.countryCode.split(",") + }; + this.$store + .dispatch("imports/saveStretch", data) + .then(() => { + displayInfo({ + title: this.$gettext("Import"), + message: this.$gettext("Starting import of stretch") + }); + this.clean(); + this.edit = false; + this.loadStretches(); + }) + .catch(error => { + console.log(error); + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); } }, watch: { @@ -293,7 +425,8 @@ }, computed: { ...mapState("map", ["identifiedFeatures", "currentMeasurement"]), - ...mapGetters("user", ["isSysAdmin"]) + ...mapGetters("user", ["isSysAdmin"]), + ...mapState("imports", ["stretches"]) } }; diff -r 99196fbc3897 -r 8e6f6c376b75 client/src/components/Maplayer.vue --- a/client/src/components/Maplayer.vue Fri Jan 18 06:51:49 2019 +0000 +++ b/client/src/components/Maplayer.vue Tue Jan 22 11:22:17 2019 +0100 @@ -14,25 +14,6 @@ .mapfull { height: 100vh; } - -// the following css part is for browser-printing based pdf generation -@page { - size: A4 landscape !important; - margin: 4mm !important; - // according to https://www.w3.org/TR/css-page-3/#page-size-prop - // we shall now have 210 - 2*4 = 202 mm width and 297 - 2*4 = 289 mm height -} - -@media print { - .mapfull { - width: 2000px; - height: 2828px; - } - .mapsplit { - width: 2000px; - height: 2828px; - } -}