changeset 4206:cd267ed8371e stylesconfig

styles-config: deal with alpha values for colors
author Fadi Abbud <fadi.abbud@intevation.de>
date Wed, 14 Aug 2019 17:30:49 +0200
parents 9285e94d1061
children 9264d6405b4d
files client/src/components/map/Map.vue client/src/components/systemconfiguration/ColorSettings.vue schema/default_sysconfig.sql
diffstat 3 files changed, 39 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/map/Map.vue	Wed Aug 14 17:24:58 2019 +0200
+++ b/client/src/components/map/Map.vue	Wed Aug 14 17:30:49 2019 +0200
@@ -271,32 +271,25 @@
           );
         }
         // load configured bottleneck colors
-        HTTP.get("/system/style/Bottlenecks/stroke", {
+        HTTP.get("/system/settings", {
           headers: { "X-Gemma-Auth": localStorage.getItem("token") }
         })
           .then(response => {
-            let btlnStrokeC = response.data.code;
-            HTTP.get("/system/style/Bottlenecks/fill", {
-              headers: { "X-Gemma-Auth": localStorage.getItem("token") }
-            })
-              .then(response => {
-                let btlnFillC = response.data.code;
-                var newStyle = new Style({
-                  stroke: new Stroke({
-                    color: btlnStrokeC,
-                    width: 4
-                  }),
-                  fill: new Fill({
-                    color: btlnFillC
-                  })
-                });
-                this.layers.get("BOTTLENECKS").setStyle(newStyle);
-                this.$store.commit("gauges/deleteNashSutcliffeCache");
-                this.$store.dispatch("map/refreshLayers");
+            let btlnStrokeC = response.data.bottlenecks_stroke;
+            let btlnFillC = response.data.bottlenecks_fill;
+            console.log("aa");
+            var newStyle = new Style({
+              stroke: new Stroke({
+                color: btlnStrokeC,
+                width: 4
+              }),
+              fill: new Fill({
+                color: btlnFillC
               })
-              .catch(error => {
-                console.log(error);
-              });
+            });
+            this.layers.get("BOTTLENECKS").setStyle(newStyle);
+            this.$store.commit("gauges/deleteNashSutcliffeCache");
+            this.$store.dispatch("map/refreshLayers");
           })
           .catch(error => {
             console.log(error);
--- a/client/src/components/systemconfiguration/ColorSettings.vue	Wed Aug 14 17:24:58 2019 +0200
+++ b/client/src/components/systemconfiguration/ColorSettings.vue	Wed Aug 14 17:30:49 2019 +0200
@@ -182,8 +182,8 @@
           this.$store
             .dispatch("application/saveConfig", {
               bottlenecks_stroke:
-                feature.strokeColor.hex || feature.strokeColor,
-              bottlenecks_fill: feature.fillColor.hex || feature.fillColor
+                feature.strokeColor.hex8 || feature.strokeColor,
+              bottlenecks_fill: feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
@@ -192,17 +192,17 @@
         case "Stretches": {
           this.$store
             .dispatch("application/saveConfig", {
-              stretches_stroke: feature.strokeColor.hex || feature.strokeColor,
-              stretches_fill: feature.fillColor.hex || feature.fillColor
+              stretches_stroke: feature.strokeColor.hex8 || feature.strokeColor,
+              stretches_fill: feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
         }
-        case "sections": {
+        case "Sections": {
           this.$store
             .dispatch("application/saveConfig", {
-              stretches_stroke: feature.strokeColor.hex || feature.strokeColor,
-              stretches_fill: feature.fillColor.hex || feature.fillColor
+              stretches_stroke: feature.strokeColor.hex8 || feature.strokeColor,
+              stretches_fill: feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
@@ -211,9 +211,9 @@
           this.$store
             .dispatch("application/saveConfig", {
               fairwaydimensionslos1_stroke:
-                feature.strokeColor.hex || feature.strokeColor,
+                feature.strokeColor.hex8 || feature.strokeColor,
               fairwaydimensionslos1_fill:
-                feature.fillColor.hex || feature.fillColor
+                feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
@@ -222,9 +222,9 @@
           this.$store
             .dispatch("application/saveConfig", {
               fairwaydimensionslos2_stroke:
-                feature.strokeColor.hex || feature.strokeColor,
+                feature.strokeColor.hex8 || feature.strokeColor,
               fairwaydimensionslos2_fill:
-                feature.fillColor.hex || feature.fillColor
+                feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
@@ -233,9 +233,9 @@
           this.$store
             .dispatch("application/saveConfig", {
               fairwaydimensionslos3_stroke:
-                feature.strokeColor.hex || feature.strokeColor,
+                feature.strokeColor.hex8 || feature.strokeColor,
               fairwaydimensionslos3_fill:
-                feature.fillColor.hex || feature.fillColor
+                feature.fillColor.hex8 || feature.fillColor
             })
             .finally(() => this.$store.dispatch("application/loadConfig"));
           break;
--- a/schema/default_sysconfig.sql	Wed Aug 14 17:24:58 2019 +0200
+++ b/schema/default_sysconfig.sql	Wed Aug 14 17:30:49 2019 +0200
@@ -38,17 +38,17 @@
 INSERT INTO sys_admin.system_config VALUES ('morphology_classbreaks', '1:#ff00dd,1.5,1.7,1.9,2.1,2.3,2.5:#f25f20,2.7,2.9,3.1:#f7e40e,3.3,3.5,4:#8ad51a,4.5,5,5.5,6,6.5,7:#1414ff');
 INSERT INTO sys_admin.system_config VALUES ('morphology_classbreaks_compare', '-2:#06b100,-1.9,-1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,-1:#1cc68e,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,-0.2,-0.1,0:#c2c2c2,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1:#fff01a,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2:#f80012');
 INSERT INTO sys_admin.system_config VALUES ('bottlenecks_stroke','#fa28ff');
-INSERT INTO sys_admin.system_config VALUES ('bottlenecks_fill','#ff25c4');
-INSERT INTO sys_admin.system_config VALUES ('stretches_stroke','#fac800');
-INSERT INTO sys_admin.system_config VALUES ('stretches_fill','#fac80a');
-INSERT INTO sys_admin.system_config VALUES ('sections_stroke','#ff960a');
-INSERT INTO sys_admin.system_config VALUES ('sections_fill','#ff9600');
-INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos1_stroke','#0000ff');
-INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos1_fill','#f0e600');
-INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos2_stroke','#0000ff');
-INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos2_fill','#f0e600');
+INSERT INTO sys_admin.system_config VALUES ('bottlenecks_fill','#ff25c424');
+INSERT INTO sys_admin.system_config VALUES ('stretches_stroke','#fac800cc');
+INSERT INTO sys_admin.system_config VALUES ('stretches_fill','#fac80a4d');
+INSERT INTO sys_admin.system_config VALUES ('sections_stroke','#ff960acc');
+INSERT INTO sys_admin.system_config VALUES ('sections_fill','#ff96004d');
+INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos1_stroke','#0000ffcc');
+INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos1_fill','#f0e60033');
+INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos2_stroke','#0000ffe6');
+INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos2_fill','#f0e6001a1a');
 INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos3_stroke','#0000ff');
-INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos3_fill','#ffffff');
-INSERT INTO sys_admin.system_config VALUES ('waterwayprofiles_stroke','#0000ff');
+INSERT INTO sys_admin.system_config VALUES ('fairwaydimensionslos3_fill','#ffffff66');
+INSERT INTO sys_admin.system_config VALUES ('waterwayprofiles_stroke','#0000ff80');
 
 COMMIT;