annotate client/src/systemconfiguration/systemconfiguration.vue @ 856:ce0d50b1d126

systemconfig WIP
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 28 Sep 2018 14:13:51 +0200
parents
children d1863e91b039
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>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2 <div class="d-flex flex-row">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 <div class="card sysconfig">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 <div class="card-header shadow-sm text-white bg-info mb-3">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5 Systemconfiguration
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 <div class="card-body">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 <div class="inputs form-group row">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 <div class="col-2">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 <label for="r"></label>R<input class="form-control form-control-sm" v-model="r" id="r" placeholder="r">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 <div class="col-2">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 <label for="g"></label>G<input class="form-control form-control-sm" v-model="g" id="g" placeholder="g">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 <div class="col-2">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16 <label for="b"></label>B<input class="form-control form-control-sm" v-model="b" id="b" placeholder="b">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18 <div class="col-2">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20 <label for="a"></label>A<input class="form-control form-control-sm" v-model="a" id="a" placeholder="a">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 <div class="sendbutton">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24 <a @click="submit" class="btn btn-info">Send</a>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 </div>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 </template>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 <style lang="scss">
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 .sendbutton {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33 position: absolute;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 right: $large-offset;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35 bottom: $large-offset;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 .inputs {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38 margin-left: auto;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39 margin-right: auto;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41 .sysconfig {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42 margin-top: $offset;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 margin-left: auto;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 margin-right: auto;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 width: 30vw;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46 height: 40vh;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48 </style>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50 <script>
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 import { HTTP } from "../application/lib/http";
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
52 import { displayError } from "../application/lib/errors.js";
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
53 export default {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
54 name: "systemconfiguration",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
55 data() {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
56 return {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
57 sent: false,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
58 r: 224,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
59 g: 215,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
60 b: 216,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
61 a: 90,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
62 currentConfig: null
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
63 };
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
64 },
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
65 methods: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
66 submit() {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
67 const payload = JSON.stringify({
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
68 r: this.r,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
69 g: this.g,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
70 b: this.b,
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
71 a: this.a
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
72 });
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
73 HTTP.put("/system/style/Bottlenecks/stroke", payload, {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
74 headers: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
75 "X-Gemma-Auth": localStorage.getItem("token"),
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
76 "Content-type": "text/xml; charset=UTF-8"
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
77 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
78 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
79 .then()
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
80 .catch(error => {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
81 this.loginFailed = true;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
82 this.submitted = false;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
83 const { status, data } = error.response;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
84 displayError({
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
85 title: "Backend Error",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
86 message: `${status}: ${data.message || data}`
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
87 });
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
88 });
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
89 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
90 },
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
91 mounted() {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
92 HTTP.get("/system/style/Bottlenecks/stroke", {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
93 headers: {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
94 "X-Gemma-Auth": localStorage.getItem("token"),
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
95 "Content-type": "text/xml; charset=UTF-8"
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
96 }
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
97 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
98 .then(response => {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
99 console.log(response);
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
100 })
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
101 .catch(error => {
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
102 this.loginFailed = true;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
103 this.submitted = false;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
104 const { status, data } = error.response;
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
105 displayError({
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
106 title: "Backend Error",
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
107 message: `${status}: ${data.message || data}`
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
108 });
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 };
ce0d50b1d126 systemconfig WIP
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
112 </script>