annotate client/src/systemconfiguration/systemconfiguration.vue @ 1191:b23622905a3f

switched entirely to sass instead of scss for cleaner code/less lines, just removed all ; and {}
author Markus Kottlaender <markus@intevation.de>
date Fri, 16 Nov 2018 14:37:07 +0100
parents ca628dce90dd
children ba8cd80d68b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 <template>
887
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
2 <div class="d-flex flex-row">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
3 <div class="card sysconfig">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
4 <div class="card-header shadow-sm text-white bg-info mb-6">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
5 Systemconfiguration
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
6 </div>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
7 <div class="card-body config">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
8 <section class="configsection">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
9 <h4 class="card-title">Bottleneck Areas stroke-color</h4>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
10 <compact-picker v-model="strokeColor" />
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
11 </section>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
12 <section>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
13 <h4 class="card-title">Bottleneck Areas fill-color</h4>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
14 <chrome-picker v-model="fillColor" />
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
15 </section>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
16 <div class="sendbutton">
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
17 <a @click.prevent="submit" class="btn btn-info">Send</a>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
18 </div>
aae517757923 fix: layout systemconfig
Thomas Junk <thomas.junk@intevation.de>
parents: 866
diff changeset
19 </div> <!-- card-body -->
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
20 </div>
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
21 </div>
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 </template>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23
1191
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
24 <style scoped lang="sass">
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
25 .config
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
26 text-align: left
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
27
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
28 .configsection
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
29 margin-bottom: $large-offset
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
30
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
31 .sendbutton
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
32 position: absolute
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
33 right: $offset
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
34 bottom: $offset
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
35
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
36 .inputs
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
37 margin-left: auto
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
38 margin-right: auto
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
39
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
40 .sysconfig
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
41 margin-top: $offset
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
42 margin-left: auto
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
43 margin-right: auto
b23622905a3f switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents: 1019
diff changeset
44 width: 30vw
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 </style>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 <script>
1019
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
48 /*
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
49 * This is Free Software under GNU Affero General Public License v >= 3.0
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
50 * without warranty, see README.md and license for details.
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
51 *
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
52 * SPDX-License-Identifier: AGPL-3.0-or-later
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
53 * License-Filename: LICENSES/AGPL-3.0.txt
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
54 *
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
55 * Copyright (C) 2018 by via donau
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
56 * – Österreichische Wasserstraßen-Gesellschaft mbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
57 * Software engineering by Intevation GmbH
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
58 *
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
59 * Author(s):
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
60 * Thomas Junk <thomas.junk@intevation.de>
ca628dce90dd Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents: 887
diff changeset
61 */
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
62 import { Chrome } from "vue-color";
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
63 import { Compact } from "vue-color";
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
64
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 import { HTTP } from "../application/lib/http";
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 import { displayError } from "../application/lib/errors.js";
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 export default {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 name: "systemconfiguration",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 data() {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 return {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 sent: false,
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
72 strokeColor: { r: 0, g: 0, b: 0, a: 1.0 },
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
73 fillColor: { r: 0, g: 0, b: 0, a: 1.0 },
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 currentConfig: null
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 };
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 },
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
77 components: { "chrome-picker": Chrome, "compact-picker": Compact },
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 methods: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 submit() {
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
80 HTTP.put("/system/style/Bottlenecks/stroke", this.strokeColor.rgba, {
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 headers: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 "X-Gemma-Auth": localStorage.getItem("token"),
863
d1863e91b039 client: fix systemconfiguration for stroke colour
Bernhard Reiter <bernhard@intevation.de>
parents: 856
diff changeset
83 "Content-type": "application/json"
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 .then()
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 .catch(error => {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 const { status, data } = error.response;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 displayError({
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 title: "Backend Error",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 message: `${status}: ${data.message || data}`
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 });
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 });
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
94
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
95 HTTP.put("/system/style/Bottlenecks/fill", this.fillColor.rgba, {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
96 headers: {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
97 "X-Gemma-Auth": localStorage.getItem("token"),
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
98 "Content-type": "application/json"
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
99 }
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
100 })
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
101 .then()
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
102 .catch(error => {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
103 const { status, data } = error.response;
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
104 displayError({
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
105 title: "Backend Error",
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
106 message: `${status}: ${data.message || data}`
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
107 });
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
108 });
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
109 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
110 },
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
111 mounted() {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 HTTP.get("/system/style/Bottlenecks/stroke", {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
113 headers: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
114 "X-Gemma-Auth": localStorage.getItem("token"),
863
d1863e91b039 client: fix systemconfiguration for stroke colour
Bernhard Reiter <bernhard@intevation.de>
parents: 856
diff changeset
115 "Content-type": "application/json"
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
116 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
117 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
118 .then(response => {
866
9aa545585bdd Replaced color setting for bottleneck stroke with compact picker.
Sascha Wilde <wilde@intevation.de>
parents: 864
diff changeset
119 this.strokeColor = response.data.colour;
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
120 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
121 .catch(error => {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
122 const { status, data } = error.response;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
123 displayError({
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
124 title: "Backend Error",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
125 message: `${status}: ${data.message || data}`
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
126 });
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
127 });
864
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
128
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
129 HTTP.get("/system/style/Bottlenecks/fill", {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
130 headers: {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
131 "X-Gemma-Auth": localStorage.getItem("token"),
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
132 "Content-type": "application/json"
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
133 }
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
134 })
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
135 .then(response => {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
136 this.fillColor = response.data.colour;
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
137 })
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
138 .catch(error => {
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
139 const { status, data } = error.response;
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
140 displayError({
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
141 title: "Backend Error",
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
142 message: `${status}: ${data.message || data}`
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
143 });
2079fabbe6dd client: add fill-colour setting to systemconfig
Bernhard Reiter <bernhard@intevation.de>
parents: 863
diff changeset
144 });
856
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
145 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
146 };
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
147 </script>