annotate client/src/components/importoverview/AGMLogItem.vue @ 5267:aca4bf7af270

client: remove mapState from import statement
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 10 Jun 2020 16:33:10 +0200
parents 6ebe42af392d
children 84d01a536bec
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div class="d-flex flex-column">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 <div class="px-2 d-flex justify-content-between">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 <div class="d-flex">
3767
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
5 <div @click="toggleShow(index)" class="my-auto text-left">
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 <UISpinnerButton
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 :state="show"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 :icons="['angle-right', 'angle-down']"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 classes="text-info"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 />
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 <div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 {{ line["fk-gauge-id"] }}
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 <sup v-if="isNew(line)" class="text-success">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 (<translate>New</translate>)
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 </sup>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 <div>{{ line["measure-date"] | dateTime }}</div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 <div v-if="show" class="compare-table">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 <div class="row no-gutters px-4 text-left font-weight-bold">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 <div :class="isNew(line) ? 'col-6' : 'col-4'">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 <translate>Value</translate>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 <div v-if="isOld(line)" class="col-4">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 <translate>Old</translate>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 <div :class="isNew(line) ? 'col-6' : 'col-4'">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 <translate>New</translate>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 <div
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 class="row no-gutters px-4 text-left"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35 v-for="(entry, index) in Object.keys(line.versions[0])"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 :key="index"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 v-if="isNew(line) || isDifferent(line, entry)"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38 >
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39 <div :class="isNew(line) ? 'col-6' : 'col-4'">
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 {{ entry }}
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42 <div :class="isNew(line) ? 'col-6' : 'col-4'">
4065
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
43 <span :class="line.versions[1] ? '' : 'text-danger'">{{
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
44 line.versions[0][entry]
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
45 }}</span>
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 <div
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 v-if="isOld(line) && isDifferent(line, entry)"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 :class="isNew(line) ? 'col-6' : 'col-4'"
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 >
4065
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
51 {{ line.versions[1] ? line.versions[1][entry] : $options.DELETED }}
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 </div>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 </template>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 <script>
4065
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
59 /* This is Free Software under GNU Affero General Public License v >= 3.0
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
60 * without warranty, see README.md and license for details.
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
61 *
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
62 * SPDX-License-Identifier: AGPL-3.0-or-later
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
63 * License-Filename: LICENSES/AGPL-3.0.txt
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
64 *
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
65 * Copyright (C) 2018, 2019 by via donau
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
66 * – Österreichische Wasserstraßen-Gesellschaft mbH
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
67 * Software engineering by Intevation GmbH
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
68 *
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
69 * Author(s):
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
70 * * Thomas Junk <thomas.junk@intevation.de>
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
71 * * Markus Kottländer <markus.kottlaender@intevation.de>
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
72 * * Fadi Abbud <fadi.abbud@intevation.de>
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
73 */
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
74 import app from "@/main";
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 export default {
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 props: ["line", "index", "showDiff"],
3767
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
77 computed: {
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
78 show() {
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
79 return this.index === this.showDiff;
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
80 }
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 },
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 methods: {
3767
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
83 toggleShow(index) {
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
84 this.$emit("openDiff", index);
fd6d62b08af7 review_agm: fixed open diff bug. Only selected diff is opened and stays open
Thomas Junk <thomas.junk@intevation.de>
parents: 3766
diff changeset
85 },
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 isNew(result) {
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 return result && result.versions && result.versions.length === 1;
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 },
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 isOld(result) {
4064
3eaa3ee4630f Reverted changes to AGM diff client code.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 4063
diff changeset
90 return !this.isNew(result);
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 },
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 isDifferent(result, entry) {
4065
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
93 if (!result.versions[1]) return true;
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 return (
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 this.isOld(result) &&
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 result.versions[0][entry] != result.versions[1][entry]
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 );
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 }
4065
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
99 },
6ebe42af392d review of AGM now visually handles deleted entries
Thomas Junk <thomas.junk@intevation.de>
parents: 4064
diff changeset
100 DELETED: app.$gettext("deleted")
3766
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 };
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 </script>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 <style lang="sass" scoped>
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 .diffs
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 width: 100%
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 overflow-y: auto
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 > div
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 border-top: dashed 1px #dee2e6
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 &:first-child
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 border-top: none
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 .compare-table
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 position: relative
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 overflow: hidden
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 &::after
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 content: ''
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 position: absolute
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 top: 0
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
119 right: -5px
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 bottom: 0
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 left: -5px
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.4)
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 > div
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 font-size: 0.7rem
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 &:nth-child(odd)
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 background-color: #f8f9fa
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
128 .split
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
129 max-height: 35vh
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
130
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
131 .full
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
132 max-height: 70vh
96ee62fb88fd agm_review: now with virtual scrolling
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
133 </style>