diff --git a/interfaces/IBF-dashboard/cypress/support/component-index.html b/interfaces/IBF-dashboard/cypress/support/component-index.html index e39ba4296..faf3b5f43 100644 --- a/interfaces/IBF-dashboard/cypress/support/component-index.html +++ b/interfaces/IBF-dashboard/cypress/support/component-index.html @@ -1,4 +1,4 @@ - + diff --git a/interfaces/IBF-dashboard/package-lock.json b/interfaces/IBF-dashboard/package-lock.json index 44fabb0bd..0fc4aa826 100644 --- a/interfaces/IBF-dashboard/package-lock.json +++ b/interfaces/IBF-dashboard/package-lock.json @@ -62,8 +62,8 @@ "karma-coverage-istanbul-reporter": "^3.0.3", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.1.0", - "prettier": "2.2.1", - "prettier-plugin-organize-imports": "^2.3.4", + "prettier": "^3.3.3", + "prettier-plugin-organize-imports": "^4.0.0", "typescript": "^5.4.5", "xlsx": "^0.17.5" } @@ -16414,25 +16414,38 @@ } }, "node_modules/prettier": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.2.1.tgz", - "integrity": "sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==", + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", + "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, "node_modules/prettier-plugin-organize-imports": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-2.3.4.tgz", - "integrity": "sha512-R8o23sf5iVL/U71h9SFUdhdOEPsi3nm42FD/oDYIZ2PQa4TNWWuWecxln6jlIQzpZTDMUeO1NicJP6lLn2TtRw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.0.0.tgz", + "integrity": "sha512-vnKSdgv9aOlqKeEFGhf9SCBsTyzDSyScy1k7E0R1Uo4L0cTcOV7c1XQaT7jfXIOc/p08WLBfN2QUQA9zDSZMxA==", "dev": true, "peerDependencies": { + "@vue/language-plugin-pug": "^2.0.24", "prettier": ">=2.0", - "typescript": ">=2.9" + "typescript": ">=2.9", + "vue-tsc": "^2.0.24" + }, + "peerDependenciesMeta": { + "@vue/language-plugin-pug": { + "optional": true + }, + "vue-tsc": { + "optional": true + } } }, "node_modules/pretty-bytes": { diff --git a/interfaces/IBF-dashboard/package.json b/interfaces/IBF-dashboard/package.json index 2b733a76f..0a85d79e0 100644 --- a/interfaces/IBF-dashboard/package.json +++ b/interfaces/IBF-dashboard/package.json @@ -82,8 +82,8 @@ "karma-coverage-istanbul-reporter": "^3.0.3", "karma-jasmine": "^5.1.0", "karma-jasmine-html-reporter": "^2.1.0", - "prettier": "2.2.1", - "prettier-plugin-organize-imports": "^2.3.4", + "prettier": "^3.3.3", + "prettier-plugin-organize-imports": "^4.0.0", "typescript": "^5.4.5", "xlsx": "^0.17.5" } diff --git a/interfaces/IBF-dashboard/prettier.config.js b/interfaces/IBF-dashboard/prettier.config.js index 7f0df6c81..4453ffd33 100644 --- a/interfaces/IBF-dashboard/prettier.config.js +++ b/interfaces/IBF-dashboard/prettier.config.js @@ -4,9 +4,7 @@ module.exports = { overrides: [ { files: '*.html', - options: { - parser: 'angular', - }, + options: { parser: 'angular' }, }, ], }; diff --git a/interfaces/IBF-dashboard/src/app/app.component.html b/interfaces/IBF-dashboard/src/app/app.component.html index 62b4eeb87..f95288152 100644 --- a/interfaces/IBF-dashboard/src/app/app.component.html +++ b/interfaces/IBF-dashboard/src/app/app.component.html @@ -1,6 +1,8 @@ -
- -
+ @if (loading) { +
+ +
+ }
diff --git a/interfaces/IBF-dashboard/src/app/app.component.spec.ts b/interfaces/IBF-dashboard/src/app/app.component.spec.ts index 2d6bc4b58..2bec23747 100644 --- a/interfaces/IBF-dashboard/src/app/app.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/app.component.spec.ts @@ -8,21 +8,19 @@ describe('AppComponent', () => { let platformReadySpy; let platformSpy; - beforeEach( - waitForAsync(() => { - platformReadySpy = Promise.resolve(); - platformSpy = jasmine.createSpyObj('Platform', { - ready: platformReadySpy, - }); + beforeEach(waitForAsync(() => { + platformReadySpy = Promise.resolve(); + platformSpy = jasmine.createSpyObj('Platform', { + ready: platformReadySpy, + }); - TestBed.configureTestingModule({ - declarations: [AppComponent], - imports: [TranslateModule.forRoot()], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - providers: [{ provide: Platform, useValue: platformSpy }], - }).compileComponents(); - }), - ); + TestBed.configureTestingModule({ + declarations: [AppComponent], + imports: [TranslateModule.forRoot()], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + providers: [{ provide: Platform, useValue: platformSpy }], + }).compileComponents(); + })); it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); diff --git a/interfaces/IBF-dashboard/src/app/auth/auth.guard.ts b/interfaces/IBF-dashboard/src/app/auth/auth.guard.ts index b147366f8..f80313df5 100644 --- a/interfaces/IBF-dashboard/src/app/auth/auth.guard.ts +++ b/interfaces/IBF-dashboard/src/app/auth/auth.guard.ts @@ -12,7 +12,10 @@ import { AuthService } from './auth.service'; providedIn: 'root', }) export class AuthGuard { - constructor(private router: Router, private authService: AuthService) {} + constructor( + private router: Router, + private authService: AuthService, + ) {} canActivate( next: ActivatedRouteSnapshot, diff --git a/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.spec.ts index 5a8c0bdcd..b1be652f4 100644 --- a/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.spec.ts @@ -12,22 +12,20 @@ describe('AboutBtnComponent', () => { let component: AboutBtnComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AboutBtnComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AboutBtnComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(AboutBtnComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(AboutBtnComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.ts b/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.ts index fea71e958..ccc8d6fab 100644 --- a/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/about-btn/about-btn.component.ts @@ -55,10 +55,11 @@ export class AboutBtnComponent implements OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; public btnAction() { diff --git a/interfaces/IBF-dashboard/src/app/components/action-result-popover/action-result-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/action-result-popover/action-result-popover.component.spec.ts index 5f3d47507..0d6e83a2a 100644 --- a/interfaces/IBF-dashboard/src/app/components/action-result-popover/action-result-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/action-result-popover/action-result-popover.component.spec.ts @@ -7,18 +7,16 @@ describe('ActionResultPopoverComponent', () => { let component: ActionResultPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ActionResultPopoverComponent], - imports: [IonicModule.forRoot(), TranslateModule.forRoot()], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ActionResultPopoverComponent], + imports: [IonicModule.forRoot(), TranslateModule.forRoot()], + }).compileComponents(); - fixture = TestBed.createComponent(ActionResultPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ActionResultPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); // disabling this test as it fails because of the 'setTimeout' in the .ts file. xit('should create', () => { diff --git a/interfaces/IBF-dashboard/src/app/components/activation-log-button/activation-log-button.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/activation-log-button/activation-log-button.component.spec.ts index 9e7182a1f..11c570640 100644 --- a/interfaces/IBF-dashboard/src/app/components/activation-log-button/activation-log-button.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/activation-log-button/activation-log-button.component.spec.ts @@ -13,26 +13,24 @@ describe('ActivationLogButtonComponent', () => { let component: ActivationLogButtonComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ActivationLogButtonComponent], - imports: [ - IonicModule.forRoot(), - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ActivationLogButtonComponent], + imports: [ + IonicModule.forRoot(), + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(ActivationLogButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ActivationLogButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.html b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.html index da2799679..dc09c2706 100644 --- a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.html +++ b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.html @@ -1,119 +1,123 @@ - - +@if (useBreadcrumbs(disasterType)) { - - +} @else { - +} diff --git a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.spec.ts index 482c48c04..163f9dba8 100644 --- a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.spec.ts @@ -13,22 +13,20 @@ describe('AdminLevelComponent', () => { let component: AdminLevelComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AdminLevelComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AdminLevelComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(AdminLevelComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(AdminLevelComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.ts b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.ts index ed24be225..e8e0fd828 100644 --- a/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/admin-level/admin-level.component.ts @@ -96,7 +96,8 @@ export class AdminLevelComponent implements OnInit, OnDestroy { .getPlaceCodeSubscription() .subscribe(this.onPlaceCodeChange); - this.adminLevelButtons = this.adminLevelService.getAdminLevelButtonsSubscription(); + this.adminLevelButtons = + this.adminLevelService.getAdminLevelButtonsSubscription(); } ngOnDestroy(): void { this.mapViewSubscription.unsubscribe(); @@ -112,10 +113,11 @@ export class AdminLevelComponent implements OnInit, OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onMapViewChange = (view: MapView) => { diff --git a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html index 62bab17b9..f9ba93a77 100644 --- a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html +++ b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.html @@ -1,126 +1,141 @@ -
- - - - - - {{ - getAggregatesHeader(mapView | async).headerLabel - }} - - - - - -
- - - - - - - - - - {{ indicator.label }} - - - - +@if (showAggregatesSection()) { +
+ + + - - - {{ - getAggregate( - indicator.name, - indicator.weightedAvg, - indicator.numberFormatAggregate - ) - | number: '.2-2' - | translate - }} - - - {{ - getAggregate( - indicator.name, - indicator.weightedAvg, - indicator.numberFormatAggregate - ) - | number: '.0-0' - | translate - }} - - - {{ - getAggregate( - indicator.name, - indicator.weightedAvg, - indicator.numberFormatAggregate - ) - | percent: '.0-0' - | translate - }} - - {{ indicator.aggregateUnit }} - - - {{ 'aggregates-component.not-applicable' | translate }} - - - - - - - - + {{ + getAggregatesHeader(mapView | async).headerLabel + }} + + -
- -
+
+ @for (indicator of indicators; track indicator.name) { + + + + + + + + {{ indicator.label }} + + + + + + @if (!isAggregateNan(indicator.name, indicator.weightedAvg)) { + + @switch (indicator.numberFormatAggregate) { + @case ('decimal2') { + + {{ + getAggregate( + indicator.name, + indicator.weightedAvg, + indicator.numberFormatAggregate + ) + | number: '.2-2' + | translate + }} + + } + @case ('decimal0') { + + {{ + getAggregate( + indicator.name, + indicator.weightedAvg, + indicator.numberFormatAggregate + ) + | number: '.0-0' + | translate + }} + + } + @case ('perc') { + + {{ + getAggregate( + indicator.name, + indicator.weightedAvg, + indicator.numberFormatAggregate + ) + | percent: '.0-0' + | translate + }} + + } + } + {{ indicator.aggregateUnit }} + + } @else { + + {{ 'aggregates-component.not-applicable' | translate }} + + } + + + + + + + + + + + } +
+
+
+} diff --git a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.spec.ts index b066a4da0..2fc7f1eb7 100644 --- a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.spec.ts @@ -14,23 +14,21 @@ describe('AggregatesComponent', () => { let component: AggregatesComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AggregatesComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - { provide: AggregatesService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AggregatesComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + { provide: AggregatesService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(AggregatesComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(AggregatesComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.ts b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.ts index c2aa6dc69..7373d653b 100644 --- a/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/aggregates/aggregates.component.ts @@ -162,10 +162,11 @@ export class AggregatesComponent implements OnInit, OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onEventStateChange = (eventState: EventState) => { @@ -425,9 +426,9 @@ export class AggregatesComponent implements OnInit, OnDestroy { return this.placeCodeHover // hovering should always lead to aggregate-numbers updating on any level ? this.placeCodeHover.placeCode : adminLevelType === AdminLevelType.higher // else if on higher of multiple levels, do not filter by placeCode, as it it still the parent placeCode, while the aggregates data is on the child-placeCodes - ? null - : placeCode // else if on single/deepest level, then follow normal behaviour of filtering on selected placeCode - ? placeCode.placeCode - : null; // .. or no filtering, if no placeCode is selected + ? null + : placeCode // else if on single/deepest level, then follow normal behaviour of filtering on selected placeCode + ? placeCode.placeCode + : null; // .. or no filtering, if no placeCode is selected } } diff --git a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.html b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.html index 3f3596cc5..4b79bb977 100644 --- a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.html +++ b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.html @@ -1,4 +1,4 @@ - +@if (eventState?.thresholdReached && showAreasOfFocusSummary()) { - - - - - - - - - {{ areaOfFocus.label }} - - - - - - - {{ areaOfFocus.countChecked }} / {{ areaOfFocus.count }} - - {{ - 'areas-of-focus-summary-component.not-applicable' | translate - }} - - - - - - - - - - - - - + @for (areaOfFocus of areasOfFocus; track areaOfFocus.id) { + + + + + + + + + {{ areaOfFocus.label }} + + + + + + + @if (areaOfFocus.count > 0) { + {{ areaOfFocus.countChecked }} / + {{ areaOfFocus.count }} + } @else { + + {{ + 'areas-of-focus-summary-component.not-applicable' + | translate + }} + } + + + + + + + + + + + + + } +} diff --git a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.spec.ts index 1910ca300..ca24695ee 100644 --- a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.spec.ts @@ -12,22 +12,20 @@ describe('AreasOfFocusSummaryComponent', () => { let component: AreasOfFocusSummaryComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [AreasOfFocusSummaryComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [AreasOfFocusSummaryComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(AreasOfFocusSummaryComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(AreasOfFocusSummaryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.ts b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.ts index 560c0df66..7db21ad32 100644 --- a/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/areas-of-focus-summary/areas-of-focus-summary.component.ts @@ -95,10 +95,11 @@ export class AreasOfFocusSummaryComponent implements OnInit, OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onTriggeredAreasChange = (triggeredAreas: TriggeredArea[]) => { diff --git a/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.html b/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.html index 200667145..8e138c231 100644 --- a/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.html +++ b/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.html @@ -9,7 +9,6 @@ Change Password -
- - - Passwords do not match. - - + @if (showDifferentPasswordMessage) { + + + Passwords do not match. + + + }
-
diff --git a/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.spec.ts index ebdc26e57..e336310b7 100644 --- a/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/change-password-popover/change-password-popover.component.spec.ts @@ -14,23 +14,21 @@ describe('ChangePasswordPopoverComponent', () => { let component: ChangePasswordPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ChangePasswordPopoverComponent], - imports: [IonicModule.forRoot(), FormsModule, RouterTestingModule], - providers: [ - { provide: AuthService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ChangePasswordPopoverComponent], + imports: [IonicModule.forRoot(), FormsModule, RouterTestingModule], + providers: [ + { provide: AuthService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(ChangePasswordPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ChangePasswordPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.html b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.html index bd5815628..bd680b7b4 100644 --- a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.html +++ b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.html @@ -6,20 +6,21 @@ 'chat-component.common.warn-label.message' | translate : { - lastModelRunDate: lastModelRunDate, - name: authService.displayName + lastModelRunDate, + name: authService.displayName, } " > - + @if (isWarn) { + + }

@@ -42,296 +43,306 @@ - - - - - - - - - - - + @if (!eventState?.events?.length) { + + + } @else { + + @for (event of eventState?.events; track event.eventName) { + @if ( + filteredStoppedAreas.length === 0 && filteredActiveAreas.length === 0 + ) { + @if (activeAreas.length) { + + } + @if (stoppedAreas.length) { + + } + } + } + } - - - - {{ - 'chat-component.common.revert-selection' | translate - }} - - -

- - {{ - 'chat-component.common.reactivate-trigger-popup.' + - hasEap() + - '.header' | translate: { alertLabel: area.alertLabel } - }} - -
-
- - - {{ - 'chat-component.common.revert-selection' | translate - }} - - - - - - - - 0) { + @for (area of filteredStoppedAreas; track area.name; let isFirst = $first) { + + @if (placeCode) { + + {{ + 'chat-component.common.revert-selection' | translate + }} + + + } +


- -

+ @if ( + countryDisasterSettings?.enableStopTrigger && + placeCode?.adminLevel === countryDisasterSettings.defaultAdminLevel + ) { + + {{ + 'chat-component.common.reactivate-trigger-popup.' + + hasEap() + + '.header' | translate: { alertLabel: area.alertLabel } + }} + + } +
+ } + } + @for (area of filteredActiveAreas; track area.name; let isFirst = $first) { + + @if (placeCode) { + + {{ + 'chat-component.common.revert-selection' | translate + }} + + + } + + + + + + - - {{ area.actionsValue | number: '.0-0' }} - - - {{ area.actionsValue | percent: '.0-0' }} - - -
-
- - - {{ - 'chat-component.drought.active-event.forecast-info.opening' - | translate - }} - - - - {{ forecast }} - {{ - 'chat-component.drought.active-event.forecast-info.and' - | translate - }} - - - {{ ' ' }} + >
+ @if (eventState?.event?.thresholdReached) { + + + @switch (actionIndicatorNumberFormat) { + @case ('decimal0') { + {{ area.actionsValue | number: '.0-0' }} + } + @case ('perc') { + {{ area.actionsValue | percent: '.0-0' }} + } + } + -
-
-
-
- - - - - - {{ - 'chat-component.common.save-actions.no-actions-admin-level' - | translate - : { - defaultAdminAreaLabel: - country.adminRegionLabels[ - countryDisasterSettings.defaultAdminLevel - ].singular + } +
+ @if (countryDisasterSettings?.showMonthlyEapActions) { +
+ @if (forecastInfo && country?.countryCodeISO3 === 'KEN') { + @if (area?.eapActions; as actions) { + + @if (forecastInfo?.length) { + {{ + 'chat-component.drought.active-event.forecast-info.opening' + | translate + }} + } - }} - + + } + } +
+ } +
+
+ @if (eventState?.event?.thresholdReached) { + @if (countryDisasterSettings.enableEarlyActions) { + @if (adminLevel > countryDisasterSettings.defaultAdminLevel) { + + + {{ + 'chat-component.common.save-actions.no-actions-admin-level' + | translate + : { + defaultAdminAreaLabel: + country.adminRegionLabels[ + countryDisasterSettings.defaultAdminLevel + ].singular, + } + }} + } + @if ( adminLevel === countryDisasterSettings.defaultAdminLevel && !area.eapActions.length - " - class="background-light" - > - - {{ - 'chat-component.common.save-actions.no-actions' | translate - }} -
- - + + {{ + 'chat-component.common.save-actions.no-actions' | translate + }} - - {{ action.aofLabel }}: {{ action.label - }} - ({{ action.monthLong[getRegion(area.placeCode)] }}) + + @for (action of area.eapActions; track action) { + + + {{ action.aofLabel }}: {{ action.label }} + @if (action.month) { + + ({{ + action.monthLong[getRegion(area.placeCode)] + }}) + } + + + } + + + - - - - - - {{ - 'chat-component.common.save-actions.submit-button-label' - | translate - }} - - -
- - {{ - 'chat-component.common.stop-trigger-popup.' + hasEap() + '.header' - | translate: { alertLabel: area.alertLabel } - }} - -
+ ) { + {{ + 'chat-component.common.stop-trigger-popup.' + hasEap() + '.header' + | translate: { alertLabel: area.alertLabel } + }} + } + } + + } diff --git a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.spec.ts index f30b6ed46..fba4e1763 100644 --- a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.spec.ts @@ -14,23 +14,21 @@ describe('ChatComponent', () => { let component: ChatComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ChatComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ChatComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(ChatComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ChatComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.ts b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.ts index 1bd8b2a22..255697490 100644 --- a/interfaces/IBF-dashboard/src/app/components/chat/chat.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/chat/chat.component.ts @@ -151,10 +151,11 @@ export class ChatComponent implements OnInit, OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onIndicatorChange = (indicators: Indicator[]) => { @@ -222,12 +223,10 @@ export class ChatComponent implements OnInit, OnDestroy { this.adminLevel = this.placeCode?.adminLevel || this.countryDisasterSettings.defaultAdminLevel; - this.adminAreaLabel = this.country.adminRegionLabels[ - this.adminLevel - ].singular; - this.adminAreaLabelPlural = this.country.adminRegionLabels[ - this.adminLevel - ].plural.toLowerCase(); + this.adminAreaLabel = + this.country.adminRegionLabels[this.adminLevel].singular; + this.adminAreaLabelPlural = + this.country.adminRegionLabels[this.adminLevel].plural.toLowerCase(); this.changeDetectorRef.detectChanges(); this.disasterTypeLabel = this.disasterType.label; @@ -266,9 +265,9 @@ export class ChatComponent implements OnInit, OnDestroy { private filterTriggeredAreaByPlaceCode = (placeCode) => (triggeredArea) => triggeredArea.placeCode === placeCode; - private filterChangedEAPActionByChangedEAPAction = (changedAction) => ( - eapAction, - ) => !(eapAction.action === changedAction.action); + private filterChangedEAPActionByChangedEAPAction = + (changedAction) => (eapAction) => + !(eapAction.action === changedAction.action); private filterEAPActionByEAPAction = (action) => (eapAction) => eapAction.action === action; @@ -290,9 +289,8 @@ export class ChatComponent implements OnInit, OnDestroy { component: this.constructor.name, }); - const filterTriggeredAreaByPlaceCode = this.filterTriggeredAreaByPlaceCode( - placeCode, - ); + const filterTriggeredAreaByPlaceCode = + this.filterTriggeredAreaByPlaceCode(placeCode); const triggeredArea = this.triggeredAreas.find( filterTriggeredAreaByPlaceCode, @@ -456,12 +454,12 @@ export class ChatComponent implements OnInit, OnDestroy { return; } - const droughtForecastSeasons = this.countryDisasterSettings - ?.droughtForecastSeasons; + const droughtForecastSeasons = + this.countryDisasterSettings?.droughtForecastSeasons; const forecastAreas = Object.keys(droughtForecastSeasons); - const droughtEndOfMonthPipeline = this.countryDisasterSettings - ?.droughtEndOfMonthPipeline; + const droughtEndOfMonthPipeline = + this.countryDisasterSettings?.droughtEndOfMonthPipeline; const currentMonth = this.timelineState.today.plus({ months: droughtEndOfMonthPipeline ? 1 : 0, }); @@ -515,10 +513,10 @@ export class ChatComponent implements OnInit, OnDestroy { disasterType.leadTimeUnit === LeadTimeUnit.day ? 'days' : disasterType.leadTimeUnit === LeadTimeUnit.hour - ? 'hours' - : disasterType.leadTimeUnit === LeadTimeUnit.month - ? 'months' - : null; + ? 'hours' + : disasterType.leadTimeUnit === LeadTimeUnit.month + ? 'months' + : null; const durationUnitValue = disasterType.leadTimeUnit === LeadTimeUnit.hour ? 6 // all "hour" pipelines are 6-hourly @@ -545,12 +543,11 @@ export class ChatComponent implements OnInit, OnDestroy { const currentMonth = this.timelineState.today.month; const prefixKey = 'prefix'; - const prefix = this.countryDisasterSettings.monthlyForecastInfo[ - prefixKey - ]; + const prefix = + this.countryDisasterSettings.monthlyForecastInfo[prefixKey]; - const currentMonthforecastInfo = this.countryDisasterSettings - .monthlyForecastInfo[currentMonth]; + const currentMonthforecastInfo = + this.countryDisasterSettings.monthlyForecastInfo[currentMonth]; if (typeof currentMonthforecastInfo === 'string') { return []; } diff --git a/interfaces/IBF-dashboard/src/app/components/community-notification-photo-popup/community-notification-photo-popup.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/community-notification-photo-popup/community-notification-photo-popup.component.spec.ts index 882bc1d8e..1a589ee2b 100644 --- a/interfaces/IBF-dashboard/src/app/components/community-notification-photo-popup/community-notification-photo-popup.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/community-notification-photo-popup/community-notification-photo-popup.component.spec.ts @@ -13,24 +13,20 @@ describe('CommunityNotificationPhotoPopupComponent', () => { let component: CommunityNotificationPhotoPopupComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [CommunityNotificationPhotoPopupComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [CommunityNotificationPhotoPopupComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent( - CommunityNotificationPhotoPopupComponent, - ); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(CommunityNotificationPhotoPopupComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/community-notification-popup/community-notification-popup.component.html b/interfaces/IBF-dashboard/src/app/components/community-notification-popup/community-notification-popup.component.html index 3306754e2..225847bd1 100644 --- a/interfaces/IBF-dashboard/src/app/components/community-notification-popup/community-notification-popup.component.html +++ b/interfaces/IBF-dashboard/src/app/components/community-notification-popup/community-notification-popup.component.html @@ -36,21 +36,23 @@ | translate: { nameVolunteer: markerProperties?.nameVolunteer || '' } " > -{{ 'map-popups.community-notification.photo' | translate }} - - -
- {{ - 'map-popups.community-notification.no-photo' | translate - }} -
+@if (markerProperties?.photoUrl) { + {{ 'map-popups.community-notification.photo' | translate }} + + +} @else { +
+ {{ + 'map-popups.community-notification.no-photo' | translate + }} +
+} { let component: CommunityNotificationPopupComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [CommunityNotificationPopupComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [CommunityNotificationPopupComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(CommunityNotificationPopupComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(CommunityNotificationPopupComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.html b/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.html index 7dd81d5ff..be0b7c2cb 100644 --- a/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.html +++ b/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.html @@ -1,16 +1,20 @@ - - Country - - 1) { + + Country + - {{ country.countryName }} - - - + @for ( + country of countryService.countries; + track country.countryCodeISO3 + ) { + + {{ country.countryName }} + + } + + +} diff --git a/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.spec.ts index 6fa609250..6912b0dfd 100644 --- a/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/country-switcher/country-switcher.component.spec.ts @@ -13,23 +13,21 @@ describe('CountrySwitcherComponent', () => { let component: CountrySwitcherComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [CountrySwitcherComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - { provide: CountryService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [CountrySwitcherComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + { provide: CountryService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(CountrySwitcherComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(CountrySwitcherComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.html b/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.html index e3713700e..c7ebe10fb 100644 --- a/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.html +++ b/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.html @@ -1,23 +1,26 @@ -
- {{ firstLine }} -
-
+ @if (firstLine) { +
+ {{ firstLine }} +
+
+ } {{ secondLine }} -
- {{ thirdLine }} -
-
+ @if (thirdLine) { +
+ {{ thirdLine }} +
+
+ }
- - +@if (alert) { + +} diff --git a/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.spec.ts index e82c83c8c..8f3dc17ba 100644 --- a/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/date-button/date-button.component.spec.ts @@ -12,22 +12,20 @@ describe('DateButtonComponent', () => { let component: DateButtonComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [DateButtonComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [DateButtonComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(DateButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(DateButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.html b/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.html index e4e95af50..0d14b6ef9 100644 --- a/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.html +++ b/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.html @@ -11,7 +11,7 @@ 'is-triggered': isTriggered, 'is-not-triggered': isNotTriggered, 'is-selected': isSelected, - 'is-opening-bubble': isOpeningBubble + 'is-opening-bubble': isOpeningBubble, }" >
diff --git a/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.spec.ts index 443f058ff..d6e321e8f 100644 --- a/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/dialogue-turn/dialogue-turn.component.spec.ts @@ -6,14 +6,12 @@ describe('DialogueTurnComponent', () => { let component: DialogueTurnComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [DialogueTurnComponent], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); - }), - ); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [DialogueTurnComponent], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); + })); beforeEach(() => { fixture = TestBed.createComponent(DialogueTurnComponent); diff --git a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.html b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.html index 62e3035ac..db15dad57 100644 --- a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.html +++ b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.html @@ -1,18 +1,22 @@ -
- - -
+ @for (disasterType of disasterTypes; track disasterType.label) { +
+ + +
+ }
diff --git a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.spec.ts index 0748fcc12..930c941c0 100644 --- a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.spec.ts @@ -13,22 +13,20 @@ describe('DisasterTypeComponent', () => { let component: DisasterTypeComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [DisasterTypeComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [DisasterTypeComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(DisasterTypeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(DisasterTypeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.ts b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.ts index 349a2d81a..389a5e424 100644 --- a/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/disaster-type/disaster-type.component.ts @@ -82,22 +82,22 @@ export class DisasterTypeComponent implements OnInit, OnDestroy { } }; - private onGetDisasterTypeActiveTrigger = ( - disasterTypes: DisasterType[], - ) => () => { - this.disasterTypesCounter++; - if (this.disasterTypesCounter === disasterTypes.length) { - const activeDisasterType = disasterTypes.find( - ({ activeTrigger }) => activeTrigger, - ); + private onGetDisasterTypeActiveTrigger = + (disasterTypes: DisasterType[]) => () => { + this.disasterTypesCounter++; + if (this.disasterTypesCounter === disasterTypes.length) { + const activeDisasterType = disasterTypes.find( + ({ activeTrigger }) => activeTrigger, + ); - const disasterType = activeDisasterType - ? activeDisasterType - : this.disasterTypes[0]; - this.selectedDisasterType = disasterType.disasterType as DisasterTypeKey; - this.disasterTypeService.setDisasterType(disasterType); - } - }; + const disasterType = activeDisasterType + ? activeDisasterType + : this.disasterTypes[0]; + this.selectedDisasterType = + disasterType.disasterType as DisasterTypeKey; + this.disasterTypeService.setDisasterType(disasterType); + } + }; public switchDisasterType(disasterType: DisasterType): void { this.placeCodeService.clearPlaceCode(); diff --git a/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.html b/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.html index 53c2a29f6..8f70f259a 100644 --- a/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.html +++ b/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.html @@ -1,9 +1,7 @@ - - IBF DEMO - SIMULATED DATA - +@if (environmentConfiguration === 'stage') { + + IBF DEMO - SIMULATED DATA + +} diff --git a/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.spec.ts index 68c34c64a..4dcb3d9b1 100644 --- a/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/disclaimer-toolbar/disclaimer-toolbar.component.spec.ts @@ -6,18 +6,16 @@ describe('DisclaimerToolbarComponent', () => { let component: DisclaimerToolbarComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [DisclaimerToolbarComponent], - imports: [IonicModule], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [DisclaimerToolbarComponent], + imports: [IonicModule], + }).compileComponents(); - fixture = TestBed.createComponent(DisclaimerToolbarComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(DisclaimerToolbarComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html index f6d7c3c08..439452d2a 100644 --- a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html +++ b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html @@ -1,304 +1,323 @@ - - -
- - - - {{ event.header }} +@if (type === 'active') { + + @if (event.thresholdReached) { +
+ + + + {{ event.header }} + - - - -
-

- +

+

+ @if (!event.duration && showFirstWarningDate()) { + + } + @if (event.duration) { + + } +

+ } @else { +
+ + + + {{ event.header }} + + + +
+

- -

-
+ >

+ } - -
- - - - {{ event.header }} - - + @if (isEventWithForecastClasses()) { +

+ {{ event.disasterSpecificProperties.eapAlertClass.label }}: + + @if (event.thresholdReached) { + {{ + 'chat-component.' + + disasterTypeName + + '.alertLevel.expected-trigger' | translate + }} + {{ event.firstTriggerLeadTimeDate }} + } @else { + {{ + 'chat-component.' + disasterTypeName + '.alertLevel.expected' + | translate + }} + {{ event.firstLeadTimeDate }} + } +

+ @if (event.affectedAreas) { +

+ {{ + 'chat-component.' + disasterTypeName + '.alertLevel.exposed-areas' + | translate: { adminAreaLabelPlural: adminAreaLabelPlural } + }} + + {{ event.affectedAreas + ' ' }} + @if (event.thresholdReached) { + {{ + '(' + + (actionIndicatorLabel | titlecase) + + ' ' + + (event.actionsValueSum | number: '.0-0') + + ')' + }} + } @else { + + {{ + '(' + + ('chat-component.' + disasterTypeName + '.alertLevel.no-data' + | translate) + + ')' + }} + + } +

+ } + } - -
-

-
+ @if (typhoonLandfallText) { +

+ } - -

- {{ event.disasterSpecificProperties.eapAlertClass.label }}: - - {{ - 'chat-component.' + disasterTypeName + '.alertLevel.expected-trigger' - | translate - }} - {{ event.firstTriggerLeadTimeDate }} - {{ - 'chat-component.' + disasterTypeName + '.alertLevel.expected' - | translate - }} - {{ event.firstLeadTimeDate }} -

-

- {{ - 'chat-component.' + disasterTypeName + '.alertLevel.exposed-areas' - | translate: { adminAreaLabelPlural: adminAreaLabelPlural } - }} - - {{ event.affectedAreas + ' ' }} - {{ - '(' + - (actionIndicatorLabel | titlecase) + - ' ' + - (event.actionsValueSum | number: '.0-0') + - ')' - }} - - {{ - '(' + - ('chat-component.' + disasterTypeName + '.alertLevel.no-data' - | translate) + - ')' - }} - -

-
+ @if (forecastInfo && countryCodeISO3 === 'ZWE') { +

{{ forecastInfo }}

+ } -

+ @if (!!clearOutMessage) { +

+ } -

- {{ forecastInfo }} -

+ -

+ @if (event.eventName === selectedEvent) { + @if (event.thresholdReached) { +

+ } @else { +

+ } + @for (class of alertClasses; track class.alertClass) { +
+ {{ class }} +
    + @for (area of class.areas; track area.name) { +
  • +

    + {{ area.name }} + @if (area.nameParent) { + ({{ area.nameParent }}) + } + @if (area.actionsValue && area.actionsValue > 0) { + {{ ' - ' }} + @switch (actionIndicatorNumberFormat) { + @case ('decimal0') { + {{ area.actionsValue | number: '.0-0' }} + } + @case ('perc') { + {{ area.actionsValue | percent: '.0-0' }} + } + } + } +

    +
  • + } +
+
+ } + @if (event.thresholdReached) { +

+ } + } - + @if (event) { + + } +
+} - -

+@if (type === 'stopped' && event.eventName === selectedEvent) { +

-
-
    -
  • -

    - {{ area.name }} - ({{ area.nameParent }}) - - {{ ' - ' }} - {{ - area.actionsValue | number: '.0-0' - }} - {{ - area.actionsValue | percent: '.0-0' - }} - + @for (class of alertClasses; track class.alertClass) { +

    + @if (class.alertClass !== 'undefined') { +

    + {{ class.alertClass }}

    -
  • -
-
+ } +
    + @for (area of class.areas; track area.name) { +
  • +

    + {{ area.name }} + @if (area.nameParent) { + ({{ area.nameParent }}) + } + - + @switch (actionIndicatorNumberFormat) { + @case ('decimal0') { + {{ area.actionsValue | number: '.0-0' }} + } + @case ('perc') { + {{ area.actionsValue | percent: '.0-0' }} + } + } +

    +
  • + } +
+
+ }

- - - - - - + +} - - +@if (type === 'no-event') { +

-
-

- {{ class.alertClass }} -

-
    -
  • -

    - {{ area.name }} - ({{ area.nameParent }}) - - {{ - area.actionsValue | number: '.0-0' - }}{{ - area.actionsValue | percent: '.0-0' - }} -

    -
  • -
-
-

-
-
- - -

-

-
+ @if (!!clearOutMessage) { +

+ } + +} diff --git a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.spec.ts index 26fd7839d..dc34741e8 100644 --- a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.spec.ts @@ -13,26 +13,24 @@ describe('EventSpeechBubbleComponent', () => { let component: EventSpeechBubbleComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [EventSpeechBubbleComponent], - imports: [ - IonicModule.forRoot(), - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [EventSpeechBubbleComponent], + imports: [ + IonicModule.forRoot(), + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(EventSpeechBubbleComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(EventSpeechBubbleComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.ts b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.ts index 74d29b1c1..596e5d3fd 100644 --- a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.ts @@ -181,8 +181,8 @@ export class EventSpeechBubbleComponent implements AfterViewChecked, OnDestroy { noLandfallYetEvent ? 'no-landfall-yet' : landfallEvent - ? 'landfall' - : 'no-landfall' + ? 'landfall' + : 'no-landfall' }`, { firstLeadTimeDate: event.firstLeadTimeDate, diff --git a/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.html b/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.html index 055f23858..892a643fc 100644 --- a/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.html +++ b/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.html @@ -1,58 +1,64 @@ -
-
-
-

- -

+@if (multipleActiveEvents()) { +
+ @if (event?.eventName === selectedEventName && !showLessButton()) { +
+
+

+ +

+
+ } +
+ @if (event?.eventName === selectedEventName && showLessButton()) { + + + + + } + @if (event?.eventName !== selectedEventName) { + + + + + } +
-
- - - - - - - - -
-
+} diff --git a/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.spec.ts index 2649cfbdd..ec41d7853 100644 --- a/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/event-switcher/event-switcher.component.spec.ts @@ -12,22 +12,20 @@ describe('EventSwitcherComponent', () => { let component: EventSwitcherComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [EventSwitcherComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [EventSwitcherComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(EventSwitcherComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(EventSwitcherComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); xit('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/export-view-popover/export-view-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/export-view-popover/export-view-popover.component.spec.ts index cd28d2d17..0d44545e8 100644 --- a/interfaces/IBF-dashboard/src/app/components/export-view-popover/export-view-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/export-view-popover/export-view-popover.component.spec.ts @@ -6,18 +6,16 @@ describe('ExportViewPopoverComponent', () => { let component: ExportViewPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ExportViewPopoverComponent], - imports: [IonicModule], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ExportViewPopoverComponent], + imports: [IonicModule], + }).compileComponents(); - fixture = TestBed.createComponent(ExportViewPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ExportViewPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/export-view/export-view.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/export-view/export-view.component.spec.ts index e2acfb96a..877d034f1 100644 --- a/interfaces/IBF-dashboard/src/app/components/export-view/export-view.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/export-view/export-view.component.spec.ts @@ -12,22 +12,20 @@ describe('ExportViewComponent', () => { let component: ExportViewComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ExportViewComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ExportViewComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(ExportViewComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ExportViewComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/forgot-password-popover/forgot-password-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/forgot-password-popover/forgot-password-popover.component.spec.ts index e7f022499..a18e91d8e 100644 --- a/interfaces/IBF-dashboard/src/app/components/forgot-password-popover/forgot-password-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/forgot-password-popover/forgot-password-popover.component.spec.ts @@ -7,18 +7,16 @@ describe('ForgotPasswordPopoverComponent', () => { let component: ForgotPasswordPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ForgotPasswordPopoverComponent], - imports: [IonicModule.forRoot(), TranslateModule.forRoot()], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ForgotPasswordPopoverComponent], + imports: [IonicModule.forRoot(), TranslateModule.forRoot()], + }).compileComponents(); - fixture = TestBed.createComponent(ForgotPasswordPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ForgotPasswordPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/ibf-button/ibf-button.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/ibf-button/ibf-button.component.spec.ts index ef7ae7f06..3a6c3e508 100644 --- a/interfaces/IBF-dashboard/src/app/components/ibf-button/ibf-button.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/ibf-button/ibf-button.component.spec.ts @@ -6,18 +6,16 @@ describe('IbfButtonComponent', () => { let component: IbfButtonComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [IbfButtonComponent], - imports: [IonicModule.forRoot()], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [IbfButtonComponent], + imports: [IonicModule.forRoot()], + }).compileComponents(); - fixture = TestBed.createComponent(IbfButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(IbfButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/ibf-guide-button/ibf-guide-button.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/ibf-guide-button/ibf-guide-button.component.spec.ts index 897a299f2..e135887a9 100644 --- a/interfaces/IBF-dashboard/src/app/components/ibf-guide-button/ibf-guide-button.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/ibf-guide-button/ibf-guide-button.component.spec.ts @@ -13,22 +13,20 @@ describe('IbfGuideButtonComponent', () => { let component: IbfGuideButtonComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [IbfGuideButtonComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [IbfGuideButtonComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(IbfGuideButtonComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(IbfGuideButtonComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.html b/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.html index 035ee6e25..ceebcc1af 100644 --- a/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.html +++ b/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.html @@ -16,7 +16,7 @@ 'ibf-guide-component.video-pdf-description' | translate : { - pdfUrl: pdfUrl + pdfUrl: pdfUrl, } " >

@@ -26,7 +26,7 @@ 'ibf-guide-component.whats-new-description' | translate : { - whatsNewUrl: whatsNewUrl + whatsNewUrl: whatsNewUrl, } " >

diff --git a/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.spec.ts index 05d7a8d4d..367878280 100644 --- a/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/ibf-guide-popover/ibf-guide-popover.component.spec.ts @@ -12,22 +12,20 @@ describe('IbfGuidePopoverComponent', () => { let component: IbfGuidePopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [IbfGuidePopoverComponent], - imports: [IonicModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [IbfGuidePopoverComponent], + imports: [IonicModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(IbfGuidePopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(IbfGuidePopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/layer-control-info-popover/layer-control-info-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/layer-control-info-popover/layer-control-info-popover.component.spec.ts index 2ac4a81ea..aa590b27d 100644 --- a/interfaces/IBF-dashboard/src/app/components/layer-control-info-popover/layer-control-info-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/layer-control-info-popover/layer-control-info-popover.component.spec.ts @@ -6,18 +6,16 @@ describe('LayerControlInfoPopoverComponent', () => { let component: LayerControlInfoPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [LayerControlInfoPopoverComponent], - imports: [IonicModule], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [LayerControlInfoPopoverComponent], + imports: [IonicModule], + }).compileComponents(); - fixture = TestBed.createComponent(LayerControlInfoPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(LayerControlInfoPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/dynamic-point-popup/dynamic-point-popup.component.html b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/dynamic-point-popup/dynamic-point-popup.component.html index 622096c3a..5375f8ea6 100644 --- a/interfaces/IBF-dashboard/src/app/components/leaflet-popup/dynamic-point-popup/dynamic-point-popup.component.html +++ b/interfaces/IBF-dashboard/src/app/components/leaflet-popup/dynamic-point-popup/dynamic-point-popup.component.html @@ -6,20 +6,23 @@ {{ title }}
- - - - - + @switch (layerName) { + @case (ibfLayerName.gauges) { + + } + @case (ibfLayerName.typhoonTrack) { + + } + @case (ibfLayerName.glofasStations) { + + } + }
{{ thresholdDescription }}:
- {{ thresholdValue }}{{ unit }} + {{ thresholdValue }} + @if (unit) { + {{ unit }} + }
diff --git a/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.html b/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.html index bfbf736fb..13bfe4a20 100644 --- a/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.html +++ b/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.html @@ -44,18 +44,15 @@ [title]="isPassword() ? this.labelShow : this.labelHide" [attr.aria-label]="isPassword() ? this.labelShow : this.labelHide" > - - + @if (isPassword()) { + + } @else { + + } diff --git a/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.spec.ts index 71af4743a..967526db3 100644 --- a/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/login-form/login-form.component.spec.ts @@ -15,28 +15,26 @@ describe('LoginFormComponent', () => { let component: LoginFormComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [LoginFormComponent], - imports: [ - IonicModule, - FormsModule, - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - { provide: AuthService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [LoginFormComponent], + imports: [ + IonicModule, + FormsModule, + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + { provide: AuthService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(LoginFormComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(LoginFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/logos/logos.component.html b/interfaces/IBF-dashboard/src/app/components/logos/logos.component.html index 1feeed5a6..d38cdd4ce 100644 --- a/interfaces/IBF-dashboard/src/app/components/logos/logos.component.html +++ b/interfaces/IBF-dashboard/src/app/components/logos/logos.component.html @@ -1,9 +1,6 @@ - +@for ( + logo of (country | async)?.countryLogos[(disasterType | async)?.disasterType]; + track logo +) { - +} diff --git a/interfaces/IBF-dashboard/src/app/components/logos/logos.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/logos/logos.component.spec.ts index f088db3e6..e63a518ab 100644 --- a/interfaces/IBF-dashboard/src/app/components/logos/logos.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/logos/logos.component.spec.ts @@ -12,22 +12,20 @@ describe('LogosComponent', () => { let component: LogosComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [LogosComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [LogosComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(LogosComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(LogosComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.spec.ts index 237252996..6731b8cd1 100644 --- a/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/map-controls/map-controls.component.spec.ts @@ -7,19 +7,17 @@ describe('MapControlsComponent', () => { let component: MapControlsComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [MapControlsComponent], - imports: [IonicModule], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MapControlsComponent], + imports: [IonicModule], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); - fixture = TestBed.createComponent(MapControlsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(MapControlsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/map/map.component.html b/interfaces/IBF-dashboard/src/app/components/map/map.component.html index 2fb3266c5..d358a9948 100644 --- a/interfaces/IBF-dashboard/src/app/components/map/map.component.html +++ b/interfaces/IBF-dashboard/src/app/components/map/map.component.html @@ -5,10 +5,11 @@ class="leaflet--map" data-test="leaflet-map" > -
-
-
+ @for (layer of layers; track layer.name) { +
+ @if (layer.active && layer.show) { +
+ } +
+ } diff --git a/interfaces/IBF-dashboard/src/app/components/map/map.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/map/map.component.spec.ts index 0c919ac59..7e0678bc8 100644 --- a/interfaces/IBF-dashboard/src/app/components/map/map.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/map/map.component.spec.ts @@ -15,28 +15,26 @@ describe('MapComponent', () => { let component: MapComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [MapComponent], - imports: [ - IonicModule, - LeafletModule, - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - { provide: MapService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MapComponent], + imports: [ + IonicModule, + LeafletModule, + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + { provide: MapService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(MapComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(MapComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/map/map.component.ts b/interfaces/IBF-dashboard/src/app/components/map/map.component.ts index b11e88d0c..aaff7bbd5 100644 --- a/interfaces/IBF-dashboard/src/app/components/map/map.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/map/map.component.ts @@ -198,10 +198,11 @@ export class MapComponent implements AfterViewInit, OnDestroy { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onTimelineStateChange = (timelineState: TimelineState) => { @@ -245,12 +246,13 @@ export class MapComponent implements AfterViewInit, OnDestroy { JSON.stringify(adminRegionsLayer.data), ); if (this.placeCode) { - adminRegionsFiltered.features = adminRegionsLayer.data?.features.filter( - (area) => - area?.properties?.['placeCode'] === this.placeCode.placeCode || - area?.properties?.['placeCodeParent'] === - this.placeCode.placeCode, - ); + adminRegionsFiltered.features = + adminRegionsLayer.data?.features.filter( + (area) => + area?.properties?.['placeCode'] === this.placeCode.placeCode || + area?.properties?.['placeCodeParent'] === + this.placeCode.placeCode, + ); } else { adminRegionsFiltered.features = adminRegionsLayer.data?.features; } @@ -449,75 +451,74 @@ export class MapComponent implements AfterViewInit, OnDestroy { }); } - private getPointToLayerByLayer = (layerName) => ( - geoJsonPoint: GeoJSON.Feature, - latlng: LatLng, - ): Marker => { - switch (layerName) { - case IbfLayerName.glofasStations: { - return this.pointMarkerService.createMarkerStation( - geoJsonPoint.properties as Station, - latlng, - this.countryDisasterSettings, - this.eventState?.events, - ); + private getPointToLayerByLayer = + (layerName) => + (geoJsonPoint: GeoJSON.Feature, latlng: LatLng): Marker => { + switch (layerName) { + case IbfLayerName.glofasStations: { + return this.pointMarkerService.createMarkerStation( + geoJsonPoint.properties as Station, + latlng, + this.countryDisasterSettings, + this.eventState?.events, + ); + } + case IbfLayerName.redCrossBranches: + return this.pointMarkerService.createMarkerRedCrossBranch( + geoJsonPoint.properties as RedCrossBranch, + latlng, + ); + case IbfLayerName.typhoonTrack: + return this.pointMarkerService.createMarkerTyphoonTrack( + geoJsonPoint.properties as TyphoonTrackPoint, + latlng, + this.lastModelRunDate, + this.closestPointToTyphoon, + ); + case IbfLayerName.damSites: + return this.pointMarkerService.createMarkerDam( + geoJsonPoint.properties as DamSite, + latlng, + ); + case IbfLayerName.waterpoints: + return this.pointMarkerService.createMarkerWaterpoint( + geoJsonPoint.properties as Waterpoint, + latlng, + ); + case IbfLayerName.healthSites: + return this.pointMarkerService.createMarkerHealthSite( + geoJsonPoint.properties as HealthSite, + latlng, + ); + case IbfLayerName.evacuationCenters: + return this.pointMarkerService.createMarkerEvacuationCenter( + geoJsonPoint.properties as EvacuationCenter, + latlng, + ); + case IbfLayerName.schools: + return this.pointMarkerService.createMarkerSchool( + geoJsonPoint.properties as School, + latlng, + ); + case IbfLayerName.waterpointsInternal: + return this.pointMarkerService.createMarkerWaterpointInternal( + geoJsonPoint.properties as WaterpointInternal, + latlng, + ); + case IbfLayerName.communityNotifications: + return this.pointMarkerService.createMarkerCommunityNotification( + geoJsonPoint.properties as CommunityNotification, + latlng, + ); + case IbfLayerName.gauges: + return this.pointMarkerService.createMarkerRiverGauges( + geoJsonPoint.properties as RiverGauge, + latlng, + ); + default: + return this.pointMarkerService.createMarkerDefault(latlng); } - case IbfLayerName.redCrossBranches: - return this.pointMarkerService.createMarkerRedCrossBranch( - geoJsonPoint.properties as RedCrossBranch, - latlng, - ); - case IbfLayerName.typhoonTrack: - return this.pointMarkerService.createMarkerTyphoonTrack( - geoJsonPoint.properties as TyphoonTrackPoint, - latlng, - this.lastModelRunDate, - this.closestPointToTyphoon, - ); - case IbfLayerName.damSites: - return this.pointMarkerService.createMarkerDam( - geoJsonPoint.properties as DamSite, - latlng, - ); - case IbfLayerName.waterpoints: - return this.pointMarkerService.createMarkerWaterpoint( - geoJsonPoint.properties as Waterpoint, - latlng, - ); - case IbfLayerName.healthSites: - return this.pointMarkerService.createMarkerHealthSite( - geoJsonPoint.properties as HealthSite, - latlng, - ); - case IbfLayerName.evacuationCenters: - return this.pointMarkerService.createMarkerEvacuationCenter( - geoJsonPoint.properties as EvacuationCenter, - latlng, - ); - case IbfLayerName.schools: - return this.pointMarkerService.createMarkerSchool( - geoJsonPoint.properties as School, - latlng, - ); - case IbfLayerName.waterpointsInternal: - return this.pointMarkerService.createMarkerWaterpointInternal( - geoJsonPoint.properties as WaterpointInternal, - latlng, - ); - case IbfLayerName.communityNotifications: - return this.pointMarkerService.createMarkerCommunityNotification( - geoJsonPoint.properties as CommunityNotification, - latlng, - ); - case IbfLayerName.gauges: - return this.pointMarkerService.createMarkerRiverGauges( - geoJsonPoint.properties as RiverGauge, - latlng, - ); - default: - return this.pointMarkerService.createMarkerDefault(latlng); - } - }; + }; private getIconCreateFunction = (cluster) => { const clusterSize = cluster.getChildCount(); @@ -618,71 +619,72 @@ export class MapComponent implements AfterViewInit, OnDestroy { return [mapLayer]; } - private onAdminRegionMouseOver = (feature) => (event): void => { - event.target.setStyle( - this.mapService.setAdminRegionMouseOverStyle( - feature.properties.placeCode, - feature.properties.placeCodeParent, - ), - ); - this.placeCodeService.setPlaceCodeHover({ - countryCodeISO3: feature.properties.countryCodeISO3, - placeCode: feature.properties.placeCode, - placeCodeName: feature.properties.name, - placeCodeParentName: feature.properties.nameParent, - eventName: feature.properties.eventName, - adminLevel: feature.properties.adminLevel, - }); - }; + private onAdminRegionMouseOver = + (feature) => + (event): void => { + event.target.setStyle( + this.mapService.setAdminRegionMouseOverStyle( + feature.properties.placeCode, + feature.properties.placeCodeParent, + ), + ); + this.placeCodeService.setPlaceCodeHover({ + countryCodeISO3: feature.properties.countryCodeISO3, + placeCode: feature.properties.placeCode, + placeCodeName: feature.properties.name, + placeCodeParentName: feature.properties.nameParent, + eventName: feature.properties.eventName, + adminLevel: feature.properties.adminLevel, + }); + }; - private onAdminRegionClickByLayerAndFeatureAndElement = ( - feature, - ) => (): void => { - const adminLevel = feature.properties.adminLevel; - const placeCode = feature.properties.placeCode; - - this.analyticsService.logEvent(AnalyticsEvent.mapPlaceSelect, { - placeCode, - page: AnalyticsPage.dashboard, - isActiveTrigger: this.eventService.state.events?.length > 0, - component: this.constructor.name, - }); + private onAdminRegionClickByLayerAndFeatureAndElement = + (feature) => (): void => { + const adminLevel = feature.properties.adminLevel; + const placeCode = feature.properties.placeCode; - // if click in overview-mode - if (!this.eventState.event) { - // go to event-view, but don't set placeCode - if (feature.properties.eventName) { - const event = this.eventState?.events?.find( - (e) => e.eventName === feature.properties.eventName, - ); - this.timelineService.handleTimeStepButtonClick( - (event?.firstTriggerLeadTime || event?.firstLeadTime) as LeadTime, - event?.eventName, - ); - this.eventService.switchEvent(feature.properties.eventName); - } - } else if (this.eventState.event) { - // if in event-view, then set placeCode - if (placeCode !== this.placeCode?.placeCode) { - // only zoom-in when actually zooming in (instead of selecting a peer-area on the same level) - const zoomIn = adminLevel > (this.placeCode?.adminLevel || 0); - if (zoomIn) { - this.adminLevelService.zoomInAdminLevel(); + this.analyticsService.logEvent(AnalyticsEvent.mapPlaceSelect, { + placeCode, + page: AnalyticsPage.dashboard, + isActiveTrigger: this.eventService.state.events?.length > 0, + component: this.constructor.name, + }); + + // if click in overview-mode + if (!this.eventState.event) { + // go to event-view, but don't set placeCode + if (feature.properties.eventName) { + const event = this.eventState?.events?.find( + (e) => e.eventName === feature.properties.eventName, + ); + this.timelineService.handleTimeStepButtonClick( + (event?.firstTriggerLeadTime || event?.firstLeadTime) as LeadTime, + event?.eventName, + ); + this.eventService.switchEvent(feature.properties.eventName); + } + } else if (this.eventState.event) { + // if in event-view, then set placeCode + if (placeCode !== this.placeCode?.placeCode) { + // only zoom-in when actually zooming in (instead of selecting a peer-area on the same level) + const zoomIn = adminLevel > (this.placeCode?.adminLevel || 0); + if (zoomIn) { + this.adminLevelService.zoomInAdminLevel(); + } + this.placeCodeService.setPlaceCode({ + placeCode, + countryCodeISO3: feature.properties.countryCodeISO3, + placeCodeName: feature.properties.name, + placeCodeParent: zoomIn + ? this.placeCode + : this.placeCode?.placeCodeParent, + placeCodeParentName: feature.properties.nameParent, + adminLevel, + eventName: feature.properties.eventName, + }); } - this.placeCodeService.setPlaceCode({ - placeCode, - countryCodeISO3: feature.properties.countryCodeISO3, - placeCodeName: feature.properties.name, - placeCodeParent: zoomIn - ? this.placeCode - : this.placeCode?.placeCodeParent, - placeCodeParentName: feature.properties.nameParent, - adminLevel, - eventName: feature.properties.eventName, - }); } - } - }; + }; private getAdminRegionLayerPane(layer: IbfLayer): LeafletPane { let adminRegionLayerPane = LeafletPane.overlayPane; switch (layer.group) { @@ -813,15 +815,15 @@ export class MapComponent implements AfterViewInit, OnDestroy { const events = this.eventState.event ? [this.eventState.event] : this.eventState.events.length > 0 - ? this.eventState.events - : [new EventSummary()]; + ? this.eventState.events + : [new EventSummary()]; for (const event of events) { const leadTime = !layer.wms.leadTimeDependent ? null : !this.eventState.event && event.firstLeadTime - ? event.firstLeadTime - : this.timelineState.activeLeadTime; + ? event.firstLeadTime + : this.timelineState.activeLeadTime; const name = `ibf-system:${layer.name}_${leadTime ? `${leadTime}_` : ''}${ this.country.countryCodeISO3 diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html index cfd3893f8..f762975f3 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.html @@ -15,55 +15,59 @@ > -
- - - - - - - - - - {{ layer.label }} - - - - - - - -
+ @if (isLayerMenuOpen) { +
+ + @for (layer of getLayersInOrder(); track layer.name) { + + + @if (layer.isLoading) { + + } @else { + @if (isCheckBox(layer.group)) { + + } + @if (isRadioButton(layer.group)) { + + } + } + + {{ layer.label }} + + + + + + + } + +
+ } diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.spec.ts index 56527e93e..464ea9232 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.spec.ts @@ -14,23 +14,21 @@ describe('MatrixComponent', () => { let component: MatrixComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [MatrixComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - { provide: MapService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [MatrixComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + { provide: MapService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(MatrixComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(MatrixComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts index c672049a8..23dc09b51 100644 --- a/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/matrix/matrix.component.ts @@ -110,9 +110,8 @@ export class MatrixComponent implements OnDestroy { } public async isLayerControlMenuOpen(): Promise { - this.hideLayerControlToggleButton = await this.menuController.isOpen( - 'layer-control', - ); + this.hideLayerControlToggleButton = + await this.menuController.isOpen('layer-control'); } private sortLayers = (a: IbfLayer, b: IbfLayer) => diff --git a/interfaces/IBF-dashboard/src/app/components/screen-orientation-popover/screen-orientation-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/screen-orientation-popover/screen-orientation-popover.component.spec.ts index 77efda267..76f473faa 100644 --- a/interfaces/IBF-dashboard/src/app/components/screen-orientation-popover/screen-orientation-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/screen-orientation-popover/screen-orientation-popover.component.spec.ts @@ -7,18 +7,16 @@ describe('ScreenOrientationPopoverComponent', () => { let component: ScreenOrientationPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ScreenOrientationPopoverComponent], - imports: [IonicModule.forRoot(), TranslateModule.forRoot()], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ScreenOrientationPopoverComponent], + imports: [IonicModule.forRoot(), TranslateModule.forRoot()], + }).compileComponents(); - fixture = TestBed.createComponent(ScreenOrientationPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ScreenOrientationPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.html b/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.html index edc488ff9..e95af6cf9 100644 --- a/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.html +++ b/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.html @@ -1,35 +1,45 @@ - - - - + @if (timelineState.timeStepButtons.length < 1) { + + } + @for ( + timeStepButton of timelineState.timeStepButtons; + track timeStepButton.value + ) { + + + + } diff --git a/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.spec.ts index dcea21f67..24c84ad18 100644 --- a/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/timeline/timeline.component.spec.ts @@ -13,23 +13,21 @@ describe('TimelineComponent', () => { let component: TimelineComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [TimelineComponent], - imports: [IonicModule, RouterTestingModule], - providers: [ - { provide: TimelineService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [TimelineComponent], + imports: [IonicModule, RouterTestingModule], + providers: [ + { provide: TimelineService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(TimelineComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(TimelineComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.html b/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.html index 6f1cdb13a..f7c7a1473 100644 --- a/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.html +++ b/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.html @@ -1,3 +1,5 @@ - - {{ displayDate }} - {{ displayTime }} - +@if (timestamp) { + + {{ displayDate }} - {{ displayTime }} + +} diff --git a/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.spec.ts index 39f575e10..f55ad0f36 100644 --- a/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/timestamp/timestamp.component.spec.ts @@ -6,18 +6,16 @@ describe('TimestampComponent', () => { let component: TimestampComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [TimestampComponent], - imports: [IonicModule], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [TimestampComponent], + imports: [IonicModule], + }).compileComponents(); - fixture = TestBed.createComponent(TimestampComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(TimestampComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.html b/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.html index cd6a154d7..4091c8085 100644 --- a/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.html +++ b/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.html @@ -20,7 +20,7 @@ : { placeCodeName: area?.name, alertLabel: area?.alertLabel, - disasterSpecificText: getDisasterSpecificText() + disasterSpecificText: getDisasterSpecificText(), } " > diff --git a/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.spec.ts index 76829ec93..3d0ca7fd9 100644 --- a/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/toggle-trigger-popover/toggle-trigger-popover.component.spec.ts @@ -7,18 +7,16 @@ describe('ToggleTriggerPopoverComponent', () => { let component: ToggleTriggerPopoverComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [ToggleTriggerPopoverComponent], - imports: [IonicModule.forRoot(), TranslateModule.forRoot()], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [ToggleTriggerPopoverComponent], + imports: [IonicModule.forRoot(), TranslateModule.forRoot()], + }).compileComponents(); - fixture = TestBed.createComponent(ToggleTriggerPopoverComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(ToggleTriggerPopoverComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.html b/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.html index dd349d879..d92cf4e5b 100644 --- a/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.html +++ b/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.html @@ -1,4 +1,4 @@ - +@if (value) { - +} diff --git a/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.spec.ts index 308605519..941772b5c 100644 --- a/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/tooltip/tooltip.component.spec.ts @@ -7,22 +7,17 @@ describe('TooltipComponent', () => { let component: TooltipComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [TooltipComponent], - providers: [ - { provide: PopoverController }, - { provide: AngularDelegate }, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [TooltipComponent], + providers: [{ provide: PopoverController }, { provide: AngularDelegate }], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + }).compileComponents(); - fixture = TestBed.createComponent(TooltipComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(TooltipComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.html b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.html index 0c7eb7477..776435ab8 100644 --- a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.html +++ b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.html @@ -8,22 +8,23 @@ > IBF PORTAL - - {{ showEnvironmentLabel(environmentConfiguration) }} - - {{ countryName }} - {{ disasterType?.disasterType }} {{ activeTriggerMsg }} - - + @if (isLoggedIn) { + + {{ countryName }} + {{ disasterType?.disasterType }} {{ activeTriggerMsg }} + + } @else { + + {{ showEnvironmentLabel(environmentConfiguration) }} + + } + @if (isLoggedIn && disasterType?.activeTrigger) { + + } @@ -32,7 +33,7 @@ - + @if (isLoggedIn) { {{ authService.displayName }} - + } - - Log Out - - + @if (isLoggedIn) { + + Log Out + + + } diff --git a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.spec.ts b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.spec.ts index ab30f5622..3934cd2ba 100644 --- a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.spec.ts @@ -13,22 +13,20 @@ describe('UserStateComponent', () => { let component: UserStateComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [UserStateComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [UserStateComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(UserStateComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(UserStateComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.ts b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.ts index 202a60327..656a79142 100644 --- a/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.ts +++ b/interfaces/IBF-dashboard/src/app/components/user-state/user-state.component.ts @@ -66,8 +66,8 @@ export class UserStateComponent implements OnInit { return environmentConfiguration === 'production' ? this.translateService.instant('login-page.environment-label.production') : environmentConfiguration === 'stage' - ? this.translateService.instant('login-page.environment-label.stage') - : environmentConfiguration; + ? this.translateService.instant('login-page.environment-label.stage') + : environmentConfiguration; } private onDisasterTypeChange = (disasterType: DisasterType) => { diff --git a/interfaces/IBF-dashboard/src/app/mocks/backend-mock-scenario-component/backend-mock-scenario.component.spec.ts b/interfaces/IBF-dashboard/src/app/mocks/backend-mock-scenario-component/backend-mock-scenario.component.spec.ts index 8b7da0a1d..563c52e43 100644 --- a/interfaces/IBF-dashboard/src/app/mocks/backend-mock-scenario-component/backend-mock-scenario.component.spec.ts +++ b/interfaces/IBF-dashboard/src/app/mocks/backend-mock-scenario-component/backend-mock-scenario.component.spec.ts @@ -13,22 +13,20 @@ describe('MockScenarioComponent', () => { let component: BackendMockScenarioComponent; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [BackendMockScenarioComponent], - imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [BackendMockScenarioComponent], + imports: [IonicModule, RouterTestingModule, TranslateModule.forRoot()], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(BackendMockScenarioComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(BackendMockScenarioComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/pages/dashboard/activation-log/activation.log.page.html b/interfaces/IBF-dashboard/src/app/pages/dashboard/activation-log/activation.log.page.html index f419681dd..d5675bd51 100644 --- a/interfaces/IBF-dashboard/src/app/pages/dashboard/activation-log/activation.log.page.html +++ b/interfaces/IBF-dashboard/src/app/pages/dashboard/activation-log/activation.log.page.html @@ -11,64 +11,64 @@ - -
- - -

- {{ 'activation-page.' + getEapKey() + '.page-title' | translate }} -

-

- {{ - 'activation-page.' + getEapKey() + '.page-explanation' | translate - }} -

-

- {{ - 'activation-page.' + getEapKey() + '.copy-instructions' - | translate - }} -

-
- - - - {{ 'activation-page.copy-to-clipboard' | translate }} - + @if (activationLogs) { + @if (activationLogs['headerData']) { +
+ + +

+ {{ 'activation-page.' + getEapKey() + '.page-title' | translate }} +

+

+ {{ + 'activation-page.' + getEapKey() + '.page-explanation' + | translate + }} +

+

+ {{ + 'activation-page.' + getEapKey() + '.copy-instructions' + | translate + }} +

+
+ + + + {{ 'activation-page.copy-to-clipboard' | translate }} + + + +
+ + @for (header of activationLogs['headerData']; track header) { + + {{ header }} + + } + +
+ } + @if (activationLogs['rowsData']) { +
+ @for (row of activationLogs['rowsData']; track row) { + + @for (data of row; track data) { + + {{ data }} + + } - - - - - {{ header }} - - -
-
- - - {{ data }} - - -
- + } +
+ } + }
diff --git a/interfaces/IBF-dashboard/src/app/pages/dashboard/dashboard.page.spec.ts b/interfaces/IBF-dashboard/src/app/pages/dashboard/dashboard.page.spec.ts index 4ef3bf9fe..760d770df 100644 --- a/interfaces/IBF-dashboard/src/app/pages/dashboard/dashboard.page.spec.ts +++ b/interfaces/IBF-dashboard/src/app/pages/dashboard/dashboard.page.spec.ts @@ -16,29 +16,27 @@ describe('DashboardPage', () => { let component: DashboardPage; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [DashboardPage], - schemas: [CUSTOM_ELEMENTS_SCHEMA], - imports: [ - IonicModule, - SharedModule, - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - { provide: MapService }, - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [DashboardPage], + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [ + IonicModule, + SharedModule, + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + { provide: MapService }, + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(DashboardPage); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(DashboardPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/pages/login/login.page.html b/interfaces/IBF-dashboard/src/app/pages/login/login.page.html index e359dbb6e..f2e10a00e 100644 --- a/interfaces/IBF-dashboard/src/app/pages/login/login.page.html +++ b/interfaces/IBF-dashboard/src/app/pages/login/login.page.html @@ -26,20 +26,18 @@ - - - - + @for (disasterType of allDisasterTypes; track disasterType) { + + + + + } { let component: LoginPage; let fixture: ComponentFixture; - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - declarations: [LoginPage], - imports: [ - IonicModule, - SharedModule, - RouterTestingModule, - TranslateModule.forRoot(), - ], - providers: [ - provideHttpClient(withInterceptorsFromDi()), - provideHttpClientTesting(), - ], - }).compileComponents(); + beforeEach(waitForAsync(() => { + TestBed.configureTestingModule({ + declarations: [LoginPage], + imports: [ + IonicModule, + SharedModule, + RouterTestingModule, + TranslateModule.forRoot(), + ], + providers: [ + provideHttpClient(withInterceptorsFromDi()), + provideHttpClientTesting(), + ], + }).compileComponents(); - fixture = TestBed.createComponent(LoginPage); - component = fixture.componentInstance; - fixture.detectChanges(); - }), - ); + fixture = TestBed.createComponent(LoginPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); it('should create', () => { expect(component).toBeTruthy(); diff --git a/interfaces/IBF-dashboard/src/app/services/admin-level.service.ts b/interfaces/IBF-dashboard/src/app/services/admin-level.service.ts index d848e9161..f0355111b 100644 --- a/interfaces/IBF-dashboard/src/app/services/admin-level.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/admin-level.service.ts @@ -102,10 +102,11 @@ export class AdminLevelService { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); this.activeLayerNames = []; }; diff --git a/interfaces/IBF-dashboard/src/app/services/aggregates.service.ts b/interfaces/IBF-dashboard/src/app/services/aggregates.service.ts index e57bafc9e..263be599c 100644 --- a/interfaces/IBF-dashboard/src/app/services/aggregates.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/aggregates.service.ts @@ -96,10 +96,11 @@ export class AggregatesService { if (!this.country) { return; } - this.defaultAdminLevel = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - )?.defaultAdminLevel; + this.defaultAdminLevel = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + )?.defaultAdminLevel; }; private onTimelineStateChange = (timelineState: TimelineState) => { @@ -155,31 +156,30 @@ export class AggregatesService { return this.indicatorSubject.asObservable(); } - private onEachIndicatorByFeatureAndAggregate = (feature, aggregate) => ( - indicator: Indicator, - ) => { - const foundIndicator = feature.records.find( - (a) => a.indicator === indicator.name, - ); + private onEachIndicatorByFeatureAndAggregate = + (feature, aggregate) => (indicator: Indicator) => { + const foundIndicator = feature.records.find( + (a) => a.indicator === indicator.name, + ); - const area = this.mapService.getAreaByPlaceCode( - feature.placeCode, - feature.placeCodeParent, - ); + const area = this.mapService.getAreaByPlaceCode( + feature.placeCode, + feature.placeCodeParent, + ); - if (foundIndicator) { - aggregate[indicator.name] = foundIndicator.value; - } + if (foundIndicator) { + aggregate[indicator.name] = foundIndicator.value; + } - aggregate[this.AREA_STATUS_KEY] = area?.stopped - ? AreaStatus.Stopped - : aggregate[IbfLayerName.alertThreshold] > 0 - ? AreaStatus.TriggeredOrWarned - : aggregate[this.disasterType.actionsUnit] > 0 && - this.eventState.events?.length > 0 - ? AreaStatus.TriggeredOrWarned - : AreaStatus.NonTriggeredOrWarnd; - }; + aggregate[this.AREA_STATUS_KEY] = area?.stopped + ? AreaStatus.Stopped + : aggregate[IbfLayerName.alertThreshold] > 0 + ? AreaStatus.TriggeredOrWarned + : aggregate[this.disasterType.actionsUnit] > 0 && + this.eventState.events?.length > 0 + ? AreaStatus.TriggeredOrWarned + : AreaStatus.NonTriggeredOrWarnd; + }; private onEachPlaceCode = (feature) => { const aggregate = { @@ -283,24 +283,26 @@ export class AggregatesService { return aggregateValue; } - private aggregateReducer = ( - weightedAverage: boolean, - indicator: IbfLayerName, - weighingIndicator: IbfLayerName, - placeCode: string, - ) => (accumulator, aggregate) => { - let indicatorValue = 0; - - if (placeCode === null || placeCode === aggregate.placeCode) { - const indicatorWeight = weightedAverage - ? aggregate[weighingIndicator] - : 1; - - indicatorValue = indicatorWeight * (aggregate[indicator] || 0); - } + private aggregateReducer = + ( + weightedAverage: boolean, + indicator: IbfLayerName, + weighingIndicator: IbfLayerName, + placeCode: string, + ) => + (accumulator, aggregate) => { + let indicatorValue = 0; + + if (placeCode === null || placeCode === aggregate.placeCode) { + const indicatorWeight = weightedAverage + ? aggregate[weighingIndicator] + : 1; + + indicatorValue = indicatorWeight * (aggregate[indicator] || 0); + } - return accumulator + indicatorValue; - }; + return accumulator + indicatorValue; + }; public isAggregateNan( indicator: IbfLayerName, diff --git a/interfaces/IBF-dashboard/src/app/services/api.service.ts b/interfaces/IBF-dashboard/src/app/services/api.service.ts index f0c119682..e7c236d47 100644 --- a/interfaces/IBF-dashboard/src/app/services/api.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/api.service.ts @@ -23,7 +23,10 @@ import { EventSummary } from './event.service'; export class ApiService { private log = DEBUG_LOG ? console.log : () => undefined; - constructor(private jwtService: JwtService, private http: HttpClient) {} + constructor( + private jwtService: JwtService, + private http: HttpClient, + ) {} private showSecurity(anonymous: boolean) { return anonymous ? '🌐' : '🔐'; diff --git a/interfaces/IBF-dashboard/src/app/services/eap-actions.service.ts b/interfaces/IBF-dashboard/src/app/services/eap-actions.service.ts index 32b89aab1..f0ad0bc6c 100644 --- a/interfaces/IBF-dashboard/src/app/services/eap-actions.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/eap-actions.service.ts @@ -75,10 +75,11 @@ export class EapActionsService { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private onTimelineStateChange = (timelineState: TimelineState) => { @@ -193,9 +194,8 @@ export class EapActionsService { triggeredArea.triggerValue === this.countryDisasterSettings.eapAlertClasses[alertClass].value ) { - triggeredArea.alertClass = this.countryDisasterSettings.eapAlertClasses[ - alertClass - ].label; + triggeredArea.alertClass = + this.countryDisasterSettings.eapAlertClasses[alertClass].label; } } } diff --git a/interfaces/IBF-dashboard/src/app/services/event.service.ts b/interfaces/IBF-dashboard/src/app/services/event.service.ts index 8f9939b1f..68644d969 100644 --- a/interfaces/IBF-dashboard/src/app/services/event.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/event.service.ts @@ -91,10 +91,11 @@ export class EventService { private onDisasterTypeChange = (disasterType: DisasterType) => { this.resetState(); this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); this.getEvents(); }; @@ -159,14 +160,13 @@ export class EventService { } } - private onGetDisasterTypeEvent = (disasterType: DisasterType, callback) => ( - events, - ) => { - disasterType.activeTrigger = - events.filter((e: EventSummary) => e.thresholdReached).length > 0 || - false; - callback(disasterType); - }; + private onGetDisasterTypeEvent = + (disasterType: DisasterType, callback) => (events) => { + disasterType.activeTrigger = + events.filter((e: EventSummary) => e.thresholdReached).length > 0 || + false; + callback(disasterType); + }; private onEvents = (events) => { this.apiService @@ -333,10 +333,10 @@ export class EventService { timeUnit === LeadTimeUnit.month ? this.today.plus({ months: Number(timeUnitsInFuture) }) : timeUnit === LeadTimeUnit.day - ? this.today.plus({ days: Number(timeUnitsInFuture) }) - : timeUnit === LeadTimeUnit.hour - ? this.today.plus({ hours: Number(timeUnitsInFuture) }) - : null; + ? this.today.plus({ days: Number(timeUnitsInFuture) }) + : timeUnit === LeadTimeUnit.hour + ? this.today.plus({ hours: Number(timeUnitsInFuture) }) + : null; const monthString = new Date( futureDateTime.year, futureDateTime.month - 1, diff --git a/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts b/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts index c73db370f..2356a45cc 100644 --- a/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/map-legend.service.ts @@ -246,24 +246,22 @@ export class MapLegendService { : 7 + (gradientLength - 4) * 14; } - private getFeatureColorByColorsAndColorThresholds = ( - colors, - colorThreshold, - ) => (feature) => { - return feature <= colorThreshold[breakKey.break1] || - !colorThreshold[breakKey.break1] - ? colors[0] - : feature <= colorThreshold[breakKey.break2] || - !colorThreshold[breakKey.break2] - ? colors[1] - : feature <= colorThreshold[breakKey.break3] || - !colorThreshold[breakKey.break3] - ? colors[2] - : feature <= colorThreshold[breakKey.break4] || - !colorThreshold[breakKey.break4] - ? colors[3] - : colors[4]; - }; + private getFeatureColorByColorsAndColorThresholds = + (colors, colorThreshold) => (feature) => { + return feature <= colorThreshold[breakKey.break1] || + !colorThreshold[breakKey.break1] + ? colors[0] + : feature <= colorThreshold[breakKey.break2] || + !colorThreshold[breakKey.break2] + ? colors[1] + : feature <= colorThreshold[breakKey.break3] || + !colorThreshold[breakKey.break3] + ? colors[2] + : feature <= colorThreshold[breakKey.break4] || + !colorThreshold[breakKey.break4] + ? colors[3] + : colors[4]; + }; private getLabel = (grades, layer, labels) => (i) => { const label = labels ? ' - ' + labels[i] : ''; @@ -377,8 +375,8 @@ export class MapLegendService { private layerTitle(label: string, unit?: string): string { return ` ${label}${ - unit ? ' (' + unit + ')' : '' - } + unit ? ' (' + unit + ')' : '' + } `; } } diff --git a/interfaces/IBF-dashboard/src/app/services/map-view.service.ts b/interfaces/IBF-dashboard/src/app/services/map-view.service.ts index bc9fac906..d22d71d5c 100644 --- a/interfaces/IBF-dashboard/src/app/services/map-view.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/map-view.service.ts @@ -59,10 +59,11 @@ export class MapViewService { private onDisasterTypeChange = (disasterType: DisasterType) => { this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private setAggregatesMapView(view: MapView) { diff --git a/interfaces/IBF-dashboard/src/app/services/map.service.ts b/interfaces/IBF-dashboard/src/app/services/map.service.ts index 40bb88c13..1ff631e29 100644 --- a/interfaces/IBF-dashboard/src/app/services/map.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/map.service.ts @@ -407,9 +407,9 @@ export class MapService { return indicatorOrLayer.active === LayerActivation.yes ? true : indicatorOrLayer.active === LayerActivation.ifTrigger && - this.eventState?.events?.length > 0 - ? true - : false; + this.eventState?.events?.length > 0 + ? true + : false; } private addAggregateLayer( @@ -691,8 +691,8 @@ export class MapService { return adminLevelType === AdminLevelType.single ? null // on single admin: don't pass any parentPlaceCode filtering : adminLevelType === AdminLevelType.deepest - ? placeCode?.placeCodeParent.placeCode // on deepest admin: pass parentPlaceCode - : placeCode?.placeCode; // on higher levels: pass current placeCode (TODO: why this last difference?) + ? placeCode?.placeCodeParent.placeCode // on deepest admin: pass parentPlaceCode + : placeCode?.placeCode; // on higher levels: pass current placeCode (TODO: why this last difference?) } getCombineAdminRegionData( @@ -821,8 +821,8 @@ export class MapService { return stopped ? this.stoppedTriggerColor : colorPropertyValue >= 1 - ? this.triggeredAreaColor - : this.nonTriggeredAreaColor; + ? this.triggeredAreaColor + : this.nonTriggeredAreaColor; } getAdminRegionFillOpacity = (layer: IbfLayer, placeCode: string): number => { @@ -848,10 +848,10 @@ export class MapService { layer.name === IbfLayerName.adminRegions ? this.state.defaultWeight : layer.group === IbfLayerGroup.adminRegions - ? this.adminLevelLowerThanDefault(layer.name) - ? 3 - : 0.33 - : this.state.defaultWeight; + ? this.adminLevelLowerThanDefault(layer.name) + ? 3 + : 0.33 + : this.state.defaultWeight; if (this.placeCode) { const areaState = this.triggeredAreas.find( @@ -948,8 +948,8 @@ export class MapService { typeof adminRegion.properties[colorProperty] !== 'undefined' ? adminRegion.properties[colorProperty] : typeof adminRegion.properties.indicators !== 'undefined' - ? adminRegion.properties.indicators[colorProperty] - : 'undefined'; + ? adminRegion.properties.indicators[colorProperty] + : 'undefined'; if (colorPropertyValue !== 'undefined') { const fillColor = this.getAdminRegionFillColor( colorPropertyValue, diff --git a/interfaces/IBF-dashboard/src/app/services/place-code.service.ts b/interfaces/IBF-dashboard/src/app/services/place-code.service.ts index 0966419ad..9e05fc349 100644 --- a/interfaces/IBF-dashboard/src/app/services/place-code.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/place-code.service.ts @@ -20,14 +20,15 @@ export class PlaceCodeService { this.placeCodeSubject.next(newPlaceCode); }; - private onPlaceCodeChangeByPlaceCode = (newPlaceCode: PlaceCode) => ( - oldPlaceCode: PlaceCode, - ) => { - if (oldPlaceCode && newPlaceCode) { - newPlaceCode = - oldPlaceCode.placeCode === newPlaceCode.placeCode ? null : newPlaceCode; - } - }; + private onPlaceCodeChangeByPlaceCode = + (newPlaceCode: PlaceCode) => (oldPlaceCode: PlaceCode) => { + if (oldPlaceCode && newPlaceCode) { + newPlaceCode = + oldPlaceCode.placeCode === newPlaceCode.placeCode + ? null + : newPlaceCode; + } + }; clearPlaceCode = (): void => { this.placeCodeSubject.next(null); @@ -44,14 +45,15 @@ export class PlaceCodeService { this.placeCodeHoverSubject.next(newPlaceCode); }; - private onPlaceCodeHoverChangeByPlaceCode = (newPlaceCode: PlaceCode) => ( - oldPlaceCode: PlaceCode, - ) => { - if (oldPlaceCode && newPlaceCode) { - newPlaceCode = - oldPlaceCode.placeCode === newPlaceCode.placeCode ? null : newPlaceCode; - } - }; + private onPlaceCodeHoverChangeByPlaceCode = + (newPlaceCode: PlaceCode) => (oldPlaceCode: PlaceCode) => { + if (oldPlaceCode && newPlaceCode) { + newPlaceCode = + oldPlaceCode.placeCode === newPlaceCode.placeCode + ? null + : newPlaceCode; + } + }; clearPlaceCodeHover = (): void => { this.placeCodeHoverSubject.next(null); diff --git a/interfaces/IBF-dashboard/src/app/services/timeline.service.ts b/interfaces/IBF-dashboard/src/app/services/timeline.service.ts index 6ba3f62dc..d8fa86674 100644 --- a/interfaces/IBF-dashboard/src/app/services/timeline.service.ts +++ b/interfaces/IBF-dashboard/src/app/services/timeline.service.ts @@ -73,10 +73,11 @@ export class TimelineService { private onDisasterTypeChange = (disasterType: DisasterType) => { this.resetState(); this.disasterType = disasterType; - this.countryDisasterSettings = this.disasterTypeService.getCountryDisasterTypeSettings( - this.country, - this.disasterType, - ); + this.countryDisasterSettings = + this.disasterTypeService.getCountryDisasterTypeSettings( + this.country, + this.disasterType, + ); }; private resetState() { @@ -186,8 +187,10 @@ export class TimelineService { ? ((this.eventState.event.firstTriggerLeadTime || this.eventState.event.firstLeadTime) as LeadTime) : this.eventState.events?.length > 0 - ? null - : this.getFallbackNoTriggerLeadTime(this.disasterType.disasterType), + ? null + : this.getFallbackNoTriggerLeadTime( + this.disasterType.disasterType, + ), null, ); } @@ -255,11 +258,11 @@ export class TimelineService { noEvent ? btn.value === timeStepButtonValue : eventName && - !this.hasDisabledTimeline(this.disasterType.disasterType) - ? btn.value === timeStepButtonValue && - !btn.disabled && - btn.eventName === eventName // if interactive timeline: also match on eventName (if available) - : btn.value === timeStepButtonValue, // if non-interactive timeline: only match on leadTime & also highlight disabled buttons + !this.hasDisabledTimeline(this.disasterType.disasterType) + ? btn.value === timeStepButtonValue && + !btn.disabled && + btn.eventName === eventName // if interactive timeline: also match on eventName (if available) + : btn.value === timeStepButtonValue, // if non-interactive timeline: only match on leadTime & also highlight disabled buttons ); if (btnToActivate) { btnToActivate.active = true; @@ -415,8 +418,8 @@ export class TimelineService { } private checkRegionalDroughtSeason() { - const forecastSeasonAreas = this.countryDisasterSettings - .droughtForecastSeasons; + const forecastSeasonAreas = + this.countryDisasterSettings.droughtForecastSeasons; return Object.values(forecastSeasonAreas).length > 1; } @@ -459,9 +462,10 @@ export class TimelineService { .includes(this.getDateFromLeadTime(leadTime)) ); } else if (disasterType.disasterType === DisasterTypeKey.heavyRain) { - const countryLeadTimes = this.countryDisasterSettings.activeLeadTimes.sort( - (a, b) => (a > b ? 1 : -1), - ); + const countryLeadTimes = + this.countryDisasterSettings.activeLeadTimes.sort((a, b) => + a > b ? 1 : -1, + ); const maxLeadTime = countryLeadTimes[countryLeadTimes.length - 1]; return leadTime > maxLeadTime ? false : true; } else if (disasterType.disasterType === DisasterTypeKey.flashFloods) { diff --git a/interfaces/IBF-dashboard/src/global.scss b/interfaces/IBF-dashboard/src/global.scss index 3446e8ae0..e32a5bbe1 100644 --- a/interfaces/IBF-dashboard/src/global.scss +++ b/interfaces/IBF-dashboard/src/global.scss @@ -63,7 +63,10 @@ .info { padding: 6px 8px; - font: 0.75rem Arial, Helvetica, sans-serif; + font: + 0.75rem Arial, + Helvetica, + sans-serif; background: white; box-shadow: 0 0 0.9375rem rgba(0, 0, 0, 0.2); border-radius: 0.3125rem; @@ -270,7 +273,9 @@ // https://stackoverflow.com/a/68240841/1753041 input:-webkit-autofill, input:-webkit-autofill:focus { - transition: background-color 600000s 0s, color 600000s 0s; + transition: + background-color 600000s 0s, + color 600000s 0s; } [popover].popover-viewport { diff --git a/interfaces/IBF-dashboard/src/index.html b/interfaces/IBF-dashboard/src/index.html index 599196704..ace66741d 100644 --- a/interfaces/IBF-dashboard/src/index.html +++ b/interfaces/IBF-dashboard/src/index.html @@ -1,4 +1,4 @@ - +