Mercurial > gemma
annotate client/src/components/stretches/Stretches.vue @ 4644:486495590483
Merged stree-experiment into default to benefit from diff improvements.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Sat, 12 Oct 2019 15:17:51 +0200 |
parents | 2e47b32a389d |
children | 008bc1ae8897 |
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 |
4337
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
51 class="btn btn-xs btn-dark mr-2" |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
52 @click="download(stretch)" |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
53 > |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
54 <font-awesome-icon icon="download" fixed-width /> |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
55 </button> |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
56 <button |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 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
|
58 @click="deleteStretch(stretch)" |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
59 > |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
60 <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
|
61 </button> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
62 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
63 </template> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
64 </UITableBody> |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
65 <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
|
66 <button |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
67 @click=" |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
68 showForm = true; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
69 editStretch = null; |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
70 " |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
71 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
|
72 > |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
73 <translate>New stretch</translate> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
74 </button> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
75 </div> |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
76 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
77 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
78 </div> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
79 </template> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
80 |
3281
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
81 <style lang="sass" scoped> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
82 .input-button |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
83 border-top-left-radius: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
84 border-bottom-left-radius: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
85 right: 0 |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
86 height: 31px |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
87 </style> |
439e1865a2d2
client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents:
3276
diff
changeset
|
88 |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
89 <script> |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
90 /* 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
|
91 * 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
|
92 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 * 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
|
94 * 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
|
95 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
96 * 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
|
97 * – Österreichische Wasserstraßen-Gesellschaft mbH |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
98 * Software engineering by Intevation GmbH |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
99 * |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
100 * Author(s): |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
101 * 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
|
102 * 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
|
103 */ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
104 import { mapState, mapGetters } from "vuex"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
105 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
|
106 import { HTTP } from "@/lib/http"; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
107 import { sortTable } from "@/lib/mixins"; |
4337
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
108 import { format } from "date-fns"; |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
109 |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
110 export default { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
111 mixins: [sortTable], |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
112 components: { |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
113 StretchForm: () => import("./StretchForm") |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
114 }, |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
115 data() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
116 return { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
117 staging: [], |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
118 loading: false, |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
119 showForm: false, |
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
120 editStretch: null |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
121 }; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
122 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
123 computed: { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
124 ...mapState("application", ["searchQuery"]), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
125 ...mapGetters("map", ["openLayersMap"]), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
126 ...mapState("imports", ["stretches"]), |
3289
c2cba529658d
client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents:
3281
diff
changeset
|
127 title() { |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
128 return this.$gettext("Define Stretches"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
129 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 nameLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
131 return this.$gettext("Name"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
132 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 dateLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
134 return this.$gettext("Date"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
135 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 sourceorganizationLabel() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
137 return this.$gettext("Source organization"); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
138 }, |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
139 reviewTooltip() { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
140 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
|
141 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
142 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 methods: { |
4337
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
144 download(stretch) { |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
145 const { name } = stretch.properties; |
4632
2e47b32a389d
client: encode strings in url paths
Fadi Abbud <fadi.abbud@intevation.de>
parents:
4393
diff
changeset
|
146 HTTP.get(`/data/stretch/shape/${encodeURIComponent(name)}`, { |
4337
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
147 responseType: "blob", |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
148 headers: { |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
149 "X-Gemma-Auth": localStorage.getItem("token") |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
150 } |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
151 }).then(response => { |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
152 const link = document.createElement("a"); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
153 const now = new Date(); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
154 link.href = window.URL.createObjectURL(response.data); |
4393
cdd332dbebbf
Fixed date in filename for stretch download.
Sascha Wilde <wilde@intevation.de>
parents:
4392
diff
changeset
|
155 link.download = `${name}-${format(now, "YYYY-MM-DD")}.zip`; |
4337
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
156 document.body.appendChild(link); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
157 link.click(); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
158 document.body.removeChild(link); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
159 }); |
086640dc0fba
stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents:
4284
diff
changeset
|
160 }, |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 filteredStretches() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
162 return this.stretches.filter(s => { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
163 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
|
164 .toLowerCase() |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
165 .includes(this.searchQuery.toLowerCase()); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
167 }, |
3274
c1beed689439
client: define stretches: inlined method
Markus Kottlaender <markus@intevation.de>
parents:
3272
diff
changeset
|
168 gotoStaging(stretchName) { |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
169 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
|
170 if (pendingImport) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
171 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
|
172 }, |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
173 isInStaging(stretchName) { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
174 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
|
175 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
176 loadStagingData() { |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
177 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
|
178 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
|
179 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
180 .then(response => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
185 .then(response => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
186 this.staging.push({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
187 id: i.id, |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
188 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
|
189 }); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
190 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
191 .catch(error => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
192 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
|
193 displayError({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
194 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
|
195 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
|
196 }); |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
197 }) |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
198 .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
|
199 }); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
200 }) |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
201 .catch(error => { |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
202 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
|
203 displayError({ |
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
204 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
|
205 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
|
206 }); |
3276
75db3199f76e
client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents:
3275
diff
changeset
|
207 }); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
208 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
209 deleteStretch(stretch) { |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
210 HTTP.post( |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
211 "/imports/dst", |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
212 { |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
213 id: stretch.id.split(".")[1] * 1 |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
214 }, |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
215 { |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
216 headers: { "X-Gemma-Auth": localStorage.getItem("token") } |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
217 } |
4392
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
218 ).then(() => { |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
219 displayInfo({ |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
220 title: this.$gettext("Staging Area"), |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
221 message: this.$gettext("Deleting ") + stretch.properties.objnam |
024b16a1c253
Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents:
4337
diff
changeset
|
222 }); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
223 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
224 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
225 moveMapToStretch(stretch) { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
226 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
|
227 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
|
228 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
|
229 this.openLayersMap() |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 .getLayer("STRETCHES") |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 .setVisible(true); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 this.$store.dispatch("map/moveToFeauture", { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 feature: stretch, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 zoom: 17, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 preventZoomOut: true |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 }); |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 }, |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 mounted() { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 this.loading = true; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
241 this.$store |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 .dispatch("imports/loadStretches") |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 .catch(error => { |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 const { status, data } = error.response; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 displayError({ |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
246 title: this.$gettext("Backend Error"), |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
247 message: `${status}: ${data.message || data}` |
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 }) |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
250 .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
|
251 this.loadStagingData(); |
3263
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
252 } |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
253 }; |
d23532a4d0c3
client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
254 </script> |