Mercurial > gemma
changeset 3358:c0c880553cd5
client: import review: added section details (actually just the link to move the map to the feature)
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 21 May 2019 16:31:22 +0200 |
parents | 8d6e70a9ffcb |
children | af6d8020b4a6 |
files | client/src/components/importoverview/LogDetail.vue client/src/components/importoverview/SectionDetails.vue |
diffstat | 2 files changed, 75 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importoverview/LogDetail.vue Tue May 21 16:29:38 2019 +0200 +++ b/client/src/components/importoverview/LogDetail.vue Tue May 21 16:31:22 2019 +0200 @@ -3,7 +3,7 @@ <div class="d-flex border-bottom" style="padding-left: 3px;" - v-if="hasAdditionalInfo || isST || isSR" + v-if="hasAdditionalInfo || isST || isSEC || isSR" > <div v-if="hasAdditionalInfo"> <UISpinnerButton @@ -27,7 +27,8 @@ (LOS: {{ details.summary.los }}) </span> </div> - <StretchDetail v-if="isST && isPending" :entry="entry" /> + <SectionDetails v-if="isSEC && isPending" :entry="entry" /> + <StretchDetails v-if="isST && isPending" :entry="entry" /> <SoundingResultDetail :entry="entry" v-if="isSR && isPending" /> </div> <div @@ -71,7 +72,8 @@ export default { components: { SoundingResultDetail: () => import("./SoundingResultDetail"), - StretchDetail: () => import("./StretchDetails"), + StretchDetails: () => import("./StretchDetails"), + SectionDetails: () => import("./SectionDetails"), FairwayDimensionDetail: () => import("./FairwayDimensionDetail"), ApprovedGaugeMeasurementDetail: () => import("./ApprovedGaugeMeasurementDetail"), @@ -102,6 +104,9 @@ isST() { return this.kind === "ST"; }, + isSEC() { + return this.kind === "SEC"; + }, isSR() { return this.kind === "SR"; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/src/components/importoverview/SectionDetails.vue Tue May 21 16:31:22 2019 +0200 @@ -0,0 +1,67 @@ +<template> + <div> + <a @click="zoomToSection()" class="text-info pointer">{{ + details.summary.section + }}</a> + </div> +</template> + +<script> +/* This is Free Software under GNU Affero General Public License v >= 3.0 + * without warranty, see README.md and license for details. + * + * SPDX-License-Identifier: AGPL-3.0-or-later + * License-Filename: LICENSES/AGPL-3.0.txt + * + * Copyright (C) 2018 by via donau + * – Österreichische Wasserstraßen-Gesellschaft mbH + * Software engineering by Intevation GmbH + * + * Author(s): + * Thomas Junk <thomas.junk@intevation.de> + */ +import { displayError } from "@/lib/errors"; +import { mapState, mapGetters } from "vuex"; + +export default { + props: ["entry"], + mounted() { + this.$store.commit("imports/hideAdditionalInfo"); + }, + computed: { + ...mapState("imports", ["showAdditional", "details"]), + ...mapGetters("map", ["openLayersMap"]) + }, + methods: { + zoomToSection() { + const name = this.details.summary.section; + this.openLayersMap() + .getLayer("SECTIONS") + .setVisible(true); + this.$store + .dispatch("imports/loadSection", name) + .then(response => { + if (response.data.features.length < 1) + throw new Error("no feaures found for: " + name); + this.$store.commit( + "imports/selectedSectionId", + response.data.features[0].id + ); + this.$store.dispatch("map/moveToFeauture", { + feature: response.data.features[0], + zoom: 17, + preventZoomOut: true + }); + }) + .catch(error => { + console.log(error); + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); + } + } +}; +</script>