Mercurial > gemma
changeset 5665:8fc26cc61ba8 clickable-links
Make BNs in log messages linkable
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 05 Dec 2023 12:22:39 +0100 |
parents | daa39433bef1 |
children | 37c2354a6024 |
files | client/src/components/importconfiguration/ImportDetails.vue client/src/components/importoverview/LogItem.vue |
diffstat | 2 files changed, 57 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/importconfiguration/ImportDetails.vue Mon Dec 04 12:44:04 2023 +0100 +++ b/client/src/components/importconfiguration/ImportDetails.vue Tue Dec 05 12:22:39 2023 +0100 @@ -152,7 +152,7 @@ } }, mounted() { - this.updateImport = !!this.Import + this.updateImport = !!this.Import; }, methods: { back() {
--- a/client/src/components/importoverview/LogItem.vue Mon Dec 04 12:44:04 2023 +0100 +++ b/client/src/components/importoverview/LogItem.vue Tue Dec 05 12:22:39 2023 +0100 @@ -31,15 +31,69 @@ 'font-weight-bold': /warn|error/.test(line.kind) } ]" - >{{ line.message }} + ><template v-for="part in line_message"> + <template v-if="/\w+_Bottleneck_?\d+/.test(part)"> + <a @click="showBottleneck(part)" href="#" :key="part">{{ part }}</a> + </template> + <template v-else> + {{ part }} + </template> + </template> </span> </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 { mapGetters } from "vuex"; + export default { name: "Item", - props: ["height", "line", "index"] + props: ["height", "line", "index"], + computed: { + ...mapGetters("bottlenecks", ["bottlenecksForDisplay"]), + line_message: { + get() { + const search = /(\w+_Bottleneck_?\d+)/g; + return this.line.message.replace(search, "||$1||").split("||"); + } + } + }, + methods: { + showBottleneck(bottleneck_id) { + const bottleneck = this.bottlenecksForDisplay.filter(bottlenecks => { + return bottlenecks.properties.bottleneck_id === bottleneck_id; + })[0]; + this.$store + .dispatch( + "bottlenecks/setSelectedBottleneck", + bottleneck.properties.bottleneck_id + ) + .then(() => { + this.$store.dispatch("map/moveToFeauture", { + feature: bottleneck, + zoom: 16, + preventZoomOut: true + }); + }); + this.$store.commit( + "bottlenecks/setBottleneckForPrint", + bottleneck.properties.name + ); + } + } }; </script>