Mercurial > gemma
view client/src/components/importconfiguration/types/Statsupdate.vue @ 5736:55892008ec96 default tip
Fixed a bunch of corner cases in WG import.
author | Sascha Wilde <wilde@sha-bang.de> |
---|---|
date | Wed, 29 May 2024 19:02:42 +0200 |
parents | 661e8a2deed9 |
children |
line wrap: on
line source
<template> <div> <div class="d-flex px-2"> <div class="flex-column w-100"> <div class="flex-row text-left"> <small class="text-muted"> <translate>Stats Update</translate> </small> </div> <div class="w-50"> <select v-model="selectedStatsUpdate" class="ml-1 mr-1 form-control form-control-sm" > <option value="" v-if="this.statsUpdates.length === 0" ><translate>No data selectable</translate></option > <option v-for="(option, index) in this.statsUpdates" :key="index" :value="option" >{{ option }}</option > </select> </div> </div> </div> <div v-if="!statsUpdate" class="d-flex px-2"> <small ><translate class="text-danger" >Please select stats to update</translate ></small > </div> </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 { HTTP } from "@/lib/http"; import { displayError } from "@/lib/errors"; export default { name: "statsupdate", props: ["statsUpdate"], data() { return { statsUpdates: [] }; }, mounted() { HTTP.get("/data/stats-updates", { headers: { "X-Gemma-Auth": localStorage.getItem("token") } }) .then(response => { this.statsUpdates = response.data["stats-updates"]; }) .catch(error => { let message = "Backend not reachable"; if (error.response) { const { status, data } = error.response; message = `${status}: ${data.message || data}`; } displayError({ title: this.$gettext("Backend Error"), message: message }); }); }, computed: { selectedStatsUpdate: { get() { return this.statsUpdate; }, set(value) { this.selected = value; this.$emit("statsUpdateChanged", value); } } } }; </script> <style></style>