Mercurial > gemma
comparison client/src/lib/classifications.js @ 4266:fbe2f1aa2757
styles: refactor color coding accuracy colors
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 27 Aug 2019 14:22:45 +0200 |
parents | 2596a028dc3a |
children | e4d6c6339cb4 |
comparison
equal
deleted
inserted
replaced
4265:2596a028dc3a | 4266:fbe2f1aa2757 |
---|---|
58 store.state.application.config.gm_latest_hours * 60 * 60 * 1000 | 58 store.state.application.config.gm_latest_hours * 60 * 60 * 1000 |
59 ) { | 59 ) { |
60 // at least configured amount of measurements in last 14 days | 60 // at least configured amount of measurements in last 14 days |
61 const valuesAtLeast = store.state.application.config.gm_min_values_14d; | 61 const valuesAtLeast = store.state.application.config.gm_min_values_14d; |
62 if (gmN !== undefined && gmN !== null && gmN >= valuesAtLeast) { | 62 if (gmN !== undefined && gmN !== null && gmN >= valuesAtLeast) { |
63 return "lime"; | 63 return "OK"; |
64 } | 64 } |
65 return "yellow"; | 65 return "WARNING"; |
66 } | 66 } |
67 return "red"; | 67 return "DANGER"; |
68 }, | 68 }, |
69 forecastAccuracy(feature) { | 69 forecastAccuracy(feature) { |
70 let gauge = getGauge(feature); | 70 let gauge = getGauge(feature); |
71 let fa3d = gauge.get("forecast_accuracy_3d"); | 71 let fa3d = gauge.get("forecast_accuracy_3d"); |
72 let fa1d = gauge.get("forecast_accuracy_1d"); | 72 let fa1d = gauge.get("forecast_accuracy_1d"); |
73 if (typeof fa3d == "number" && typeof fa1d == "number") { | 73 if (typeof fa3d == "number" && typeof fa1d == "number") { |
74 if (fa1d > store.state.application.config.gm_forecast_offset_24h) { | 74 if (fa1d > store.state.application.config.gm_forecast_offset_24h) { |
75 return "red"; | 75 return "DANGER"; |
76 } else if (fa3d > store.state.application.config.gm_forecast_offset_72h) { | 76 } else if (fa3d > store.state.application.config.gm_forecast_offset_72h) { |
77 return "yellow"; | 77 return "WARNING"; |
78 } else { | 78 } else { |
79 return "lime"; | 79 return "OK"; |
80 } | 80 } |
81 } | 81 } |
82 return "white"; | 82 return "NEUTRAL"; |
83 }, | 83 }, |
84 forecastVsReality(feature) { | 84 forecastVsReality(feature) { |
85 let gauge = getGauge(feature); | 85 let gauge = getGauge(feature); |
86 let nsc = gauge.get("nsc_data"); | 86 let nsc = gauge.get("nsc_data"); |
87 if (nsc && nsc.coeffs.reduce((sum, coeff) => sum + coeff.samples, 0)) { | 87 if (nsc && nsc.coeffs.reduce((sum, coeff) => sum + coeff.samples, 0)) { |
89 if ( | 89 if ( |
90 nsc.coeffs[0].samples && | 90 nsc.coeffs[0].samples && |
91 nsc.coeffs[0].value < | 91 nsc.coeffs[0].value < |
92 store.state.application.config.gm_forecast_vs_reality_nsc_24h | 92 store.state.application.config.gm_forecast_vs_reality_nsc_24h |
93 ) | 93 ) |
94 return "red"; | 94 return "DANGER"; |
95 // 72h < configured value | 95 // 72h < configured value |
96 if ( | 96 if ( |
97 nsc.coeffs[2].samples && | 97 nsc.coeffs[2].samples && |
98 nsc.coeffs[2].value < | 98 nsc.coeffs[2].value < |
99 store.state.application.config.gm_forecast_vs_reality_nsc_72h | 99 store.state.application.config.gm_forecast_vs_reality_nsc_72h |
100 ) | 100 ) |
101 return "yellow"; | 101 return "WARNING"; |
102 // both > configured value | 102 // both > configured value |
103 return "lime"; | 103 return "OK"; |
104 } | 104 } |
105 // no data available | 105 // no data available |
106 return "white"; | 106 return "NEUTRAL"; |
107 } | 107 } |
108 }; | 108 }; |