Mercurial > gemma
changeset 1352:58113365c51d
Import sounding results: fix empty metajson not displaying dialog. Pattern constrained to .zip
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 26 Nov 2018 15:04:33 +0100 |
parents | 58d41573e530 |
children | d524d6f54f87 |
files | client/src/components/map/contextbox/ImportSoundingresults.vue |
diffstat | 1 files changed, 30 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/map/contextbox/ImportSoundingresults.vue Mon Nov 26 14:42:48 2018 +0100 +++ b/client/src/components/map/contextbox/ImportSoundingresults.vue Mon Nov 26 15:04:33 2018 +0100 @@ -1,7 +1,8 @@ <template> <div> <h6 class="mb-0 py-2 px-3 border-bottom d-flex align-items-center"> - <font-awesome-icon icon="upload" class="mr-2"></font-awesome-icon>Import Soundingresults + <font-awesome-icon icon="upload" class="mr-2"></font-awesome-icon>Import + Soundingresults </h6> <div v-if="editState" class="ml-auto mr-auto mt-4 w-95"> <div class="d-flex flex-row input-group mb-4"> @@ -35,25 +36,39 @@ <label class="label-text w-100 depthreferencelabel" for="depthreference">Depthreference</label> </div> <select v-model="depthReference" class="custom-select" id="depthreference"> - <option v-for="option in this.$options.depthReferenceOptions" :key="option">{{option}}</option> + <option v-for="option in this.$options.depthReferenceOptions" :key="option">{{ option }}</option> </select> </div> <div class="text-left"> - <small v-for="(message, index) in messages" :key="index">{{message}}</small> + <small v-for="(message, index) in messages" :key="index"> + {{ + message + }} + </small> </div> </div> <div class="w-95 ml-auto mr-auto mt-4 mb-4"> <div v-if="uploadState" class="d-flex flex-row input-group mb-4"> <div class="custom-file"> - <input type="file" @change="fileSelected" class="custom-file-input" id="uploadFile"> - <label class="custom-file-label" for="uploadFile">{{uploadLabel}}</label> + <input + accept=".zip" + type="file" + @change="fileSelected" + class="custom-file-input" + id="uploadFile" + > + <label class="custom-file-label" for="uploadFile"> + {{ + uploadLabel + }} + </label> </div> </div> <div class="buttons text-right"> <a v-if="editState" download="meta.json" - :href="dataLink " + :href="dataLink" class="btn btn-outline-info pull-left" >Download Meta.json</a> <button @@ -67,7 +82,7 @@ @click="submit" class="btn btn-info" type="button" - >{{uploadState?"Upload":"Confirm"}}</button> + >{{ uploadState ? "Upload" : "Confirm" }}</button> </div> </div> </div> @@ -99,6 +114,7 @@ name: "imports", data() { return { + availableBottlenecks: "", importState: IMPORTSTATE.UPLOAD, depthReference: "", bottleneck: "", @@ -163,12 +179,14 @@ } }) .then(response => { - const { bottleneck, date } = response.data.meta; - const depthReference = response.data.meta["depth-reference"]; + if (response.data.meta) { + const { bottleneck, date } = response.data.meta; + const depthReference = response.data.meta["depth-reference"]; + this.bottleneck = bottleneck; + this.depthReference = depthReference; + this.importDate = new Date(date).toISOString().split("T")[0]; + } this.importState = IMPORTSTATE.EDIT; - this.bottleneck = bottleneck; - this.depthReference = depthReference; - this.importDate = new Date(date).toISOString().split("T")[0]; this.token = response.data.token; this.messages = response.data.messages; })