Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: show more EAP alert classes in UGA floods AB#24677 #1479

Merged
merged 42 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
89b25e5
feat: add more classes to UGA floods AB#25830
arsforza Jan 15, 2024
0e63684
feat: add intermediate values to mock AB#25842
arsforza Jan 15, 2024
32ef175
fix: update alert_threshold mock AB#25842
arsforza Jan 16, 2024
8636926
fix: changed mock data alert_threshold level 2 only AB#25865
jannisvisser Jan 16, 2024
573aecd
feat: set agreed in-between values in countries.json AB#25832
jannisvisser Jan 16, 2024
adaf2da
feat: get severity level per triggered area AB#25832
jannisvisser Jan 19, 2024
7d36f5d
fix: update alert_threshold AB#25842
arsforza Jan 19, 2024
18aca1a
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
arsforza Jan 19, 2024
d5cef4f
fix: show severity level small edits AB#25832
jannisvisser Jan 19, 2024
32cc4a7
fix: reorder mock by placeCode AB#25842
arsforza Jan 19, 2024
bb2b84f
feat: show alertClass in activation log AB#25984
jannisvisser Jan 19, 2024
343efd6
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
jannisvisser Jan 19, 2024
a86fb12
chore: rename severity level to alert class AB#25984
jannisvisser Jan 19, 2024
42a9cf0
fix: update mock with temp values AB#25830
arsforza Jan 19, 2024
4ff9bc7
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
arsforza Jan 19, 2024
2972b11
feat: if intermediate only show portal in warning state AB#25873
jannisvisser Jan 19, 2024
7987185
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
jannisvisser Jan 19, 2024
eb0e630
chore: revers now that mock data is updated AB#25842
jannisvisser Jan 19, 2024
1f75b79
fix: set grey outline on hover for < 1 AB#25833
arsforza Jan 22, 2024
2b97eeb
fix: use early returns AB#25833
arsforza Jan 22, 2024
e5c5da7
fix: also show intermediate warnings in activation log AB#25984
jannisvisser Jan 22, 2024
1f5a65f
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
jannisvisser Jan 22, 2024
f590710
fix: change labels AB#26020
jannisvisser Jan 22, 2024
a4180e3
fix: missing commit AB#26020
jannisvisser Jan 22, 2024
5dd20d1
fix: change max glofas class to red AB#25843
arsforza Jan 22, 2024
9378856
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
arsforza Jan 22, 2024
44b53c6
fix: sort glofas stations in legend AB#25871
arsforza Jan 22, 2024
ec909d1
fix: add values to all glofas classes AB#25871
arsforza Jan 22, 2024
a32bdfd
feat: show severity by sublist AB#26005
jannisvisser Jan 22, 2024
fa05a50
fix add correct glofas label in legend AB#25871
arsforza Jan 22, 2024
455a8ce
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
jannisvisser Jan 22, 2024
145f3ef
feat: do not show actions for warning areas AB#26038
jannisvisser Jan 22, 2024
f7076ac
fix: also red glofas for other countries AB#25843
jannisvisser Jan 22, 2024
878c5e7
fix: show trigger/warning dynamically in stop trigger popups AB#26037
jannisvisser Jan 22, 2024
7228a29
fix: update email check pattern AB#26088
arsforza Jan 29, 2024
02ade01
fix: prettier
arsforza Jan 29, 2024
35e0893
feat: include alert class in email AB#26131
jannisvisser Jan 29, 2024
7036f50
fix: include thresholdReached in mock input AB#25840
jannisvisser Jan 29, 2024
40458d5
Merge branch 'feat.uga-eap-classes' of https://github.com/rodekruis/I…
jannisvisser Jan 29, 2024
a985307
fix: more generic no-actions copy AB#26038
jannisvisser Jan 29, 2024
1640dd9
fix: tests AB#26136
arsforza Jan 29, 2024
e2320fd
style: update stop button color AB#26141
arsforza Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
{{
'chat-component.common.reactivate-trigger-popup.' +
hasEap() +
'.header' | translate
'.header' | translate: { alertLabel: area.alertLabel }
}}
</app-ibf-button>
</app-dialogue-turn>
Expand Down Expand Up @@ -327,6 +327,7 @@
backgroundColor="ibf-primary"
type="submit"
style="width: 100%"
strong="true"
>
{{
'chat-component.common.save-actions.submit-button-label'
Expand All @@ -343,10 +344,13 @@
"
(click)="openToggleTriggerPopup(area, true)"
[disabled]="!area.activeTrigger"
backgroundColor="ibf-primary"
backgroundColor="ibf-white"
textColor="ibf-no-alert-primary"
borderColor="ibf-no-alert-secondary"
strong="true"
>{{
'chat-component.common.stop-trigger-popup.' + hasEap() + '.header'
| translate
| translate: { alertLabel: area.alertLabel }
}}</app-ibf-button
>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ export class ChatComponent implements OnInit, OnDestroy {
}

public async openToggleTriggerPopup(
triggeredArea,
triggeredArea: TriggeredArea,
stop: boolean,
): Promise<void> {
const stopNode = stop ? 'stop-trigger-popup' : 'reactivate-trigger-popup';
Expand All @@ -404,7 +404,7 @@ export class ChatComponent implements OnInit, OnDestroy {
translucent: true,
showBackdrop: true,
componentProps: {
placeCodeName: triggeredArea.name,
area: triggeredArea,
eapNode,
stopNode,
disasterType: this.disasterType.disasterType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
| translate
: {
firstLeadTimeDate: event.firstLeadTimeDate,
eventName: event.eventName?.split('_')[0]
eventName: event.eventName?.split('_')[0],
disasterTypeLabel: disasterTypeLabel
}
"
></p>
Expand Down Expand Up @@ -157,24 +158,29 @@
}
"
></p>
<ul>
<li
*ngFor="let area of areas"
class="clickable-area"
(click)="selectArea(area)"
>
<p>
{{ area.name }}
<span *ngIf="area.nameParent">({{ area.nameParent }})</span> -
<span *ngIf="actionIndicatorNumberFormat === 'decimal0'">{{
area.actionsValue | number: '.0-0'
}}</span
><span *ngIf="actionIndicatorNumberFormat === 'perc'">{{
area.actionsValue | percent: '.0-0'
}}</span>
</p>
</li>
</ul>
<div *ngFor="let class of alertClasses">
<p class="ion-padding-top" *ngIf="class.alertClass !== 'undefined'">
<strong>{{ class.alertClass }}</strong>
</p>
<ul>
<li
*ngFor="let area of class.areas"
class="clickable-area"
(click)="selectArea(area)"
>
<p>
{{ area.name }}
<span *ngIf="area.nameParent">({{ area.nameParent }})</span> -
<span *ngIf="actionIndicatorNumberFormat === 'decimal0'">{{
area.actionsValue | number: '.0-0'
}}</span
><span *ngIf="actionIndicatorNumberFormat === 'perc'">{{
area.actionsValue | percent: '.0-0'
}}</span>
</p>
</li>
</ul>
</div>
<p
*ngIf="event.thresholdReached"
[translate]="
Expand Down Expand Up @@ -208,24 +214,29 @@
}
"
></p>
<ul>
<li
*ngFor="let area of areas"
class="clickable-area"
(click)="selectArea(area)"
>
<p>
{{ area.name }}
<span *ngIf="area.nameParent">({{ area.nameParent }})</span> -
<span *ngIf="actionIndicatorNumberFormat === 'decimal0'">{{
area.actionsValue | number: '.0-0'
}}</span
><span *ngIf="actionIndicatorNumberFormat === 'perc'">{{
area.actionsValue | percent: '.0-0'
}}</span>
</p>
</li>
</ul>
<div *ngFor="let class of alertClasses">
<p class="ion-padding-top" *ngIf="class.alertClass !== 'undefined'">
<strong>{{ class.alertClass }}</strong>
</p>
<ul>
<li
*ngFor="let area of areas"
class="clickable-area"
(click)="selectArea(area)"
>
<p>
{{ area.name }}
<span *ngIf="area.nameParent">({{ area.nameParent }})</span> -
<span *ngIf="actionIndicatorNumberFormat === 'decimal0'">{{
area.actionsValue | number: '.0-0'
}}</span
><span *ngIf="actionIndicatorNumberFormat === 'perc'">{{
area.actionsValue | percent: '.0-0'
}}</span>
</p>
</li>
</ul>
</div>
<p
[translate]="
'chat-component.' + disasterTypeName + '.stopped-event.instruction'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {
AfterViewChecked,
ChangeDetectorRef,
Component,
Input,
OnDestroy,
OnInit,
} from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { Subscription } from 'rxjs';
Expand All @@ -22,7 +22,7 @@ import { TriggeredArea } from '../../types/triggered-area';
templateUrl: './event-speech-bubble.component.html',
styleUrls: ['./event-speech-bubble.component.scss'],
})
export class EventSpeechBubbleComponent implements OnInit, OnDestroy {
export class EventSpeechBubbleComponent implements AfterViewChecked, OnDestroy {
@Input()
public type: string;
@Input()
Expand Down Expand Up @@ -53,6 +53,7 @@ export class EventSpeechBubbleComponent implements OnInit, OnDestroy {
public isStopped: boolean;
private placeCodeHoverSubscription: Subscription;
public placeCodeHover: PlaceCode;
public alertClasses: { alertClass: string; areas: TriggeredArea[] }[];

constructor(
private authService: AuthService,
Expand All @@ -64,11 +65,13 @@ export class EventSpeechBubbleComponent implements OnInit, OnDestroy {
private translateService: TranslateService,
) {}

ngOnInit() {
ngAfterViewChecked() {
if (this.authService.displayName) {
this.displayName = this.authService.displayName;
}

this.alertClasses = this.splitAreasByAlertClass(this.areas);

this.placeCodeHoverSubscription = this.placeCodeService
.getPlaceCodeHoverSubscription()
.subscribe(this.onPlaceCodeHoverChange);
Expand All @@ -80,6 +83,24 @@ export class EventSpeechBubbleComponent implements OnInit, OnDestroy {
this.placeCodeHoverSubscription.unsubscribe();
}

public splitAreasByAlertClass(
areas: TriggeredArea[] = [],
): { alertClass: string; areas: TriggeredArea[] }[] {
const areasByAlertClass = {};

for (const area of areas) {
if (!areasByAlertClass[area.alertClass]) {
areasByAlertClass[area.alertClass] = [];
}
areasByAlertClass[area.alertClass].push(area);
}

return Object.keys(areasByAlertClass).map((alertClass) => ({
alertClass: alertClass,
areas: areasByAlertClass[alertClass],
}));
}

public selectArea(area) {
this.adminLevelService.zoomInAdminLevel();
this.placeCodeService.setPlaceCode({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class DynamicPointPopupComponent implements OnInit {
private defautEapAlertClass: EapAlertClass = {
label: 'No action',
color: 'ibf-no-alert-primary',
value: 0,
};

private allowedLayers = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class GlofasStationPopupContentComponent implements OnInit {
private defautEapAlertClass: EapAlertClass = {
label: 'No action',
color: 'ibf-no-alert-primary',
value: 0,
};

ngOnInit(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@

<ion-item>
<ion-label position="stacked">E-mail</ion-label>
<!-- Email pattern retrieved from: https://emailregex.com/ -->
<ion-input
[(ngModel)]="model.email"
name="email"
type="email"
required
inputmode="email"
pattern="(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*|&quot;(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*&quot;)@(?:(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[A-Za-z0-9-]*[A-Za-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])"
pattern=".+@.+\.[a-z]+"
autocomplete="email username"
clearInput="true"
data-test="input-user"
Expand Down
14 changes: 12 additions & 2 deletions interfaces/IBF-dashboard/src/app/components/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ export class MapComponent implements AfterViewInit, OnDestroy {
for (const glofasState of this.getGlofasStationStates()) {
const element = this.mapLegendService.getGlofasPointLegendString(
layer,
`-${glofasState}-trigger`,
`-${glofasState.key}-trigger`,
glofasState.label,
);
elements.push(element);
}
Expand Down Expand Up @@ -389,7 +390,16 @@ export class MapComponent implements AfterViewInit, OnDestroy {
}

private getGlofasStationStates() {
return Object.keys(this.countryDisasterSettings?.eapAlertClasses);
const classes = [];
for (const [key, value] of Object.entries(
this.countryDisasterSettings?.eapAlertClasses,
)) {
classes.push({ key, label: value.label, value: value.value });
}
classes.sort((e1, e2) => {
return e2.value - e1.value;
});
return classes;
}

onMapReady(map: Map) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
></ion-icon>
<ion-card-title>{{
'chat-component.common.' + stopNode + '.' + eapNode + '.header'
| translate
| translate: { alertLabel: area?.alertLabel }
}}</ion-card-title>
</ion-card-header>
<ion-card-content class="ion-padding-top ion-text-center">
Expand All @@ -18,7 +18,8 @@
'chat-component.common.' + stopNode + '.' + eapNode + '.message'
| translate
: {
placeCodeName: placeCodeName,
placeCodeName: area?.name,
alertLabel: area?.alertLabel,
disasterSpecificText: getDisasterSpecificText()
}
"
Expand All @@ -33,7 +34,7 @@
(click)="confirm()"
>{{
'chat-component.common.' + stopNode + '.' + eapNode + '.confirm'
| translate
| translate: { alertLabel: area?.alertLabel }
}}</ion-button
>
<ion-button
Expand All @@ -43,7 +44,7 @@
>
{{
'chat-component.common.' + stopNode + '.' + eapNode + '.cancel'
| translate
| translate: { alertLabel: area?.alertLabel }
}}
</ion-button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, Input } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { DisasterTypeKey } from '../../types/disaster-type-key';
import { TriggeredArea } from '../../types/triggered-area';

@Component({
selector: 'app-toggle-trigger-popover',
Expand All @@ -10,7 +11,7 @@ import { DisasterTypeKey } from '../../types/disaster-type-key';
})
export class ToggleTriggerPopoverComponent {
@Input()
public placeCodeName: string;
public area: TriggeredArea;

@Input()
public eapNode: string;
Expand Down
1 change: 1 addition & 0 deletions interfaces/IBF-dashboard/src/app/models/country.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export class EapAlertClasses {
export class EapAlertClass {
label: string;
color: string;
value: number;
}

export class AdminRegionLabels {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class DisasterTypeService {
this.disasterTypeSubject.next(this.disasterType);
}

// TODO move to back-end
public hasEap(disasterType: DisasterTypeKey): string {
const eapDisasterTypes = [
DisasterTypeKey.floods,
Expand Down
Loading
Loading