annotate client/src/components/sections/Sections.vue @ 5629:84d01a536bec 729-node-js-newer-version

Transformed scss and sass styles into css
author Luisa Beerboom <lbeerboom@intevation.de>
date Thu, 11 May 2023 13:23:52 +0200
parents 6b054b91d9b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
1 <template>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
2 <div class="d-flex flex-column">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
3 <UIBoxHeader icon="road" :title="title" :closeCallback="$parent.close" />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
4 <div class="position-relative">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
5 <UISpinnerOverlay v-if="loading" />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
6 <SectionForm v-if="showForm" :editSection="editSection" />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
7 <div v-else>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
8 <UITableHeader
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
9 :columns="[
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
10 { id: 'properties.name', title: `${nameLabel}`, class: 'col-4' },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
11 {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
12 id: 'properties.date_info',
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
13 title: `${dateLabel}`,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
14 class: 'col-2'
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
15 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
16 {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
17 id: 'properties.source_organization',
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
18 title: `${sourceorganizationLabel}`,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
19 class: 'col-3'
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
20 }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
21 ]"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
22 />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
23 <UITableBody
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
24 :data="filteredSections() | sortTable(sortColumn, sortDirection)"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
25 >
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
26 <template v-slot:row="{ item: section }">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
27 <div class="py-1 px-2 col-4">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
28 <a @click="moveMapToSection(section)" href="#">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
29 {{ section.properties.name }}
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
30 </a>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
31 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
32 <div class="py-1 px-2 col-2">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
33 {{ section.properties.date_info | surveyDate }}
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
34 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
35 <div class="py-1 px-2 col-3">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
36 {{ section.properties.source_organization }}
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
37 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
38 <div class="py-1 px-2 col text-right">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
39 <button
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
40 v-if="isInStaging(section.properties.name)"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
41 @click="gotoStaging(section.properties.name)"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
42 class="btn btn-xs btn-danger mr-1"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
43 >
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
44 <font-awesome-icon
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
45 icon="exclamation-triangle"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
46 fixed-width
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
47 v-tooltip="reviewTooltip"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
48 />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
49 </button>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
50 <button
4745
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
51 v-if="
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
52 userCountry === 'global' ||
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
53 section.properties.country === userCountry
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
54 "
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
55 class="btn btn-xs btn-dark"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
56 @click="deleteSection(section)"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
57 >
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
58 <font-awesome-icon icon="trash" fixed-width />
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
59 </button>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
60 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
61 </template>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
62 </UITableBody>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
63 <div class="text-right p-2 border-top">
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
64 <button
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
65 @click="
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
66 showForm = true;
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
67 editSection = null;
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
68 "
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
69 class="btn btn-sm btn-info"
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
70 >
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
71 <translate>New section</translate>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
72 </button>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
73 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
74 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
75 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
76 </div>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
77 </template>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
78
5629
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
79 <style scoped>
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
80 .input-button {
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
81 border-top-left-radius: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
82 border-bottom-left-radius: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
83 right: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
84 height: 31px;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
85 }
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
86 </style>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
87
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
88 <script>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
89 /* This is Free Software under GNU Affero General Public License v >= 3.0
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
90 * without warranty, see README.md and license for details.
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
91 *
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
92 * SPDX-License-Identifier: AGPL-3.0-or-later
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
93 * License-Filename: LICENSES/AGPL-3.0.txt
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 *
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
95 * Copyright (C) 2018, 2019 by via donau
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
96 * – Österreichische Wasserstraßen-Gesellschaft mbH
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
97 * Software engineering by Intevation GmbH
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
98 *
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
99 * Author(s):
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
100 * Thomas Junk <thomas.junk@intevation.de>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
101 * Tom Gottfried <tom.gottfried@intevation.de>
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
102 */
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
103 import { mapState, mapGetters } from "vuex";
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
104 import { displayError, displayInfo } from "@/lib/errors";
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
105 import { HTTP } from "@/lib/http";
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
106 import { sortTable } from "@/lib/mixins";
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
107
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
108 export default {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
109 mixins: [sortTable],
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
110 components: {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
111 SectionForm: () => import("./SectionForm")
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
112 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
113 data() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
114 return {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
115 staging: [],
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
116 loading: false,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
117 showForm: false,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
118 editSection: null
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
119 };
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
120 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
121 computed: {
4745
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
122 ...mapState("user", ["user"]),
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
123 ...mapGetters("usermanagement", ["userCountries"]),
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
124 ...mapState("application", ["searchQuery"]),
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
125 ...mapGetters("map", ["openLayersMap"]),
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
126 ...mapState("imports", ["sections"]),
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
127 title() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
128 return this.$gettext("Define Sections");
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
129 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
130 nameLabel() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
131 return this.$gettext("Name");
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
132 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
133 dateLabel() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
134 return this.$gettext("Date");
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
135 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
136 sourceorganizationLabel() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
137 return this.$gettext("Source organization");
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
139 reviewTooltip() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
140 return this.$gettext("Review pending import");
4745
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
141 },
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
142 userCountry() {
aecba7e66301 client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4280
diff changeset
143 return this.userCountries[this.user];
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
144 }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
145 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
146 methods: {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
147 filteredSections() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
148 return this.sections.filter(s => {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
149 return (s.properties.name + s.properties.source_organization)
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
150 .toLowerCase()
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
151 .includes(this.searchQuery.toLowerCase());
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
152 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
153 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
154 gotoStaging(sectionName) {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
155 let pendingImport = this.staging.find(s => s.name === sectionName);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
156 if (pendingImport)
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
157 this.$router.push("/imports/overview/" + pendingImport.id);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
158 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
159 isInStaging(sectionName) {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
160 return !!this.staging.find(s => s.name === sectionName);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
161 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
162 loadStagingData() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
163 HTTP.get("/imports?states=pending&kinds=sec", {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
164 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
165 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
166 .then(response => {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
167 response.data.imports.forEach(i => {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
168 HTTP.get("/imports/" + i.id, {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
169 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
170 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
171 .then(response => {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
172 this.staging.push({
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
173 id: i.id,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
174 name: response.data.summary.section
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
175 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
176 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
177 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
178 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
179 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
180 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
181 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
182 }
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
183 displayError({
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
184 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
185 message: message
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
186 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
187 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
188 .finally(() => (this.loading = false));
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
189 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
190 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
191 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
192 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
193 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
194 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
195 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
196 }
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
197 displayError({
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
198 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
199 message: message
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
200 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
201 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
202 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
203 deleteSection(section) {
4221
56588a4ba196 client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents: 4194
diff changeset
204 HTTP.post(
56588a4ba196 client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents: 4194
diff changeset
205 "/imports/dsec",
4194
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
206 {
4221
56588a4ba196 client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents: 4194
diff changeset
207 id: section.id.split(".")[1] * 1
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
208 },
4194
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
209 {
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
210 headers: { "X-Gemma-Auth": localStorage.getItem("token") }
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
211 }
4194
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
212 ).then(() => {
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
213 displayInfo({
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
214 title: this.$gettext("Staging Area"),
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
215 message: this.$gettext("Deleting ") + section.properties.objnam
01b846f4eb1e client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents: 4193
diff changeset
216 });
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
217 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
218 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
219 moveMapToSection(section) {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
220 this.$store.commit("imports/selectedSectionId", section.id);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
221 this.$store.commit("fairwayavailability/type", "sections");
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
222 this.$store.commit("application/showFairwayDepth", true);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
223 this.openLayersMap()
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
224 .getLayer("SECTIONS")
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
225 .setVisible(true);
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
226 this.$store.dispatch("map/moveToFeauture", {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
227 feature: section,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
228 zoom: 17,
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
229 preventZoomOut: true
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
230 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
231 }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
232 },
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
233 mounted() {
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
234 this.loading = true;
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 this.$store
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
236 .dispatch("imports/loadSections")
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
237 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
238 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
239 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
240 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
241 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
242 }
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
243 displayError({
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
244 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4745
diff changeset
245 message: message
3290
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
246 });
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
247 })
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
248 .finally(() => (this.loading = false));
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
249 this.loadStagingData();
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 }
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
251 };
3ada3d0347bd client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
252 </script>