view client/src/store/application.js @ 1123:d9e6a1f6f394 store-refactoring

moved all collapse flags for UI elements to store UI elements can now be expanded/collapsed via the application store
author Markus Kottlaender <markus@intevation.de>
date Tue, 06 Nov 2018 13:00:17 +0100
parents 1b160eda22cf
children 1d4801145a2d
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 { version } from "../../package.json";

export default {
  namespaced: true,
  state: {
    appTitle: process.env.VUE_APP_TITLE,
    secondaryLogo: process.env.VUE_APP_SECONDARY_LOGO_URL,
    showSidebar: false,
    showUsermenu: false,
    showBottlenecks: false,
    showSplitscreen: false,
    showSearchbar: false,
    showIdentify: false,
    showLayers: true,
    showPdfTool: false,
    countries: ["AT", "SK", "HU", "HR", "RS", "BiH", "BG", "RO", "UA"],
    version
  },
  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"))
      )
        versionStr += " " + process.env.VUE_APP_HGREV;

      return versionStr;
    }
  },
  mutations: {
    showSidebar: (state, show) => {
      state.showSidebar = show;
    },
    showBottlenecks: (state, show) => {
      state.showBottlenecks = show;
    },
    showSplitscreen: (state, show) => {
      state.showSplitscreen = 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;
    }
  }
};