Mercurial > gemma
annotate client/src/components/sections/Sections.vue @ 5356:3216b4a19023 extented-report
spinner added to info tool's download link for DQL reports
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 22 Jun 2021 14:44:34 +0200 |
parents | 6b054b91d9b2 |
children | 84d01a536bec |
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 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 <style lang="sass" scoped> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 .input-button |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
81 border-top-left-radius: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 border-bottom-left-radius: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 right: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 height: 31px |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
85 </style> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
86 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
87 <script> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
88 /* 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
|
89 * 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
|
90 * |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 * 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
|
92 * 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
|
93 * |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 * 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
|
95 * – Österreichische Wasserstraßen-Gesellschaft mbH |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 * Software engineering by Intevation GmbH |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
97 * |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 * Author(s): |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 * Thomas Junk <thomas.junk@intevation.de> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 * Tom Gottfried <tom.gottfried@intevation.de> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 */ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
102 import { mapState, mapGetters } from "vuex"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 import { displayError, displayInfo } from "@/lib/errors"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 import { HTTP } from "@/lib/http"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 import { sortTable } from "@/lib/mixins"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 export default { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 mixins: [sortTable], |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 components: { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 SectionForm: () => import("./SectionForm") |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 data() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 return { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 staging: [], |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 loading: false, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 showForm: false, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 editSection: null |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 }; |
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 computed: { |
4745
aecba7e66301
client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4280
diff
changeset
|
121 ...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
|
122 ...mapGetters("usermanagement", ["userCountries"]), |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 ...mapState("application", ["searchQuery"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 ...mapGetters("map", ["openLayersMap"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 ...mapState("imports", ["sections"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
126 title() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
127 return this.$gettext("Define Sections"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
129 nameLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 return this.$gettext("Name"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
131 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
132 dateLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 return this.$gettext("Date"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
135 sourceorganizationLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 return this.$gettext("Source organization"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 reviewTooltip() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 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
|
140 }, |
aecba7e66301
client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4280
diff
changeset
|
141 userCountry() { |
aecba7e66301
client: sections:improve showing of delete button depending on user rights
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4280
diff
changeset
|
142 return this.userCountries[this.user]; |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 } |
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 methods: { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 filteredSections() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 return this.sections.filter(s => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
148 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
|
149 .toLowerCase() |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
150 .includes(this.searchQuery.toLowerCase()); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
151 }); |
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 gotoStaging(sectionName) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
154 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
|
155 if (pendingImport) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 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
|
157 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
158 isInStaging(sectionName) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 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
|
160 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 loadStagingData() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 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
|
163 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
|
164 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
165 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 response.data.imports.forEach(i => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 HTTP.get("/imports/" + i.id, { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
168 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
|
169 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
170 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 this.staging.push({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 id: i.id, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 name: response.data.summary.section |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
174 }); |
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 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
177 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
178 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
179 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
180 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
181 } |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
182 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
183 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
184 message: message |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 }); |
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 .finally(() => (this.loading = false)); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
188 }); |
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 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
191 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
192 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
193 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
194 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
195 } |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
198 message: message |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 }); |
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 deleteSection(section) { |
4221
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
203 HTTP.post( |
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
204 "/imports/dsec", |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
205 { |
4221
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
206 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
|
207 }, |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
208 { |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
209 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
|
210 } |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
211 ).then(() => { |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
212 displayInfo({ |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
213 title: this.$gettext("Staging Area"), |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
214 message: this.$gettext("Deleting ") + section.properties.objnam |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
215 }); |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 }); |
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 moveMapToSection(section) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
219 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
|
220 this.$store.commit("fairwayavailability/type", "sections"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
221 this.$store.commit("application/showFairwayDepth", true); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
222 this.openLayersMap() |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 .getLayer("SECTIONS") |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 .setVisible(true); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 this.$store.dispatch("map/moveToFeauture", { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 feature: section, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 zoom: 17, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
228 preventZoomOut: true |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 }); |
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 mounted() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 this.loading = true; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 this.$store |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 .dispatch("imports/loadSections") |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
237 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
238 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
239 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
240 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
241 } |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4745
diff
changeset
|
244 message: message |
3290
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 }); |
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 .finally(() => (this.loading = false)); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 this.loadStagingData(); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 } |
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 </script> |