Mercurial > gemma
diff client/src/systemconfiguration/systemconfiguration.vue @ 864:2079fabbe6dd
client: add fill-colour setting to systemconfig
* Add simple headlines to show what we are setting.
* Add a section to select a colour with the vue-color chrome-picker.
* yarn add vue-color.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 28 Sep 2018 21:39:01 +0200 |
parents | d1863e91b039 |
children | 9aa545585bdd |
line wrap: on
line diff
--- a/client/src/systemconfiguration/systemconfiguration.vue Fri Sep 28 20:58:38 2018 +0200 +++ b/client/src/systemconfiguration/systemconfiguration.vue Fri Sep 28 21:39:01 2018 +0200 @@ -1,31 +1,34 @@ <template> - <div class="d-flex flex-row"> - <div class="card sysconfig"> - <div class="card-header shadow-sm text-white bg-info mb-6"> - Systemconfiguration + <div class="d-flex flex-row"> + <div class="card sysconfig"> + <div class="card-header shadow-sm text-white bg-info mb-6"> + Systemconfiguration + </div> + <div class="card-body"> + <h4>Bottleneck Areas stroke-color</h4> + <div class="inputs form-group row"> + <div class="col-2"> + <label for="r"></label>R<input class="form-control form-control-sm" v-model="r" id="r" placeholder="255"> </div> - <div class="card-body"> - <div class="inputs form-group row"> + <div class="col-2"> + <label for="g"></label>G<input class="form-control form-control-sm" v-model.number="g" type="text" id="g" placeholder="255"> + </div> <div class="col-2"> - <label for="r"></label>R<input class="form-control form-control-sm" v-model="r" id="r" placeholder="255"> - </div> + <label for="b"></label>B<input class="form-control form-control-sm" v-model.number="b" type="text" id="b" placeholder="255"> + </div> <div class="col-2"> - <label for="g"></label>G<input class="form-control form-control-sm" v-model.number="g" type="text" id="g" placeholder="255"> - </div> - <div class="col-2"> - <label for="b"></label>B<input class="form-control form-control-sm" v-model.number="b" type="text" id="b" placeholder="255"> - </div> - <div class="col-2"> - <label for="a"></label>A<input class="form-control form-control-sm" v-model.number="a" type="text" id="a" placeholder="1.0"> - </div> - </div> - <div class="sendbutton"> - <a @click="submit" class="btn btn-info">Send</a> - </div> - </div> + <label for="a"></label>A<input class="form-control form-control-sm" v-model.number="a" type="text" id="a" placeholder="1.0"> + </div> </div> - </div> + <div class="sendbutton"> + <a @click.prevent="submit" class="btn btn-info">Send</a> + </div> + <h4>Bottleneck Areas fill-color</h4> + <chrome-picker v-model="fillColor" /> + </div> <!-- card-body --> + </div> + </div> </template> <style lang="scss"> @@ -44,11 +47,14 @@ margin-right: auto; width: 60vw; max-width: 500px; - height: 40vh; + mind-heigth: 500px; + height: 80vh; } </style> <script> +import { Chrome } from "vue-color"; + import { HTTP } from "../application/lib/http"; import { displayError } from "../application/lib/errors.js"; export default { @@ -60,9 +66,11 @@ g: 115, b: 116, a: 0.9, + fillColor: { r: 0, g: 0, b: 0, a: 1.0 }, currentConfig: null }; }, + components: { "chrome-picker": Chrome }, methods: { submit() { const payload = { @@ -85,6 +93,21 @@ message: `${status}: ${data.message || data}` }); }); + + HTTP.put("/system/style/Bottlenecks/fill", this.fillColor.rgba, { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "application/json" + } + }) + .then() + .catch(error => { + const { status, data } = error.response; + displayError({ + title: "Backend Error", + message: `${status}: ${data.message || data}` + }); + }); } }, mounted() { @@ -109,6 +132,23 @@ message: `${status}: ${data.message || data}` }); }); + + HTTP.get("/system/style/Bottlenecks/fill", { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "application/json" + } + }) + .then(response => { + this.fillColor = response.data.colour; + }) + .catch(error => { + const { status, data } = error.response; + displayError({ + title: "Backend Error", + message: `${status}: ${data.message || data}` + }); + }); } }; </script>