annotate client/src/components/importoverview/StretchDetails.vue @ 3550:c0f8f9ba21a7

import_review: sections&stretches accept old and new format in DB
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 31 May 2019 13:59:54 +0200
parents c71f1b15c5d9
children 4d0a09ae0828
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
2 <div
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
3 :class="{
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
4 full: !showLogs,
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
5 split: showLogs
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
6 }"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
7 >
3550
c0f8f9ba21a7 import_review: sections&stretches accept old and new format in DB
Thomas Junk <thomas.junk@intevation.de>
parents: 3526
diff changeset
8 <div v-if="!details.summary.stretch" class="d-flex">
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
9 <UISpinnerButton
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
10 @click="showDetails = !showDetails"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
11 :state="showDetails"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
12 :icons="['angle-right', 'angle-down']"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
13 classes="text-info"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
14 />
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
15 <a @click="zoomToStretch()" class="text-info pointer"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
16 >{{ details.summary.objnam }} (
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
17 {{ details.summary.countries.join(", ") }} )</a
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
18 >
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
19 </div>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
20 <div>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
21 <div v-if="showDetails">
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
22 <div
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
23 v-for="(entry, index) in Object.keys(details.summary)"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
24 :key="index"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
25 class="comparison row no-gutters px-4 text-left"
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
26 >
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
27 <span class="col-4">{{ entry }}</span>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
28 <span v-if="entry === 'countries'" class="col-4">{{
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
29 details.summary[entry].join(", ")
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
30 }}</span>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
31 <span v-else class="col-4">{{ details.summary[entry] }}</span>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
32 </div>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
33 </div>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
34 </div>
2605
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
35 </div>
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 </template>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
38 <style lang="scss" scoped>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
39 .comparison {
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
40 width: 668px;
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
41 border-top: dashed 1px #dee2e6;
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
42 }
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
43
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
44 .comparison:nth-child(odd) {
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
45 background-color: #f8f9fa;
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
46 }
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
47
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
48 .split {
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
49 max-height: 35vh;
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
50 }
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
51
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
52 .full {
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
53 max-height: 70vh;
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
54 }
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
55 </style>
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
56
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 <script>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 /* This is Free Software under GNU Affero General Public License v >= 3.0
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 * without warranty, see README.md and license for details.
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 * SPDX-License-Identifier: AGPL-3.0-or-later
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 * License-Filename: LICENSES/AGPL-3.0.txt
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 * Copyright (C) 2018 by via donau
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 * – Österreichische Wasserstraßen-Gesellschaft mbH
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 * Software engineering by Intevation GmbH
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 * Author(s):
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 * Thomas Junk <thomas.junk@intevation.de>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 */
2985
1b8bb4f89227 client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents: 2957
diff changeset
71 import { displayError } from "@/lib/errors";
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3017
diff changeset
72 import { mapState, mapGetters } from "vuex";
2605
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
73
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 export default {
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
75 data() {
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
76 return {
3526
c71f1b15c5d9 default show details
Thomas Junk <thomas.junk@intevation.de>
parents: 3525
diff changeset
77 showDetails: true
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
78 };
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
79 },
2732
0ab7985ef008 import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2717
diff changeset
80 props: ["entry"],
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2685
diff changeset
81 mounted() {
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2685
diff changeset
82 this.$store.commit("imports/hideAdditionalInfo");
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2685
diff changeset
83 },
2732
0ab7985ef008 import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2717
diff changeset
84 computed: {
3523
b0c655e605ee reviewdetails for stretches
Thomas Junk <thomas.junk@intevation.de>
parents: 3357
diff changeset
85 ...mapState("imports", ["showAdditional", "showLogs", "details"]),
3044
c71373594719 client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents: 3017
diff changeset
86 ...mapGetters("map", ["openLayersMap"])
2732
0ab7985ef008 import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2717
diff changeset
87 },
2605
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
88 methods: {
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
89 zoomToStretch() {
3525
4a31a4dbcf18 zoom function repaired
Thomas Junk <thomas.junk@intevation.de>
parents: 3524
diff changeset
90 const { name } = this.details.summary;
3127
0374197c384f client: fix openLayersMap getter calls
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
91 this.openLayersMap()
0374197c384f client: fix openLayersMap getter calls
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
92 .getLayer("STRETCHES")
0374197c384f client: fix openLayersMap getter calls
Markus Kottlaender <markus@intevation.de>
parents: 3054
diff changeset
93 .setVisible(true);
2605
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
94 this.$store
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
95 .dispatch("imports/loadStretch", name)
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
96 .then(response => {
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
97 if (response.data.features.length < 1)
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
98 throw new Error("no feaures found for: " + name);
3356
37c024dd435e client: import review: set selected stretch when clicking on stretch name in import details
Markus Kottlaender <markus@intevation.de>
parents: 3127
diff changeset
99 this.$store.commit(
37c024dd435e client: import review: set selected stretch when clicking on stretch name in import details
Markus Kottlaender <markus@intevation.de>
parents: 3127
diff changeset
100 "imports/selectedStretchId",
37c024dd435e client: import review: set selected stretch when clicking on stretch name in import details
Markus Kottlaender <markus@intevation.de>
parents: 3127
diff changeset
101 response.data.features[0].id
37c024dd435e client: import review: set selected stretch when clicking on stretch name in import details
Markus Kottlaender <markus@intevation.de>
parents: 3127
diff changeset
102 );
3054
1ef2f4179d30 client: map store: merged/renamed method(s)
Markus Kottlaender <markus@intevation.de>
parents: 3044
diff changeset
103 this.$store.dispatch("map/moveToFeauture", {
3017
9a408a8b74b8 client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
104 feature: response.data.features[0],
9a408a8b74b8 client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
105 zoom: 17,
9a408a8b74b8 client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
106 preventZoomOut: true
9a408a8b74b8 client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents: 3006
diff changeset
107 });
2605
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
108 })
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
109 .catch(error => {
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
110 console.log(error);
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
111 const { status, data } = error.response;
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
112 displayError({
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
113 title: this.$gettext("Backend Error"),
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
114 message: `${status}: ${data.message || data}`
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
115 });
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
116 });
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
117 }
11fd7ee37f10 overview2: added stretch zoom functionality
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
118 }
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 };
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 </script>