Mercurial > gemma
annotate client/src/components/ImportWaterwayProfiles.vue @ 2462:9ae2a2f758bb
client: make use of new table header/body components
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 04 Mar 2019 14:50:23 +0100 |
parents | f185503ef35a |
children | bb5286acfee2 |
rev | line source |
---|---|
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div class="d-flex flex-row"> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <Spacer></Spacer> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 <div class="card sysconfig mt-3 shadow-xs w-100 h-100 mr-3"> |
2387
f185503ef35a
client: unified box's header styles by creating a reusable component
Markus Kottlaender <markus@intevation.de>
parents:
2154
diff
changeset
|
5 <UIBoxHeader icon="upload" title="Import Waterway Profiles" /> |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 <div class="card-body stretches-card"> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 <div class="w-95 ml-auto mr-auto mt-4 mb-4"> |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
8 <div class="mb-4"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
9 <div class="d-flex flex-row"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
10 <div class="flex-column w-100"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
11 <div class="flex-row text-left"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
12 <small class="text-muted"> <translate>URL</translate> </small> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
13 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
14 <div class="w-100"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
15 <input class="form-control" type="url" v-model="url" /> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
16 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
17 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
18 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
19 <div v-if="!url" class="d-flex flex-row"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
20 <small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
21 ><translate class="text-danger" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
22 >Please enter a URL</translate |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
23 ></small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
24 > |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
25 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
26 <div class="d-flex flex-row"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
27 <div class="flex-column mt-3 mr-3 w-50"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
28 <div class="flex-row text-left"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
29 <small class="text-muted"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
30 <translate>Featuretype</translate> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
31 </small> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
32 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
33 <div class="w-100"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
34 <input |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
35 class="form-control" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
36 type="text" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
37 v-model="featureType" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
38 /> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
39 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
40 <div v-if="!featureType" class="d-flex flex-row"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
41 <small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
42 ><translate class="text-danger" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
43 >Please enter a Featuretype</translate |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
44 ></small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
45 > |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
46 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
47 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
48 <div class="flex-column mt-3 w-50"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
49 <div class="flex-row text-left"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
50 <small class="text-muted"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
51 <translate>SortBy</translate> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
52 </small> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
53 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
54 <div class="w-100"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
55 <input class="form-control" type="text" v-model="sortBy" /> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
56 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
57 <div v-if="!sortBy" class="d-flex flex-row"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
58 <small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
59 ><translate class="text-danger" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
60 >Please enter SortBy</translate |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
61 ></small |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
62 > |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
63 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
64 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
65 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
66 </div> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
67 <div class="d-flex flex-row text-left"> |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
68 <div class="mt-3 mb-3 flex-column w-100"> |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 <div class="custom-file"> |
1804 | 70 <input |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
71 accept=".csv" |
1804 | 72 type="file" |
73 @change="fileSelected" | |
74 class="custom-file-input" | |
75 id="uploadFile" | |
76 /> | |
2154
a08e0f532304
staging: improve UI
Thomas Junk <thomas.junk@intevation.de>
parents:
2135
diff
changeset
|
77 <label class="pointer custom-file-label" for="uploadFile"> |
1804 | 78 {{ uploadLabel }} |
79 </label> | |
80 </div> | |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 <div class="buttons text-right"> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
84 <button |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
85 :disabled="disableUploadButton" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 @click="submit" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 class="btn btn-info mt-4" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 type="button" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 > |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 <font-awesome-icon |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 class="fa-fw mr-2" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 fixed-width |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 icon="play" |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 ></font-awesome-icon> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 <translate>Trigger import</translate> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 </button> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
99 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 </div> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 </template> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 <script> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 * without warranty, see README.md and license for details. |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 * |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 * SPDX-License-Identifier: AGPL-3.0-or-later |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 * License-Filename: LICENSES/AGPL-3.0.txt |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 * |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 * Copyright (C) 2018 by via donau |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 * – Österreichische Wasserstraßen-Gesellschaft mbH |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 * Software engineering by Intevation GmbH |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 * |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 * Author(s): |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 * Thomas Junk <thomas.junk@intevation.de> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 */ |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
119 import { displayError, displayInfo } from "@/lib/errors.js"; |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
120 import { HTTP } from "@/lib/http"; |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 export default { |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 name: "importwaterwayprofiles", |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 data() { |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 return { |
2135
60c493aaee43
import_waterwayprofile: prefill url
Thomas Junk <thomas.junk@intevation.de>
parents:
2134
diff
changeset
|
126 url: "https://service.d4d-portal.info/wamos/wfs/", |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
127 sortBy: "hydro_scamin", |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
128 featureType: "ws-wamos:ienc_wtwprf", |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 disableUploadButton: false, |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
130 uploadLabel: this.$gettext("choose file to upload"), |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 uploadFile: null |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 }; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
133 }, |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 methods: { |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 fileSelected(e) { |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 const files = e.target.files || e.dataTransfer.files; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 if (!files) return; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
138 this.uploadLabel = files[0].name; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 this.uploadFile = files[0]; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
140 }, |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
141 submit() { |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
142 if (!this.url || !this.featureType || !this.sortBy || !this.uploadFile) |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
143 return; |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
144 let formData = new FormData(); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
145 formData.append("wp", this.uploadFile); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
146 formData.append("url", this.url); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
147 formData.append("feature-type", this.featureType); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
148 formData.append("sort-by", this.sortBy); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
149 HTTP.post("/imports/wp", formData, { |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
150 headers: { |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
151 "X-Gemma-Auth": localStorage.getItem("token"), |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
152 "Content-Type": "multipart/form-data" |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
153 } |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
154 }) |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
155 .then(() => { |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
156 displayInfo({ |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
157 title: this.$gettext("Import"), |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
158 message: this.$gettext( |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
159 this.uploadLabel + this.$gettext(" was successfully uploaded.") |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
160 ) |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
161 }); |
2135
60c493aaee43
import_waterwayprofile: prefill url
Thomas Junk <thomas.junk@intevation.de>
parents:
2134
diff
changeset
|
162 this.url = "https://service.d4d-portal.info/wamos/wfs/"; |
2134
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
163 this.uploadFile = null; |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
164 this.uploadLabel = this.$gettext("choose file to upload"); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
165 }) |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
166 .catch(error => { |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
167 const { status, data } = error.response; |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
168 const messages = data.messages ? data.messages.join(", ") : ""; |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
169 displayError({ |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
170 title: this.$gettext("Backend Error"), |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
171 message: `${status}: ${messages}` |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
172 }); |
8ad8ce85fcbf
import_waterwayprofiles: UI etd
Thomas Junk <thomas.junk@intevation.de>
parents:
2123
diff
changeset
|
173 }); |
1753
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
174 } |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
175 }, |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
176 components: { |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
177 Spacer: () => import("./Spacer") |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
178 } |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
179 }; |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
180 </script> |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
181 |
68bd990dd8e5
feat: added import dialogs for approved gauge meas. and waterway profiles
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
182 <style lang="scss" scoped></style> |