Mercurial > gemma
annotate client/src/application/Main.vue @ 1201:37889ae85133
moved search icon/bar to the left, next to main menu
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 19 Nov 2018 09:09:27 +0100 |
parents | 74e180ad3d6b |
children |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
621
b17a4482d07d
feat: UI adaptation of 4 slots
Thomas Junk <thomas.junk@intevation.de>
parents:
593
diff
changeset
|
2 <div class="main d-flex flex-column"> |
1123
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1111
diff
changeset
|
3 <Maplayer :split="showSplitscreen" :lat="6155376" :long="1819178" :zoom="11"></Maplayer> |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
4 <FairwayProfile |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
5 :additionalSurveys="additionalSurveys" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
6 :height="height" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
7 :width="width" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
8 :xScale="xAxis" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
9 :yScaleLeft="yAxisLeft" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
10 :yScaleRight="yAxisRight" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
11 :margin="margins" |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
12 ></FairwayProfile> |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
13 </div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
17 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
18 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
19 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
20 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
21 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
22 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
23 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
24 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
25 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
26 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
27 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
28 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
29 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
30 */ |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
1015
diff
changeset
|
31 |
592
8e67604d972a
moved main.vue to application
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
32 import Maplayer from "../map/Maplayer"; |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
33 import FairwayProfile from "../fairway/Fairwayprofile"; |
1144 | 34 import { mapState } from "vuex"; |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
35 import debounce from "debounce"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 name: "mainview", |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 components: { |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
40 Maplayer, |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
41 FairwayProfile |
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
42 }, |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
43 data() { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
44 return { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
45 width: null, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
46 height: null, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
47 margin: { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
48 top: 20, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
49 right: 40, |
901
36731fbe51a2
bottom margin increased for bottleneckdeselection
Thomas Junk <thomas.junk@intevation.de>
parents:
879
diff
changeset
|
50 bottom: 30, |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
51 left: 40 |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
52 } |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
53 }; |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
54 }, |
593
c4a4dc612191
feat: Toggleable fairway profile
Thomas Junk <thomas.junk@intevation.de>
parents:
592
diff
changeset
|
55 computed: { |
1123
d9e6a1f6f394
moved all collapse flags for UI elements to store
Markus Kottlaender <markus@intevation.de>
parents:
1111
diff
changeset
|
56 ...mapState("application", ["showSplitscreen"]), |
1013
15c3cc6f29a4
refac: fairwayprofile store cleanup
Thomas Junk <thomas.junk@intevation.de>
parents:
909
diff
changeset
|
57 ...mapState("fairwayprofile", [ |
780 | 58 "currentProfile", |
59 "minAlt", | |
60 "maxAlt", | |
786
1bee00039973
fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
780
diff
changeset
|
61 "totalLength", |
802
327aa4a18a1c
Fairway profile WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
786
diff
changeset
|
62 "waterLevels", |
841 | 63 "fairwayCoordinates", |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
64 "selectedWaterLevel" |
780 | 65 ]), |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
66 ...mapState("bottlenecks", ["surveys", "selectedSurvey"]), |
1015
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1013
diff
changeset
|
67 additionalSurveys() { |
1111
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
68 if (!this.surveys) return []; |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
69 if (!this.selectedSurvey) return this.surveys; |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
70 return this.surveys.filter(survey => { |
f106aee673e7
selected bottleneck and surveys now handled by bottleneck store
Markus Kottlaender <markus@intevation.de>
parents:
1106
diff
changeset
|
71 return survey.date_info !== this.selectedSurvey.date_info; |
1015
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1013
diff
changeset
|
72 }); |
d2f30a784fb3
feat: add selectfield to fairwayprofile
Thomas Junk <thomas.junk@intevation.de>
parents:
1013
diff
changeset
|
73 }, |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
74 xAxis() { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
75 return [this.xScale.x, this.xScale.y]; |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
76 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
77 yAxisLeft() { |
845 | 78 const hi = Math.max(this.maxAlt, this.selectedWaterLevel); |
79 return [this.yScaleLeft.lo, hi]; | |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
80 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
81 yAxisRight() { |
1094
80b47f5d41c3
refac: use 10% relative to scale as buffer for scale dimensions
Thomas Junk <thomas.junk@intevation.de>
parents:
1076
diff
changeset
|
82 const DELTA = this.maxAlt * 1.1 - this.maxAlt; |
1076
e99b2b7d76a1
feat: fairwayprofile configurable scale-delta for profile added
Thomas Junk <thomas.junk@intevation.de>
parents:
1075
diff
changeset
|
83 return [this.maxAlt * 1 + DELTA, -DELTA]; |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
84 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
85 margins() { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
86 return this.margin; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
87 }, |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
88 yScaleLeft() { |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
89 return { |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
90 lo: this.minAlt, |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
91 hi: this.maxAlt |
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
92 }; |
780 | 93 }, |
94 xScale() { | |
95 return { | |
96 x: 0, | |
97 y: this.totalLength | |
98 }; | |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
99 } |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
100 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
101 created() { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
102 window.addEventListener("resize", debounce(this.scaleFairwayProfile), 100); |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
849
diff
changeset
|
103 window.addEventListener("onbeforeprint", this.test); |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
104 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
105 updated() { |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
106 this.scaleFairwayProfile(); |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
107 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
108 destroyed() { |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
109 window.removeEventListener("resize", debounce(this.scaleFairwayProfile)); |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
110 }, |
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
111 methods: { |
879
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
849
diff
changeset
|
112 test(evt) { |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
849
diff
changeset
|
113 console.log("test: ", evt); |
52fe3e20f750
client: improve print styling
Bernhard Reiter <bernhard@intevation.de>
parents:
849
diff
changeset
|
114 }, |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
115 scaleFairwayProfile() { |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
116 if (!document.querySelector(".fairwayprofile")) return; |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
117 const clientHeight = document.querySelector(".fairwayprofile") |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
118 .clientHeight; |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
119 const clientWidth = document.querySelector(".fairwayprofile").clientWidth; |
767
dedf252b3e01
feat: fairwayprofile partially with retrieved data from the server
Thomas Junk <thomas.junk@intevation.de>
parents:
713
diff
changeset
|
120 if (!clientHeight || !clientWidth) return; |
1146
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
121 this.height = clientHeight; |
74e180ad3d6b
fairway profile UI improvements
Markus Kottlaender <markus@intevation.de>
parents:
1144
diff
changeset
|
122 this.width = clientWidth; |
646
4450f2ab41e0
refac: Fairwawprofile view adapted
Thomas Junk <thomas.junk@intevation.de>
parents:
629
diff
changeset
|
123 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 </script> |