From 8b64462114d34c67341cc25bdfb786eee77a706c Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 11:04:34 +0100 Subject: [PATCH 1/7] fix: update exposed pop for alert=1 AB#26287 --- .../floods/upload-population_affected-2.json | 6 +- .../floods/upload-population_affected-3.json | 6 +- .../floods/upload-population_affected-4.json | 102 +++++++++--------- 3 files changed, 57 insertions(+), 57 deletions(-) diff --git a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-2.json b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-2.json index 69f88cbf5..d84297c46 100644 --- a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-2.json +++ b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-2.json @@ -177,7 +177,7 @@ }, { "placeCode": "21UGA006001", - "amount": 1000 + "amount": 2145 }, { "placeCode": "21UGA006002", @@ -197,7 +197,7 @@ }, { "placeCode": "21UGA006006", - "amount": 1000 + "amount": 2201 }, { "placeCode": "21UGA006007", @@ -205,7 +205,7 @@ }, { "placeCode": "21UGA006008", - "amount": 1000 + "amount": 3380 }, { "placeCode": "21UGA006009", diff --git a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-3.json b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-3.json index bb334e716..ac7234bd2 100644 --- a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-3.json +++ b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-3.json @@ -201,7 +201,7 @@ }, { "placeCode": "UG202901", - "amount": 100 + "amount": 2145 }, { "placeCode": "UG203001", @@ -333,7 +333,7 @@ }, { "placeCode": "UG205201", - "amount": 100 + "amount": 2201 }, { "placeCode": "UG205301", @@ -353,7 +353,7 @@ }, { "placeCode": "UG205601", - "amount": 100 + "amount": 3380 }, { "placeCode": "UG205701", diff --git a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-4.json b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-4.json index 8b0cd93ee..027bf571a 100644 --- a/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-4.json +++ b/services/API-service/src/api/admin-area-dynamic-data/dto/example/UGA/floods/upload-population_affected-4.json @@ -1169,71 +1169,71 @@ }, { "placeCode": "UG20290101", - "amount": 10 + "amount": 230 }, { "placeCode": "UG20290102", - "amount": 10 + "amount": 38 }, { "placeCode": "UG20290103", - "amount": 10 + "amount": 228 }, { "placeCode": "UG20290104", - "amount": 10 + "amount": 126 }, { "placeCode": "UG20290105", - "amount": 10 + "amount": 117 }, { "placeCode": "UG20290106", - "amount": 10 + "amount": 43 }, { "placeCode": "UG20290107", - "amount": 10 + "amount": 178 }, { "placeCode": "UG20290108", - "amount": 10 + "amount": 223 }, { "placeCode": "UG20290109", - "amount": 10 + "amount": 87 }, { "placeCode": "UG20290110", - "amount": 10 + "amount": 179 }, { "placeCode": "UG20290111", - "amount": 10 + "amount": 188 }, { "placeCode": "UG20290112", - "amount": 10 + "amount": 118 }, { "placeCode": "UG20290113", - "amount": 10 + "amount": 36 }, { "placeCode": "UG20290114", - "amount": 10 + "amount": 137 }, { "placeCode": "UG20290115", - "amount": 10 + "amount": 5 }, { "placeCode": "UG20290116", - "amount": 10 + "amount": 183 }, { "placeCode": "UG20290117", - "amount": 10 + "amount": 29 }, { "placeCode": "UG20300101", @@ -2181,71 +2181,71 @@ }, { "placeCode": "UG20520101", - "amount": 10 + "amount": 141 }, { "placeCode": "UG20520102", - "amount": 10 + "amount": 114 }, { "placeCode": "UG20520103", - "amount": 10 + "amount": 75 }, { "placeCode": "UG20520104", - "amount": 10 + "amount": 174 }, { "placeCode": "UG20520105", - "amount": 10 + "amount": 112 }, { "placeCode": "UG20520106", - "amount": 10 + "amount": 11 }, { "placeCode": "UG20520107", - "amount": 10 + "amount": 149 }, { "placeCode": "UG20520108", - "amount": 10 + "amount": 119 }, { "placeCode": "UG20520109", - "amount": 10 + "amount": 191 }, { "placeCode": "UG20520110", - "amount": 10 + "amount": 95 }, { "placeCode": "UG20520111", - "amount": 10 + "amount": 168 }, { "placeCode": "UG20520112", - "amount": 10 + "amount": 43 }, { "placeCode": "UG20520113", - "amount": 10 + "amount": 151 }, { "placeCode": "UG20520114", - "amount": 10 + "amount": 155 }, { "placeCode": "UG20520115", - "amount": 10 + "amount": 133 }, { "placeCode": "UG20520116", - "amount": 10 + "amount": 189 }, { "placeCode": "UG20520117", - "amount": 10 + "amount": 181 }, { "placeCode": "UG20530101", @@ -2449,71 +2449,71 @@ }, { "placeCode": "UG20560101", - "amount": 10 + "amount": 350 }, { "placeCode": "UG20560102", - "amount": 10 + "amount": 317 }, { "placeCode": "UG20560103", - "amount": 10 + "amount": 118 }, { "placeCode": "UG20560104", - "amount": 10 + "amount": 198 }, { "placeCode": "UG20560105", - "amount": 10 + "amount": 150 }, { "placeCode": "UG20560106", - "amount": 10 + "amount": 11 }, { "placeCode": "UG20560107", - "amount": 10 + "amount": 89 }, { "placeCode": "UG20560108", - "amount": 10 + "amount": 189 }, { "placeCode": "UG20560109", - "amount": 10 + "amount": 107 }, { "placeCode": "UG20560110", - "amount": 10 + "amount": 35 }, { "placeCode": "UG20560111", - "amount": 10 + "amount": 51 }, { "placeCode": "UG20560112", - "amount": 10 + "amount": 195 }, { "placeCode": "UG20560113", - "amount": 10 + "amount": 357 }, { "placeCode": "UG20560114", - "amount": 10 + "amount": 287 }, { "placeCode": "UG20560115", - "amount": 10 + "amount": 96 }, { "placeCode": "UG20560116", - "amount": 10 + "amount": 417 }, { "placeCode": "UG20560117", - "amount": 10 + "amount": 413 }, { "placeCode": "UG20570101", From 2351a6f308a6c7a28c3d8e2ec3e98e12bc36a5e1 Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 11:53:29 +0100 Subject: [PATCH 2/7] fix: allow string in forecastReturnPeriod AB#26287 --- .../src/api/glofas-station/dto/station-forecast.dto.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/API-service/src/api/glofas-station/dto/station-forecast.dto.ts b/services/API-service/src/api/glofas-station/dto/station-forecast.dto.ts index 611aa3b4f..fc3e96d6e 100644 --- a/services/API-service/src/api/glofas-station/dto/station-forecast.dto.ts +++ b/services/API-service/src/api/glofas-station/dto/station-forecast.dto.ts @@ -24,9 +24,8 @@ export class GlofasStationForecastDto { public eapAlertClass: string; @ApiProperty({ example: 10 }) - @IsNumber() @IsOptional() - public forecastReturnPeriod: number; + public forecastReturnPeriod: number | string; @ApiProperty({ example: 100 }) @IsNumber() From 6c84a3963657c0cdc937827ccdc2121d600b852b Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 11:54:06 +0100 Subject: [PATCH 3/7] fix: update returnPeriod and triggerLevel AB#26287 --- .../glofas-stations-UGA-triggered.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json b/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json index 72480b517..a6eaa5add 100644 --- a/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json +++ b/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json @@ -1,10 +1,10 @@ [ { "stationCode": "G5075", - "forecastLevel": 500, + "forecastLevel": 175, "eapAlertClass": "min", - "forecastReturnPeriod": null, - "triggerLevel": 400 + "forecastReturnPeriod": "1/2", + "triggerLevel": 520 }, { "stationCode": "G5160", @@ -43,10 +43,10 @@ }, { "stationCode": "G5230", - "forecastLevel": 410, + "forecastLevel": 250, "eapAlertClass": "med", - "forecastReturnPeriod": null, - "triggerLevel": 400 + "forecastReturnPeriod": "3/4", + "triggerLevel": 300 }, { "stationCode": "G5317", From 186076e2f50a5ec716887e1cd4638abfeec21b19 Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 11:54:35 +0100 Subject: [PATCH 4/7] style: update GloFAS popup AB#26287 --- ...lofas-station-popup-content.component.html | 36 +++++++++++-------- .../glofas-station-popup-content.component.ts | 15 ++++++++ .../threshold-bar.component.html | 4 +-- .../threshold-bar/threshold-bar.component.ts | 1 + .../IBF-dashboard/src/assets/i18n/en.json | 6 +++- 5 files changed, 44 insertions(+), 18 deletions(-) diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html index 78f1c8325..655871856 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.html @@ -1,21 +1,24 @@
- {{ data?.leadTime }} forecast of - river discharge - in m3/s + {{ + 'map-popups.glofas-station.river-discharge' + | translate: { leadTime: getLeadTimeString() } + }} +
- (Corresponding to a return period of - {{ data?.station?.dynamicData?.forecastReturnPeriod }} - years) + {{ + 'map-popups.glofas-station.forecast-return' + | translate + : { returnPeriod: data?.station?.dynamicData?.forecastReturnPeriod } + }}
diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts index 2fe3875d1..98b9b81be 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts @@ -1,4 +1,5 @@ import { Component, Input, OnInit } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; import { EapAlertClass, EapAlertClasses } from '../../../models/country.model'; import { Station } from '../../../models/poi.model'; import { LeadTime } from '../../../types/lead-time'; @@ -27,11 +28,15 @@ export class GlofasStationPopupContentComponent implements OnInit { value: 0, }; + constructor(private translate: TranslateService) {} + ngOnInit(): void { if (!this.data) { return; } + console.log('=== data.leadTime: ', this.data.leadTime); + const difference = Number(this.data.station.dynamicData?.forecastLevel) - Number(this.data.station.dynamicData?.triggerLevel); @@ -69,4 +74,14 @@ export class GlofasStationPopupContentComponent implements OnInit { } public addComma = (n) => Math.round(n).toLocaleString('en-US'); + + public getLeadTimeString(): string { + if (!this.data || !this.data?.leadTime) { + return ''; + } + + const [value, unit] = this.data.leadTime.split('-'); + + return `${value} ${unit}${Number(value) > 1 ? 's' : ''}`; + } } diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html index 655d5e5d4..b38ffdad1 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html @@ -2,12 +2,12 @@
- {{ barValue }} + {{ barValue }}{{unit}}
{{ thresholdDescription }}:
- {{ thresholdValue }} + {{ thresholdValue }}{{unit}}
diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.ts b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.ts index 11c91200a..674769b46 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.ts @@ -12,6 +12,7 @@ export class ThresholdBarComponent implements OnInit { @Input() public barValue: string; @Input() public thresholdDescription: string; @Input() public thresholdValue: number; + @Input() public unit?: string; @Input() public thresholdPosition: number; // width percentage to position threshold on bar public barBackgroundStyle: string; diff --git a/interfaces/IBF-dashboard/src/assets/i18n/en.json b/interfaces/IBF-dashboard/src/assets/i18n/en.json index 469bd0827..8c9c67ea1 100644 --- a/interfaces/IBF-dashboard/src/assets/i18n/en.json +++ b/interfaces/IBF-dashboard/src/assets/i18n/en.json @@ -396,7 +396,11 @@ "tooltip": "Current water level in meters above sea level (mMSL) is measured by a gauge during the latest model run. The difference compared to 24 hours ago is shown in green for decrease or red for increase. The reference water level is the typical level for this station during this season." }, "glofas-station": { - "no-data": "No water discharge data available" + "no-data": "No water discharge data available", + "river-discharge": "Forecasted river discharge in {{ leadTime }}", + "river-discharge-explanation": "The amount of water moving down a river at a given time and place", + "forecast-return": "(Corresponding to a return period of {{returnPeriod}} years)", + "threshold-description": "Trigger activation threshold" } }, "breadcrumbs": { From 2aff8dc55f0abf84d3dd07afa613e4578d585205 Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 17:03:02 +0100 Subject: [PATCH 5/7] fix: remove console.log --- .../glofas-station-popup-content.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts index 98b9b81be..b2549880d 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/glofas-station-popup-content/glofas-station-popup-content.component.ts @@ -35,8 +35,6 @@ export class GlofasStationPopupContentComponent implements OnInit { return; } - console.log('=== data.leadTime: ', this.data.leadTime); - const difference = Number(this.data.station.dynamicData?.forecastLevel) - Number(this.data.station.dynamicData?.triggerLevel); From 22b41908df5a5a61526ec911b584c4dc502457e7 Mon Sep 17 00:00:00 2001 From: arsforza Date: Thu, 8 Feb 2024 17:13:19 +0100 Subject: [PATCH 6/7] fix: prettier --- .../threshold-bar/threshold-bar.component.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html index b38ffdad1..f19f3b84d 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/threshold-bar/threshold-bar.component.html @@ -2,12 +2,14 @@
- {{ barValue }}{{unit}} + {{ barValue }}{{ unit }}
{{ thresholdDescription }}:
- {{ thresholdValue }}{{unit}} + {{ thresholdValue }}{{ unit }}
From d7e503e1da286f8ee1e7b7b9940ae8d004e5217c Mon Sep 17 00:00:00 2001 From: jannisvisser Date: Fri, 9 Feb 2024 09:38:22 +0100 Subject: [PATCH 7/7] fix: set return period to specific value AB#26287 --- .../glofas-stations/glofas-stations-UGA-triggered.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json b/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json index a6eaa5add..1eb6e6a70 100644 --- a/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json +++ b/services/API-service/src/api/point-data/dto/example/glofas-stations/glofas-stations-UGA-triggered.json @@ -3,7 +3,7 @@ "stationCode": "G5075", "forecastLevel": 175, "eapAlertClass": "min", - "forecastReturnPeriod": "1/2", + "forecastReturnPeriod": 2, "triggerLevel": 520 }, { @@ -45,7 +45,7 @@ "stationCode": "G5230", "forecastLevel": 250, "eapAlertClass": "med", - "forecastReturnPeriod": "3/4", + "forecastReturnPeriod": 3, "triggerLevel": 300 }, {