annotate client/src/application/stores/application.js @ 1055:1ff8c072df18

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