Mercurial > gemma
annotate client/src/components/importoverview/SoundingResultDetail.vue @ 5588:94ef43fac0eb surveysperbottleneckid
Make BN for overview distinguishable
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 05 Apr 2022 10:15:37 +0200 |
parents | 271888ef85bc |
children | f24c9a7b3e82 |
rev | line source |
---|---|
2602
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
2 <div> |
4407
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
3 <a v-if="isSR" @click="zoomTo()" class="text-info pointer"> |
2685
39a05f8c34e6
import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents:
2608
diff
changeset
|
4 {{ details.summary.bottleneck }} |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
5 </a> |
4407
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
6 <div class="d-flex flex-column" v-if="isDSR"> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
7 <span> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
8 <translate>Bottleneck: </translate> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
9 {{ details.summary["bottleneck-id"] }} |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
10 </span> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
11 <span> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
12 <translate>Survey from: </translate> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
13 {{ details.summary["date-info"] | surveyDate }} |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
14 </span> |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
15 </div> |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
16 </div> |
2602
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 </template> |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 <script> |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 /* 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
|
21 * 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
|
22 * |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 * SPDX-License-Identifier: AGPL-3.0-or-later |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 * License-Filename: LICENSES/AGPL-3.0.txt |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 * |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 * Copyright (C) 2018 by via donau |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 * – Österreichische Wasserstraßen-Gesellschaft mbH |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 * Software engineering by Intevation GmbH |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 * |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 * Author(s): |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 * Thomas Junk <thomas.junk@intevation.de> |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 */ |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2717
diff
changeset
|
33 import { mapState } from "vuex"; |
5574
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
34 import { HTTP } from "@/lib/http"; |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
35 import { displayError } from "@/lib/errors"; |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2717
diff
changeset
|
36 |
2602
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 export default { |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
38 name: "soundingresultdetails", |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2717
diff
changeset
|
39 props: ["entry"], |
2717
5b990f612420
import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2685
diff
changeset
|
40 mounted() { |
5b990f612420
import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2685
diff
changeset
|
41 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
|
42 }, |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2717
diff
changeset
|
43 computed: { |
4407
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
44 ...mapState("imports", ["showAdditional", "details"]), |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
45 isSR() { |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
46 return this.entry.kind.toUpperCase() === "SR"; |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
47 }, |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
48 isDSR() { |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
49 return this.entry.kind.toUpperCase() === "DSR"; |
8c0f2377ff47
import_overview: DSR review details added
Thomas Junk <thomas.junk@intevation.de>
parents:
3044
diff
changeset
|
50 } |
2732
0ab7985ef008
import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents:
2717
diff
changeset
|
51 }, |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
52 methods: { |
3017
9a408a8b74b8
client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents:
2927
diff
changeset
|
53 zoomTo() { |
9a408a8b74b8
client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents:
2927
diff
changeset
|
54 const { lat, lon, bottleneck, date } = this.details.summary; |
3044
c71373594719
client: map: prepared store to hold multiple map objects
Markus Kottlaender <markus@intevation.de>
parents:
3017
diff
changeset
|
55 this.$store.dispatch("map/moveMap", { |
3017
9a408a8b74b8
client: inlined some functions that were used only once
Markus Kottlaender <markus@intevation.de>
parents:
2927
diff
changeset
|
56 coordinates: [lat, lon], |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
57 zoom: 17, |
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
58 preventZoomOut: true |
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
59 }); |
5574
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
60 HTTP.get( |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
61 "/surveys?name=" + |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
62 encodeURIComponent(bottleneck) + |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
63 "&date=" + |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
64 encodeURIComponent(date), |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
65 { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
66 headers: { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
67 "X-Gemma-Auth": localStorage.getItem("token"), |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
68 "Content-type": "text/xml; charset=UTF-8" |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
69 } |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
70 } |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
71 ) |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
72 .then(response => { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
73 const { bottleneck_id } = response.data.surveys[0]; |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
74 this.$store |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
75 .dispatch("bottlenecks/setSelectedBottleneck", bottleneck_id) |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
76 .then(() => { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
77 this.$store.commit("bottlenecks/setSelectedSurveyByDate", date); |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
78 }); |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
79 }) |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
80 .catch(error => { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
81 let message = "Backend not reachable"; |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
82 if (error.response) { |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
83 const { status, data } = error.response; |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
84 message = `${status}: ${data.message || data}`; |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
85 } |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
86 displayError({ |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
87 title: this.$gettext("Backend Error"), |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
88 message: message |
271888ef85bc
Finalize use of bottleneck id instead of name.
Thomas Junk <thomas.junk@intevation.de>
parents:
5572
diff
changeset
|
89 }); |
2608
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
90 }); |
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
91 } |
13377f2a5c42
overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents:
2602
diff
changeset
|
92 } |
2602
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 }; |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 </script> |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 |
5d0e5159190f
overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 <style></style> |