Mercurial > gemma
view client/src/components/KeyboardHandler.vue @ 5574:271888ef85bc surveysperbottleneckid
Finalize use of bottleneck id instead of name.
Main feaure is the restructuring of the /surveys endpoint.
The endpoint now takes queryparameters as qualifiers.
/surveys?id={id} returns surveys to a given bottleck {id}
/surveys?name={name} & date={date} returns surveys for given {name}
of a bottleneck and {date} for a surveydate.
This is needed mainly because there is some backwards incompatibility
when reviewing sounding results where the summary of a sr import
contains only the name instead of the id of the according bottleneck.
To bridge this mismatch the survey endpoint could be queried for the
sr to review given the surveydate and the name of the bottleneck.
Premise is here, that a date and a bottleneck's name is specific enough
to identify the correct survey with the correct bottleneck.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 21 Jul 2021 14:33:35 +0200 |
parents | 2ad3a29e0e14 |
children | 84d01a536bec |
line wrap: on
line source
<template> <transition name="fade"> <div class="notice" v-if="showNotice"> <span @click="stopOperation">{{ noticeText }}</span> </div> </transition> </template> <style lang="sass" scoped> .notice position: absolute top: 0 width: 100% text-align: center z-index: 1 font-size: 11px line-height: 11px > span opacity: 0.5 background: white display: inline-block border-bottom-right-radius: 0.25rem border-bottom-left-radius: 0.25rem padding: 3px 5px </style> <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): * Markus Kottländer <markus.kottlaender@intevation.de> */ import { mapState } from "vuex"; export default { computed: { ...mapState("application", ["paneSetup"]), ...mapState("map", [ "openLayersMaps", "lineToolEnabled", "polygonToolEnabled", "cutToolEnabled" ]), showNotice() { return ( this.lineToolEnabled || this.polygonToolEnabled || this.cutToolEnabled || this.paneSetup.includes("COMPARESURVEYS") ); }, noticeText() { if ( this.lineToolEnabled || this.polygonToolEnabled || this.cutToolEnabled ) { return this.$gettext("Press ESC to stop drawing."); } else if (this.paneSetup.includes("COMPARESURVEYS")) { return this.$gettext("Press ESC to close compare view."); } } }, methods: { closeCompareView() { this.$store.commit("fairwayprofile/additionalSurvey", null); }, stopDrawing() { this.$store.commit("map/lineToolEnabled", false); this.$store.commit("map/polygonToolEnabled", false); this.$store.commit("map/cutToolEnabled", false); this.$store.commit("map/setCurrentMeasurement", null); this.openLayersMaps.forEach(m => { m.getLayer("DRAWTOOL") .getSource() .clear(); }); }, stopOperation() { if ( this.lineToolEnabled || this.polygonToolEnabled || this.cutToolEnabled ) { this.stopDrawing(); } else if (this.paneSetup.includes("COMPARESURVEYS")) { this.closeCompareView(); } } }, mounted() { window.addEventListener("keydown", e => { // Escape if (e.key === "Esc" || e.key === "Escape") this.stopOperation(); }); } }; </script>