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

Transformed scss and sass styles into css
author Luisa Beerboom <lbeerboom@intevation.de>
date Thu, 11 May 2023 13:23:52 +0200
parents 6b054b91d9b2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
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
5629
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
81 <style scoped>
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
82 .input-button {
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
83 border-top-left-radius: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
84 border-bottom-left-radius: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
85 right: 0;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
86 height: 31px;
84d01a536bec Transformed scss and sass styles into css
Luisa Beerboom <lbeerboom@intevation.de>
parents: 4869
diff changeset
87 }
3281
439e1865a2d2 client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents: 3276
diff changeset
88 </style>
439e1865a2d2 client: define stretches/imports: code cleanup / style improvements
Markus Kottlaender <markus@intevation.de>
parents: 3276
diff changeset
89
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
90 <script>
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
91 /* 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
92 * 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
93 *
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
94 * 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
95 * 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
96 *
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
97 * 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
98 * – Österreichische Wasserstraßen-Gesellschaft mbH
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
99 * Software engineering by Intevation GmbH
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
100 *
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
101 * Author(s):
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
102 * 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
103 * 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
104 */
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
105 import { mapState, mapGetters } from "vuex";
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
106 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
107 import { HTTP } from "@/lib/http";
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
108 import { sortTable } from "@/lib/mixins";
4337
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
109 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
110
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
111 export default {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
112 mixins: [sortTable],
3289
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
113 components: {
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
114 StretchForm: () => import("./StretchForm")
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
115 },
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
116 data() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
117 return {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
118 staging: [],
3289
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
119 loading: false,
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
120 showForm: false,
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
121 editStretch: null
3263
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 },
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
124 computed: {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
125 ...mapState("application", ["searchQuery"]),
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
126 ...mapGetters("map", ["openLayersMap"]),
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
127 ...mapState("imports", ["stretches"]),
3289
c2cba529658d client: define stretches: seperated list and form into two components
Markus Kottlaender <markus@intevation.de>
parents: 3281
diff changeset
128 title() {
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
129 return this.$gettext("Define Stretches");
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
130 },
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
131 nameLabel() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
132 return this.$gettext("Name");
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
133 },
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
134 dateLabel() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
135 return this.$gettext("Date");
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
136 },
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
137 sourceorganizationLabel() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
138 return this.$gettext("Source organization");
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
139 },
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
140 reviewTooltip() {
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
141 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
142 }
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 methods: {
4337
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
145 download(stretch) {
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
146 const { name } = stretch.properties;
4632
2e47b32a389d client: encode strings in url paths
Fadi Abbud <fadi.abbud@intevation.de>
parents: 4393
diff changeset
147 HTTP.get(`/data/stretch/shape/${encodeURIComponent(name)}`, {
4337
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
148 responseType: "blob",
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
149 headers: {
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
150 "X-Gemma-Auth": localStorage.getItem("token")
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
151 }
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
152 }).then(response => {
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
153 const link = document.createElement("a");
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
154 const now = new Date();
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
155 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
156 link.download = `${name}-${format(now, "YYYY-MM-DD")}.zip`;
4337
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
157 document.body.appendChild(link);
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
158 link.click();
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
159 document.body.removeChild(link);
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
160 });
086640dc0fba stretches: download etd
Thomas Junk <thomas.junk@intevation.de>
parents: 4284
diff changeset
161 },
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
162 filteredStretches() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
163 return this.stretches.filter(s => {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
164 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
165 .toLowerCase()
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
166 .includes(this.searchQuery.toLowerCase());
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
167 });
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
168 },
3274
c1beed689439 client: define stretches: inlined method
Markus Kottlaender <markus@intevation.de>
parents: 3272
diff changeset
169 gotoStaging(stretchName) {
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
170 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
171 if (pendingImport)
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
172 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
173 },
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
174 isInStaging(stretchName) {
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
175 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
176 },
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
177 loadStagingData() {
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
178 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
179 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
180 })
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
181 .then(response => {
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
182 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
183 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
184 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
185 })
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
186 .then(response => {
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
187 this.staging.push({
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
188 id: i.id,
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
189 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
190 });
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
191 })
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
192 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
193 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
194 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
195 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
196 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
197 }
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
198 displayError({
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
199 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
200 message: message
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
201 });
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
202 })
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
203 .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
204 });
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
205 })
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
206 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
207 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
208 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
209 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
210 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
211 }
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
212 displayError({
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
213 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
214 message: message
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
215 });
3276
75db3199f76e client: define stretches: fixed review button for stretches with pending import
Markus Kottlaender <markus@intevation.de>
parents: 3275
diff changeset
216 });
3263
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 deleteStretch(stretch) {
4392
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
219 HTTP.post(
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
220 "/imports/dst",
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
221 {
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
222 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
223 },
4392
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
224 {
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
225 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
226 }
4392
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
227 ).then(() => {
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
228 displayInfo({
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
229 title: this.$gettext("Staging Area"),
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
230 message: this.$gettext("Deleting ") + stretch.properties.objnam
024b16a1c253 Implemented deletion of stretches.
Sascha Wilde <wilde@intevation.de>
parents: 4337
diff changeset
231 });
3263
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 moveMapToStretch(stretch) {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
235 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
236 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
237 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
238 this.openLayersMap()
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
239 .getLayer("STRETCHES")
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
240 .setVisible(true);
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
241 this.$store.dispatch("map/moveToFeauture", {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
242 feature: stretch,
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
243 zoom: 17,
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
244 preventZoomOut: true
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
245 });
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
246 }
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 mounted() {
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
249 this.loading = true;
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
250 this.$store
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
251 .dispatch("imports/loadStretches")
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
252 .catch(error => {
4869
6b054b91d9b2 backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents: 4868
diff changeset
253 let message = "Backend not reachable";
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
254 if (error.response) {
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
255 const { status, data } = error.response;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
256 message = `${status}: ${data.message || data}`;
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
257 }
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
258 displayError({
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
259 title: this.$gettext("Backend Error"),
4868
008bc1ae8897 exception handling
Thomas Junk <thomas.junk@intevation.de>
parents: 4632
diff changeset
260 message: message
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
261 });
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
262 })
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
263 .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
264 this.loadStagingData();
3263
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
265 }
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
266 };
d23532a4d0c3 client: define stretches: renamed component file and moved to subdirectory
Markus Kottlaender <markus@intevation.de>
parents:
diff changeset
267 </script>