Mercurial > gemma
view client/src/store/application.js @ 5560:f2204f91d286
Join the log lines of imports to the log exports to recover data from them.
Used in SR export to extract information that where in the meta json
but now are only found in the log.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 09 Feb 2022 18:34:40 +0100 |
parents | 48bef30cdb72 |
children |
line wrap: on
line source
/* 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> * Markus Kottländer <markus.kottlaender@intevation.de> * Bernhard E. Reiter <bernhard.reiter@intevation.de> */ import { displayError, displayInfo } from "@/lib/errors"; import { HTTP } from "@/lib/http"; import { version } from "../../package.json"; // initial state const init = () => { return { userManualUrl: process.env.VUE_APP_USER_MANUAL_URL, appTitle: process.env.VUE_APP_TITLE, secondaryLogo: process.env.VUE_APP_SECONDARY_LOGO_URL, logoForPDF: process.env.VUE_APP_LOGO_FOR_PDF_URL, popup: null, backendError: false, paneSetup: "DEFAULT", paneRotate: 1, showSidebar: false, showUsermenu: false, showSearchbar: false, showSearchbarLastState: false, showIdentify: false, showLayers: true, showPdfTool: false, showContextBox: false, showProfiles: false, showGauges: false, showFairwayDepth: false, showFairwayDepthLNWL: false, showTimeSlider: false, contextBoxContent: null, // bottlenecks, imports, staging expandToolbar: true, countries: ["AT", "SK", "HU", "HR", "RS", "BG", "RO"], searchQuery: "", selectedTime: new Date(), currentVisibleTime: new Date(), refreshLayersTime: new Date(), storedTime: new Date(), version, tempRoute: "", config: {}, ongoingPDFExport: false }; }; export default { init, namespaced: true, state: init(), getters: { versionStr: state => { // version number from package.json let versionStr = "v" + state.version; // hg revision if ( process.env.VUE_APP_HGREV && (state.version.includes("dev") || state.version.includes("beta") || state.version.includes("alpha")) ) // a '+' according to semver 2.0.0 starts a build meta info section // which shall only have [0-9A-Za-z-] chars // and is to be ignored when determining the order versionStr += "+" + process.env.VUE_APP_HGREV; return versionStr; } }, mutations: { setOngoingPDFExport: (state, ongoingPDFExport) => { state.ongoingPDFExport = ongoingPDFExport; }, setCurrentVisibleTime: (state, currentVisibleTime) => { state.currentVisibleTime = currentVisibleTime; }, setLayerRefreshedTime: (state, refreshLayersTime) => { state.refreshLayersTime = refreshLayersTime; }, setStoredTime: (state, storedTime) => { state.storedTime = storedTime; }, setTempRoute: (state, tempRoute) => { state.tempRoute = tempRoute; }, popup: (state, popup) => { state.popup = popup; }, paneSetup: (state, setup) => { state.paneSetup = setup; }, paneRotate: (state, rotate) => { if (rotate) { state.paneRotate = rotate; } else { state.paneRotate++; if (state.paneRotate === 5) state.paneRotate = 1; } }, setSelectedTime: (state, time) => { state.selectedTime = time; }, showTimeSlider: (state, show) => { state.showTimeSlider = show; }, showSidebar: (state, show) => { state.showSidebar = show; }, showUsermenu: (state, show) => { state.showUsermenu = show; }, showSearchbar: (state, show) => { state.showSearchbar = show; }, showIdentify: (state, show) => { state.showIdentify = show; }, showLayers: (state, show) => { state.showLayers = show; }, showPdfTool: (state, show) => { state.showPdfTool = show; }, showContextBox: (state, show) => { state.showContextBox = show; }, showProfiles: (state, show) => { state.showProfiles = show; }, showGauges: (state, show) => { state.showGauges = show; }, showFairwayDepth: (state, show) => { state.showFairwayDepth = show; }, showFairwayDepthLNWL: (state, show) => { state.showFairwayDepthLNWL = show; }, contextBoxContent: (state, context) => { state.contextBoxContent = context; if (context) { state.showSearchbarLastState = state.showSearchbar; } }, expandToolbar: (state, expandToolbar) => { state.expandToolbar = expandToolbar; }, searchQuery: (state, searchQuery) => { state.searchQuery = searchQuery; }, config: (state, config) => { state.config = config; }, setBackendErrorFlag: state => { state.backendError = true; }, removeBackendErrorFlag: state => { state.backendError = false; } }, actions: { reportBackendError({ commit }) { const TWOMINUTES = 2 * 60 * 1000; commit("setBackendErrorFlag"); setTimeout(() => { commit("removeBackendErrorFlag"); }, TWOMINUTES); }, loadConfig({ commit }) { return HTTP.get("/system/settings", { headers: { "X-Gemma-Auth": localStorage.getItem("token") } }).then(response => { commit("config", response.data); }); }, saveConfig(context, config) { return HTTP.put("/system/settings", config, { headers: { "X-Gemma-Auth": localStorage.getItem("token"), "Content-type": "application/json" } }) .then(() => { displayInfo({ message: "Configuration saved!" }); }) .catch(error => { const { status, data } = error.response; displayError({ title: "Backend Error", message: `${status}: ${data.message || data}` }); }); } } };