annotate client/src/components/importoverview/ApprovedGaugeMeasurementDetail.vue @ 3678:8f58851927c0

client: make layer factory only return new layer config for individual maps instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers. But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory reuses the same objects it created before, per map.
author Markus Kottlaender <markus@intevation.de>
date Mon, 17 Jun 2019 17:31:35 +0200
parents 73f537379203
children 96ee62fb88fd
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>
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
2 <div
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
3 :class="{
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
4 diffs: true,
2880
c40540889b53 client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents: 2732
diff changeset
5 full: !showLogs,
c40540889b53 client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents: 2732
diff changeset
6 split: showLogs
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
7 }"
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
8 >
2685
39a05f8c34e6 import_overview: Refactoring of detailed information.
Thomas Junk <thomas.junk@intevation.de>
parents: 2658
diff changeset
9 <div v-for="(result, index) in details.summary" :key="index">
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
10 <div class="px-2 d-flex justify-content-between">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
11 <div class="d-flex">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
12 <div @click="toggleDiff(index)" class="my-auto text-left">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
13 <UISpinnerButton
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
14 :state="showDiff === index"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
15 :icons="['angle-right', 'angle-down']"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
16 classes="text-info"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
17 />
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
18 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
19 <div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
20 {{ result["fk-gauge-id"] }}
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
21 <sup v-if="isNew(result)" class="text-success">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
22 (<translate>New</translate>)
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
23 </sup>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
24 </div>
2658
74031fbd3d50 import_overview. AGM details detailbutton on the left
Thomas Junk <thomas.junk@intevation.de>
parents: 2609
diff changeset
25 </div>
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
26 <div>{{ result["measure-date"] | dateTime }}</div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
27 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
28 <div v-if="showDiff === index" class="compare-table">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
29 <div class="row no-gutters px-4 text-left font-weight-bold">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
30 <div :class="isNew(result) ? 'col-6' : 'col-4'">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
31 <translate>Value</translate>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
32 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
33 <div v-if="isOld(result)" class="col-4">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
34 <translate>Old</translate>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
35 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
36 <div :class="isNew(result) ? 'col-6' : 'col-4'">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
37 <translate>New</translate>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
38 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
39 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
40 <div
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
41 class="row no-gutters px-4 text-left"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
42 v-for="(entry, index) in Object.keys(result.versions[0])"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
43 :key="index"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
44 v-if="isNew(result) || isDifferent(result, entry)"
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
45 >
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
46 <div :class="isNew(result) ? 'col-6' : 'col-4'">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
47 {{ entry }}
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
48 </div>
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
49 <div :class="isNew(result) ? 'col-6' : 'col-4'">
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
50 {{ result.versions[0][entry] }}
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
51 </div>
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
52 <div
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
53 v-if="isOld(result) && isDifferent(result, entry)"
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
54 :class="isNew(result) ? 'col-6' : 'col-4'"
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
55 >
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
56 {{ result.versions[1][entry] }}
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
57 </div>
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
58 </div>
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
59 </div>
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
60 </div>
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
61 </div>
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 </template>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63
2882
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
64 <style lang="sass" scoped>
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
65 .diffs
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
66 width: 100%
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
67 overflow-y: auto
2925
ce148a7fb896 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2914
diff changeset
68 > div
ce148a7fb896 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2914
diff changeset
69 border-top: dashed 1px #dee2e6
ce148a7fb896 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2914
diff changeset
70 &:first-child
ce148a7fb896 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2914
diff changeset
71 border-top: none
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
72 .compare-table
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
73 position: relative
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
74 overflow: hidden
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
75 &::after
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
76 content: ''
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
77 position: absolute
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
78 top: 0
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
79 right: -5px
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
80 bottom: 0
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
81 left: -5px
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
82 box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.4)
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
83 > div
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
84 font-size: 0.7rem
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
85 &:nth-child(odd)
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
86 background-color: #f8f9fa
2882
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
87
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
88 .split
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
89 max-height: 35vh
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
90
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
91 .full
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
92 max-height: 70vh
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
93 </style>
6538ee93df72 client: moved style blocks below template blocks
Markus Kottlaender <markus@intevation.de>
parents: 2880
diff changeset
94
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 <script>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 /* 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
97 * 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
98 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 * SPDX-License-Identifier: AGPL-3.0-or-later
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 * License-Filename: LICENSES/AGPL-3.0.txt
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 * Copyright (C) 2018 by via donau
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 * – Österreichische Wasserstraßen-Gesellschaft mbH
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 * Software engineering by Intevation GmbH
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 *
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 * Author(s):
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 * Thomas Junk <thomas.junk@intevation.de>
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 */
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
109 import { mapState } from "vuex";
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
110
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 export default {
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
112 data() {
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
113 return {
2914
84a40983bb9f client: importsoverview: improved opening mechanism for additional details
Markus Kottlaender <markus@intevation.de>
parents: 2902
diff changeset
114 showDiff: 0 // open first item by default
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
115 };
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
116 },
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
117 computed: {
2732
0ab7985ef008 import_review: fixed flakey display of logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2717
diff changeset
118 ...mapState("imports", ["showLogs", "details"])
2717
5b990f612420 import_review: rename overview to review. More space for logs
Thomas Junk <thomas.junk@intevation.de>
parents: 2708
diff changeset
119 },
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
120 methods: {
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
121 toggleDiff(number) {
2880
c40540889b53 client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents: 2732
diff changeset
122 if (this.showDiff !== number) {
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
123 this.showDiff = number;
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
124 } else {
2880
c40540889b53 client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents: 2732
diff changeset
125 this.showDiff = false;
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
126 }
2944
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
127 },
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
128 isNew(result) {
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
129 return result && result.versions && result.versions.length === 1;
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
130 },
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
131 isOld(result) {
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
132 return !this.isNew(result);
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
133 },
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
134 isDifferent(result, entry) {
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
135 return (
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
136 this.isOld(result) &&
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
137 result.versions[0][entry] != result.versions[1][entry]
73f537379203 client: importoverview: improved style
Markus Kottlaender <markus@intevation.de>
parents: 2936
diff changeset
138 );
2608
13377f2a5c42 overview2: agm details prototype implemented
Thomas Junk <thomas.junk@intevation.de>
parents: 2602
diff changeset
139 }
2880
c40540889b53 client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents: 2732
diff changeset
140 }
2602
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
141 };
5d0e5159190f overview2: detail components for unified log
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
142 </script>