annotate client/src/store/application.js @ 1115:1b160eda22cf store-refactoring

moved drawMode to map store
author Markus Kottlaender <markus@intevation.de>
date Mon, 05 Nov 2018 14:05:01 +0100
parents 8d12056d602a
children d9e6a1f6f394
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1063
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
1 /* This is Free Software under GNU Affero General Public License v >= 3.0
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
2 * without warranty, see README.md and license for details.
1063
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
3 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
4 * SPDX-License-Identifier: AGPL-3.0-or-later
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
5 * License-Filename: LICENSES/AGPL-3.0.txt
1063
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
6 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
7 * Copyright (C) 2018 by via donau
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
8 * – Österreichische Wasserstraßen-Gesellschaft mbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
9 * Software engineering by Intevation GmbH
1063
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
10 *
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
11 * Author(s):
1063
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
12 * Thomas Junk <thomas.junk@intevation.de>
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
13 * Markus Kottländer <markus.kottlaender@intevation.de>
7ec2133c6404 client: add area measurement. simpify code
Bernhard Reiter <bernhard@intevation.de>
parents: 1055
diff changeset
14 * Bernhard E. Reiter <bernhard.reiter@intevation.de>
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
15 */
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
16
1096
aa1f5daf6fc9 refac: centralized stores
Thomas Junk <thomas.junk@intevation.de>
parents: 1063
diff changeset
17 import { version } from "../../package.json";
1014
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
18
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 const defaultCollapseState = true;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20
647
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
21 const initializeSplitScreen = () => {
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
22 return {
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
23 active: false,
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
24 mode: "v"
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
25 };
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
26 };
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
27
1114
8d12056d602a shortened store file imports
Markus Kottlaender <markus@intevation.de>
parents: 1096
diff changeset
28 export default {
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 namespaced: true,
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30 state: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 appTitle: process.env.VUE_APP_TITLE,
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 secondaryLogo: process.env.VUE_APP_SECONDARY_LOGO_URL,
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 sidebar: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 iscollapsed: defaultCollapseState
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35 },
1055
1ff8c072df18 WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
36 bottlenecksCollapsed: true,
647
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
37 splitsceen: initializeSplitScreen(),
622
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
38 usermenu: {
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
39 iscollapsed: defaultCollapseState
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
40 },
649
83081ba6c9c1 feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents: 647
diff changeset
41 countries: ["AT", "SK", "HU", "HR", "RS", "BiH", "BG", "RO", "UA"],
1014
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
42 version
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 getters: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 countries: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 return state.countries;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 sidebarCollapsed: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 return state.sidebar.iscollapsed;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 },
622
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
51 isUsermenuCollapsed: state => {
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
52 return state.usermenu.iscollapsed;
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
53 },
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 appTitle: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 return state.appTitle;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 secondaryLogo: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 return state.secondaryLogo;
593
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
59 },
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
60 isSplitscreen: state => {
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
61 return state.splitsceen.active;
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
62 },
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
63 splitMode: state => {
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
64 return state.splitsceen.mode;
649
83081ba6c9c1 feat: Linetool added
Thomas Junk <thomas.junk@intevation.de>
parents: 647
diff changeset
65 },
1014
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
66 versionStr: state => {
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
67 // version number from package.json
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
68 let versionStr = "v" + state.version;
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
69
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
70 // hg revision
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
71 if (
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
72 process.env.VUE_APP_HGREV &&
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
73 (state.version.includes("dev") ||
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
74 state.version.includes("beta") ||
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
75 state.version.includes("alpha"))
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
76 )
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
77 versionStr += " " + process.env.VUE_APP_HGREV;
1014
77202406b1a7 reverted demo build target, include revision number based on version tag
Markus Kottlaender <markus@intevation.de>
parents: 810
diff changeset
78
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 1014
diff changeset
79 return versionStr;
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 mutations: {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 toggleSidebar: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 state.sidebar.iscollapsed = !state.sidebar.iscollapsed;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 },
1055
1ff8c072df18 WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
86 toggleBottlenecks: state => {
1ff8c072df18 WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
87 state.bottlenecksCollapsed = !state.bottlenecksCollapsed;
1ff8c072df18 WIP: Bottleneck list/table
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
88 },
622
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
89 toggleUserMenu: state => {
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
90 state.usermenu.iscollapsed = !state.usermenu.iscollapsed;
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
91 },
593
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
92 toggleSplitScreen: state => {
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
93 state.splitsceen.active = !state.splitsceen.active;
c4a4dc612191 feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents: 585
diff changeset
94 },
810
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
95 openSplitScreen: state => {
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
96 state.splitsceen.active = true;
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
97 },
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
98 closeSplitScreen: state => {
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
99 state.splitsceen.active = false;
68a39aea942a Fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents: 649
diff changeset
100 },
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 resetSidebar: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 state.sidebar.iscollapsed = defaultCollapseState;
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 collapseSidebar: state => {
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 state.sidebar.iscollapsed = true;
622
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
106 },
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
107 resetUserMenu: state => {
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
108 state.usermenu.iscollapsed = defaultCollapseState;
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
109 },
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
110 collapseUserMenu: state => {
47f11401d999 feat: Usermenu is now collapsible
Thomas Junk <thomas.junk@intevation.de>
parents: 593
diff changeset
111 state.usermenu.iscollapsed = true;
647
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
112 },
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
113 resetSplitScreen: state => {
620a65f11b33 fix: splitscreenoption has to be reset for logout
Thomas Junk <thomas.junk@intevation.de>
parents: 622
diff changeset
114 state.splitsceen = initializeSplitScreen();
585
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
115 }
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 },
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 actions: {}
ef307bd6b5d8 refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 };