Mercurial > gemma
annotate client/src/components/stretches/Stretches.vue @ 3915:f7f09f32d6e0
hydrological conditions: omit rendering, when container isn't visible
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 11 Jul 2019 13:51:26 +0200 |
parents | c2cba529658d |
children | 4d5cd3b5775a |
rev | line source |
---|---|
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
2 <div class="d-flex flex-column"> |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
3 <UIBoxHeader icon="road" :title="title" :closeCallback="$parent.close" /> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
4 <div class="position-relative"> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
5 <UISpinnerOverlay v-if="loading" /> |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
6 <StretchForm v-if="showForm" :editStretch="editStretch" /> |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
7 <div v-else> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
8 <UITableHeader |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
9 :columns="[ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
10 { id: 'properties.name', title: `${nameLabel}`, class: 'col-4' }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
11 { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
12 id: 'properties.date_info', |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 title: `${dateLabel}`, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 class: 'col-2' |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
15 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
17 id: 'properties.source_organization', |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 title: `${sourceorganizationLabel}`, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 class: 'col-3' |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 ]" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 /> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 <UITableBody |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 :data="filteredStretches() | sortTable(sortColumn, sortDirection)" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 > |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 <template v-slot:row="{ item: stretch }"> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
27 <div class="py-1 px-2 col-4"> |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
28 <a @click="moveMapToStretch(stretch)" href="#"> |
3265
f92f7c9df392
client: define stretches: fixed editing stretches
Markus Kottlaender <markus@intevation.de>
parents:
3263
diff
changeset
|
29 {{ stretch.properties.name }} |
f92f7c9df392
client: define stretches: fixed editing stretches
Markus Kottlaender <markus@intevation.de>
parents:
3263
diff
changeset
|
30 </a> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 </div> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
32 <div class="py-1 px-2 col-2"> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
33 {{ stretch.properties.date_info | surveyDate }} |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 </div> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
35 <div class="py-1 px-2 col-3"> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
36 {{ stretch.properties.source_organization }} |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
37 </div> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
38 <div class="py-1 px-2 col text-right"> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 <button |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
40 v-if="isInStaging(stretch.properties.name)" |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
41 @click="gotoStaging(stretch.properties.name)" |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
42 class="btn btn-xs btn-danger mr-1" |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
43 > |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
44 <font-awesome-icon |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
45 icon="exclamation-triangle" |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
46 fixed-width |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
47 v-tooltip="reviewTooltip" |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
48 /> |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
49 </button> |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
50 <button |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
51 class="btn btn-xs btn-dark mr-1" |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
52 @click=" |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
53 showForm = true; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
54 editStretch = stretch; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
55 " |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 > |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 <font-awesome-icon icon="pencil-alt" fixed-width /> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
58 </button> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 <button |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 class="btn btn-xs btn-dark" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
61 @click="deleteStretch(stretch)" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 > |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 <font-awesome-icon icon="trash" fixed-width /> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 </button> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
65 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
66 </template> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
67 </UITableBody> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
68 <div class="text-right p-2 border-top"> |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
69 <button |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
70 @click=" |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
71 showForm = true; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
72 editStretch = null; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
73 " |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
74 class="btn btn-sm btn-info" |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
75 > |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
76 <translate>New stretch</translate> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
77 </button> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
78 </div> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
81 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
82 </template> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
83 |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
84 <style lang="sass" scoped> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
85 .input-button |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
86 border-top-left-radius: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
87 border-bottom-left-radius: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
88 right: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
89 height: 31px |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
90 </style> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
91 |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 <script> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 * without warranty, see README.md and license for details. |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
95 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 * SPDX-License-Identifier: AGPL-3.0-or-later |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
97 * License-Filename: LICENSES/AGPL-3.0.txt |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 * Copyright (C) 2018, 2019 by via donau |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 * – Österreichische Wasserstraßen-Gesellschaft mbH |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 * Software engineering by Intevation GmbH |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
102 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
103 * Author(s): |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 * Thomas Junk <thomas.junk@intevation.de> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 * Tom Gottfried <tom.gottfried@intevation.de> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
106 */ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 import { mapState, mapGetters } from "vuex"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
108 import { displayError, displayInfo } from "@/lib/errors"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 import { HTTP } from "@/lib/http"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 import { sortTable } from "@/lib/mixins"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
112 export default { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
113 mixins: [sortTable], |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
114 components: { |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
115 StretchForm: () => import("./StretchForm") |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
116 }, |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 data() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
118 return { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
119 staging: [], |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
120 loading: false, |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
121 showForm: false, |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
122 editStretch: null |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 }; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 computed: { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
126 ...mapState("application", ["searchQuery"]), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
127 ...mapGetters("map", ["openLayersMap"]), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 ...mapState("imports", ["stretches"]), |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
129 title() { |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 return this.$gettext("Define Stretches"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
131 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
132 nameLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 return this.$gettext("Name"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
135 dateLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 return this.$gettext("Date"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 sourceorganizationLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
139 return this.$gettext("Source organization"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
140 }, |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
141 reviewTooltip() { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
142 return this.$gettext("Review pending import"); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
144 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
145 methods: { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 filteredStretches() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
147 return this.stretches.filter(s => { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
148 return (s.properties.name + s.properties.source_organization) |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
149 .toLowerCase() |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
150 .includes(this.searchQuery.toLowerCase()); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
151 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
152 }, |
3274
c1beed689439
client: define stretches: inlined method
Markus Kottlaender <markus@intevation.de>
parents:
3272
diff
changeset
|
153 gotoStaging(stretchName) { |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
154 let pendingImport = this.staging.find(s => s.name === stretchName); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
155 if (pendingImport) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
156 this.$router.push("/imports/overview/" + pendingImport.id); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
157 }, |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
158 isInStaging(stretchName) { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
159 return !!this.staging.find(s => s.name === stretchName); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
160 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 loadStagingData() { |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
162 HTTP.get("/imports?states=pending&kinds=st", { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
163 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
164 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
165 .then(response => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
166 response.data.imports.forEach(i => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
167 HTTP.get("/imports/" + i.id, { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
168 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
169 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
170 .then(response => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
171 this.staging.push({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
172 id: i.id, |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
173 name: response.data.summary.stretch |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
174 }); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
175 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
176 .catch(error => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
177 const { status, data } = error.response; |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
178 displayError({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
179 title: this.$gettext("Backend Error"), |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
180 message: `${status}: ${data.message || data}` |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
181 }); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
182 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
183 .finally(() => (this.loading = false)); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
184 }); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 }) |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
186 .catch(error => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
187 const { status, data } = error.response; |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
188 displayError({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
189 title: this.$gettext("Backend Error"), |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
190 message: `${status}: ${data.message || data}` |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
191 }); |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
192 }); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
193 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
194 deleteStretch(stretch) { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
195 this.$store.commit("application/popup", { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 icon: "trash", |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
197 title: this.$gettext("Delete Stretch"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
198 content: |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
199 this.$gettext("Do you really want to delete this stretch:") + |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 `<br> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
201 <b>${stretch.properties.name}, ${ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
202 stretch.properties.source_organization |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
203 } (${stretch.properties.countries})</b>`, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
204 confirm: { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
205 label: this.$gettext("Delete"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
206 icon: "trash", |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
207 callback: () => { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
208 displayInfo({ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
209 title: this.$gettext("Not implemented"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
210 message: this.$gettext("Deleting ") + stretch.id |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
211 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
212 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
213 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 cancel: { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
215 label: this.$gettext("Cancel"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
216 icon: "times" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
217 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
218 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
219 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
220 moveMapToStretch(stretch) { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
221 this.$store.commit("imports/selectedStretchId", stretch.id); |
3272
a9d047ccf408
client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents:
3265
diff
changeset
|
222 this.$store.commit("fairwayavailability/type", "stretches"); |
a9d047ccf408
client: fairway availability: set stretch in dialog when selecting stretch from map/list
Markus Kottlaender <markus@intevation.de>
parents:
3265
diff
changeset
|
223 this.$store.commit("application/showFairwayDepth", true); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 this.openLayersMap() |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 .getLayer("STRETCHES") |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 .setVisible(true); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 this.$store.dispatch("map/moveToFeauture", { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
228 feature: stretch, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 zoom: 17, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 preventZoomOut: true |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 mounted() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 this.loading = true; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 this.$store |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 .dispatch("imports/loadStretches") |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 .catch(error => { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 const { status, data } = error.response; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 displayError({ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 title: this.$gettext("Backend Error"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 message: `${status}: ${data.message || data}` |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 }) |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 .finally(() => (this.loading = false)); |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
246 this.loadStagingData(); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
248 }; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
249 </script> |