annotate client/src/components/importoverview/SectionDetails.vue @ 3365:c9b60130cdfb

client: define stretches: changed placeholder
author Markus Kottlaender <markus@intevation.de>
date Wed, 22 May 2019 08:53:43 +0200
parents c0c880553cd5
children 40bc7e3bc561
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3358
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 <div>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 <a @click="zoomToSection()" class="text-info pointer">{{
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
4 details.summary.section
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
5 }}</a>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6 </div>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 </template>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
9 <script>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
10 /* This is Free Software under GNU Affero General Public License v >= 3.0
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 * without warranty, see README.md and license for details.
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 *
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 * SPDX-License-Identifier: AGPL-3.0-or-later
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 * License-Filename: LICENSES/AGPL-3.0.txt
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
15 *
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
16 * Copyright (C) 2018 by via donau
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 * – Österreichische Wasserstraßen-Gesellschaft mbH
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 * Software engineering by Intevation GmbH
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 *
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 * Author(s):
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 * Thomas Junk <thomas.junk@intevation.de>
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 */
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 import { displayError } from "@/lib/errors";
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 import { mapState, mapGetters } from "vuex";
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
26 export default {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
27 props: ["entry"],
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 mounted() {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 this.$store.commit("imports/hideAdditionalInfo");
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 },
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 computed: {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 ...mapState("imports", ["showAdditional", "details"]),
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 ...mapGetters("map", ["openLayersMap"])
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
34 },
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
35 methods: {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
36 zoomToSection() {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 const name = this.details.summary.section;
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 this.openLayersMap()
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 .getLayer("SECTIONS")
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 .setVisible(true);
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 this.$store
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 .dispatch("imports/loadSection", name)
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 .then(response => {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 if (response.data.features.length < 1)
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
45 throw new Error("no feaures found for: " + name);
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
46 this.$store.commit(
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
47 "imports/selectedSectionId",
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48 response.data.features[0].id
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 );
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 this.$store.dispatch("map/moveToFeauture", {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
51 feature: response.data.features[0],
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
52 zoom: 17,
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
53 preventZoomOut: true
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
54 });
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 })
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 .catch(error => {
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 console.log(error);
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 const { status, data } = error.response;
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 displayError({
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 title: this.$gettext("Backend Error"),
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 message: `${status}: ${data.message || data}`
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 });
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 });
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64 }
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
65 }
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 };
c0c880553cd5 client: import review: added section details (actually just the link to move the map to the feature)
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
67 </script>