Mercurial > gemma
annotate client/src/components/sections/Sections.vue @ 4664:7d2463c7b4ad
Added cmd/oct2str/oct2str to Makefile.
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Mon, 14 Oct 2019 16:10:31 +0200 |
parents | 2f2dbd3ebaea |
children | aecba7e66301 |
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 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 class="btn btn-xs btn-dark" |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
52 @click="deleteSection(section)" |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
53 > |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
54 <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
|
55 </button> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 </div> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 </template> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 </UITableBody> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 <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
|
60 <button |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
61 @click=" |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 showForm = true; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 editSection = null; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 " |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 class="btn btn-sm btn-info" |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 > |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 <translate>New section</translate> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
68 </button> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
69 </div> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
70 </div> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
71 </div> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
72 </div> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
73 </template> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
74 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
75 <style lang="sass" scoped> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
76 .input-button |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
77 border-top-left-radius: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
78 border-bottom-left-radius: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 right: 0 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 height: 31px |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
81 </style> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 <script> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
84 /* 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
|
85 * 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
|
86 * |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
87 * 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
|
88 * 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
|
89 * |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 * 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
|
91 * – Österreichische Wasserstraßen-Gesellschaft mbH |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 * Software engineering by Intevation GmbH |
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 * Author(s): |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
95 * Thomas Junk <thomas.junk@intevation.de> |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 * Tom Gottfried <tom.gottfried@intevation.de> |
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 import { mapState, mapGetters } from "vuex"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 import { displayError, displayInfo } from "@/lib/errors"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 import { HTTP } from "@/lib/http"; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 import { sortTable } from "@/lib/mixins"; |
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 export default { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 mixins: [sortTable], |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 components: { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 SectionForm: () => import("./SectionForm") |
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 data() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 return { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 staging: [], |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 loading: false, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 showForm: false, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 editSection: null |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
114 }; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 computed: { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 ...mapState("application", ["searchQuery"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 ...mapGetters("map", ["openLayersMap"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
119 ...mapState("imports", ["sections"]), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
120 title() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
121 return this.$gettext("Define Sections"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
122 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 nameLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 return this.$gettext("Name"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
126 dateLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
127 return this.$gettext("Date"); |
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 sourceorganizationLabel() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 return this.$gettext("Source organization"); |
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 reviewTooltip() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 return this.$gettext("Review pending import"); |
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 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 methods: { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 filteredSections() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 return this.sections.filter(s => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 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
|
140 .toLowerCase() |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
141 .includes(this.searchQuery.toLowerCase()); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 }); |
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 gotoStaging(sectionName) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
145 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
|
146 if (pendingImport) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 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
|
148 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
149 isInStaging(sectionName) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
150 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
|
151 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
152 loadStagingData() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
153 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
|
154 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
|
155 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 response.data.imports.forEach(i => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
158 HTTP.get("/imports/" + i.id, { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 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
|
160 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 .then(response => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 this.staging.push({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
163 id: i.id, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
164 name: response.data.summary.section |
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 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
168 const { status, data } = error.response; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
169 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
170 title: this.$gettext("Backend Error"), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
171 message: `${status}: ${data.message || data}` |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
174 .finally(() => (this.loading = false)); |
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 => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
178 const { status, data } = error.response; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
179 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
180 title: this.$gettext("Backend Error"), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
181 message: `${status}: ${data.message || data}` |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
182 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
183 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
184 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 deleteSection(section) { |
4221
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
186 HTTP.post( |
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
187 "/imports/dsec", |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
188 { |
4221
56588a4ba196
client: fix code-style (minor)
Bernhard Reiter <bernhard@intevation.de>
parents:
4194
diff
changeset
|
189 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
|
190 }, |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
191 { |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
192 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
|
193 } |
4194
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
194 ).then(() => { |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
195 displayInfo({ |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
196 title: this.$gettext("Staging Area"), |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
197 message: this.$gettext("Deleting ") + section.properties.objnam |
01b846f4eb1e
client: Removed confirm dialog when deleting sections.
Raimund Renkert <raimund@renkert.org>
parents:
4193
diff
changeset
|
198 }); |
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 moveMapToSection(section) { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
202 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
|
203 this.$store.commit("fairwayavailability/type", "sections"); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
204 this.$store.commit("application/showFairwayDepth", true); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
205 this.openLayersMap() |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
206 .getLayer("SECTIONS") |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
207 .setVisible(true); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
208 this.$store.dispatch("map/moveToFeauture", { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
209 feature: section, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
210 zoom: 17, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 preventZoomOut: true |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
212 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
213 } |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 }, |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
215 mounted() { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 this.loading = true; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
217 this.$store |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
218 .dispatch("imports/loadSections") |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
219 .catch(error => { |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
220 const { status, data } = error.response; |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
221 displayError({ |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
222 title: this.$gettext("Backend Error"), |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 message: `${status}: ${data.message || data}` |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 }); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 }) |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 .finally(() => (this.loading = false)); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 this.loadStagingData(); |
3ada3d0347bd
client: define sections: duplicated and adjusted code from stretches
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
228 } |
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 </script> |