view client/src/store/application.js @ 2549:9bf6b767a56a

client: refactored and improved splitscreen for diagrams To make different diagrams possible, the splitscreen view needed to be decoupled from the cross profiles. Also the style has changed to make it more consistent with the rest of the app. The standard box header is now used and there are collapse and expand animations.
author Markus Kottlaender <markus@intevation.de>
date Fri, 08 Mar 2019 08:50:47 +0100
parents c06b001dc26b
children 83b938bf4da9
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";

// initial state
const init = () => {
  return {
    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,
    showSidebar: false,
    showUsermenu: false,
    showSplitscreen: false,
    splitscreenLoading: false,
    splitscreen: null,
    showSearchbar: false,
    showSearchbarLastState: false,
    showIdentify: false,
    showLayers: true,
    showPdfTool: false,
    showContextBox: false,
    showProfiles: false,
    contextBoxContent: null, // bottlenecks, imports, staging
    expandToolbar: false,
    countries: ["AT", "SK", "HU", "HR", "RS", "BiH", "BG", "RO", "UA"],
    searchQuery: "",
    version
  };
};

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: {
    popup: (state, popup) => {
      state.popup = popup;
    },
    showSidebar: (state, show) => {
      state.showSidebar = show;
    },
    showSplitscreen: (state, show) => {
      state.showSplitscreen = show;
    },
    splitscreenLoading: (state, loading) => {
      state.splitscreenLoading = loading;
    },
    splitscreen: (state, config) => {
      state.splitscreen = config;
    },
    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;
    },
    contextBoxContent: (state, context) => {
      state.contextBoxContent = context;
      if (context) {
        state.showSearchbarLastState = state.showSearchbar;
      }
    },
    expandToolbar: (state, expandToolbar) => {
      state.expandToolbar = expandToolbar;
    },
    searchQuery: (state, searchQuery) => {
      state.searchQuery = searchQuery;
    }
  }
};