Mercurial > gemma
diff client/src/components/systemconfiguration/Systemconfiguration.vue @ 2276:920fba6eef0d
moved color settings into own component
The configurations page will be accessible for waterway admins too. Roles will be checked for the individual components on this page. It's also better to read and code is better organized.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Fri, 15 Feb 2019 10:44:45 +0100 |
parents | e6fba449aa3c |
children | 5f3110aa1ad1 |
line wrap: on
line diff
--- a/client/src/components/systemconfiguration/Systemconfiguration.vue Fri Feb 15 09:47:57 2019 +0100 +++ b/client/src/components/systemconfiguration/Systemconfiguration.vue Fri Feb 15 10:44:45 2019 +0100 @@ -9,29 +9,8 @@ <translate class="headline">Systemconfiguration</translate> </h6> <div class="card-body text-left"> - <h5 class="border-bottom pb-3 mb-3"> - <translate>Color settings</translate> - </h5> - <div class="d-flex"> - <div> - <h6 class="card-title"> - <translate>Bottleneck Areas fill-color</translate> - </h6> - <chrome-picker v-model="fillColor" /> - </div> - <div class="ml-4"> - <h6 class="card-title"> - <translate>Bottleneck Areas stroke-color</translate> - </h6> - <compact-picker v-model="strokeColor" /> - </div> - </div> - <div class="mt-4"> - <a @click.prevent="submit" class="btn btn-info text-white"> - <translate>Send</translate> - </a> - </div> <PDFTemplates /> + <ColorSettings /> </div> <!-- card-body --> </div> @@ -60,100 +39,14 @@ * Author(s): * Thomas Junk <thomas.junk@intevation.de> * Bernhard Reiter <bernhard@intevation.de> + * Markus Kottländer <markus@intevation.de> */ -import { Chrome } from "vue-color"; -import { Compact } from "vue-color"; - -import { HTTP } from "@/lib/http"; -import { displayError } from "@/lib/errors.js"; -import { mapState } from "vuex"; - export default { name: "systemconfiguration", - data() { - return { - sent: false, - strokeColor: { r: 0, g: 0, b: 0, a: 1.0 }, - fillColor: { r: 0, g: 0, b: 0, a: 1.0 }, - currentConfig: null - }; - }, components: { - "chrome-picker": Chrome, - "compact-picker": Compact, Spacer: () => import("../Spacer"), - PDFTemplates: () => import("./PDFTemplates") - }, - computed: { - ...mapState("application", ["showSidebar"]) - }, - methods: { - submit() { - HTTP.put("/system/style/Bottlenecks/stroke", this.strokeColor.rgba, { - headers: { - "X-Gemma-Auth": localStorage.getItem("token"), - "Content-type": "application/json" - } - }) - .then() - .catch(error => { - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - 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: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }); - } - }, - mounted() { - HTTP.get("/system/style/Bottlenecks/stroke", { - headers: { - "X-Gemma-Auth": localStorage.getItem("token"), - "Content-type": "application/json" - } - }) - .then(response => { - this.strokeColor = response.data.colour; - }) - .catch(error => { - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - 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: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }); + PDFTemplates: () => import("./PDFTemplates"), + ColorSettings: () => import("./ColorSettings") } }; </script>