view client/src/components/App.vue @ 3678:8f58851927c0

client: make layer factory only return new layer config for individual maps instead of each time it is invoked. The purpose of the factory was to support multiple maps with individual layers. But returning a new config each time it is invoked leads to bugs that rely on the layer's state. Now this factory reuses the same objects it created before, per map.
author Markus Kottlaender <markus@intevation.de>
date Mon, 17 Jun 2019 17:31:35 +0200
parents 869505c5087b
children 6ce80daf8413
line wrap: on
line source

<template>
  <div id="app" class="main">
    <div v-if="isAuthenticated" class="d-flex flex-column userinterface">
      <div class="boxes d-flex p-2">
        <div class="mr-auto d-flex">
          <Sidebar />
          <div :class="searchContainer">
            <Search v-if="isMapVisible" />
            <Contextbox v-if="isMapVisible" />
          </div>
        </div>
        <div class="ml-auto d-flex">
          <div class="d-flex flex-column align-items-end">
            <Profiles v-if="isMapVisible" />
            <Gauges v-if="isMapVisible" />
            <Pdftool v-if="isMapVisible" />
            <AvailableFairwayDepthDialogue v-if="isMapVisible" />
          </div>
          <div class="d-flex flex-column align-items-end">
            <Identify v-if="isMapVisible" />
            <Layers v-if="isMapVisible" />
          </div>
          <Toolbar v-if="isMapVisible" />
        </div>
      </div>
      <MapPopup />
    </div>
    <router-view />
    <vue-snotify />
    <Popup />
    <KeyboardHandler />
  </div>
</template>

<style lang="sass" scoped>
#app
  height: 100%
  width: 100%
  font-family: "Avenir", Helvetica, Arial, sans-serif
  -webkit-font-smoothing: antialiased
  -moz-osx-font-smoothing: grayscale
  text-align: center
  color: #2c3e50

  .userinterface
    position: absolute
    top: 0
    left: 0
    right: 0
    bottom: 0
    z-index: 4
    pointer-events: none

    .boxes
      position: relative
      z-index: 10
</style>

<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>
 * Markus Kottländer <markus.kottlaender@intevation.de>
 */
import { mapState } from "vuex";

export default {
  name: "app",
  computed: {
    ...mapState("user", ["isAuthenticated"]),
    ...mapState("application", ["contextBoxContent", "showSearchbar"]),
    isMapVisible() {
      return /importconfiguration|importoverview|stretches|sections|review|bottlenecks|mainview/.test(
        this.$route.name
      );
    },
    searchContainer() {
      return [
        "ml-2",
        {
          wide: this.showSearchbar
        }
      ];
    }
  },
  components: {
    Profiles: () => import("./fairway/Profiles"),
    Gauges: () => import("./gauge/Gauges"),
    Pdftool: () => import("./Pdftool"),
    Identify: () => import("./identify/Identify"),
    Layers: () => import("./layers/Layers"),
    Sidebar: () => import("./Sidebar"),
    Search: () => import("./Search"),
    Contextbox: () => import("./Contextbox"),
    Toolbar: () => import("./toolbar/Toolbar"),
    Popup: () => import("./Popup"),
    AvailableFairwayDepthDialogue: () =>
      import("./fairway/AvailableFairwayDepthDialogue.vue"),
    MapPopup: () => import("./map/MapPopup"),
    KeyboardHandler: () => import("./KeyboardHandler")
  }
};
</script>