Skip to content

Commit

Permalink
chore: automatic fixes IBF-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Dec 16, 2024
1 parent b396aca commit 7140beb
Show file tree
Hide file tree
Showing 85 changed files with 500 additions and 493 deletions.
32 changes: 16 additions & 16 deletions interfaces/IBF-dashboard/src/app/analytics/analytics.enum.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
export enum AnalyticsPage {

Check warning on line 1 in interfaces/IBF-dashboard/src/app/analytics/analytics.enum.ts

View workflow job for this annotation

GitHub Actions / ibf-dashboard

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly
login = 'login',
dashboard = 'dashboard',
activationLog = 'activation-Log',
dashboard = 'dashboard',
login = 'login',
}

export enum AnalyticsEvent {
watchIbfGuide = 'watch-ibf-guide',
aboutTrigger = 'about-trigger',
aggregateInformation = 'aggregate-information',
adminLevel = 'admin-level',
mapLayer = 'map-layer',
mapLayerInformation = 'map-layer-information',
exportView = 'export-view',
logOut = 'log-out',
aggregateInformation = 'aggregate-information',
communityNotification = 'community-notification',
damSite = 'dam',
eapAction = 'eap-action',
eapSubmit = 'eap-submit',
waterPoint = 'water-point',
redCrossBranch = 'red-cross-branch',
evacuationCenter = 'evacuation-center',
exportView = 'export-view',
glofasStation = 'glofas-station',
healthSite = 'health-site',
damSite = 'dam',
leadTime = 'lead-time',
logOut = 'log-out',
mapLayer = 'map-layer',
mapLayerInformation = 'map-layer-information',
mapMarker = 'map-marker',
glofasStation = 'glofas-station',
typhoonTrack = 'typhoon-track',
mapPlaceSelect = 'map-place-select',
leadTime = 'lead-time',
redCrossBranch = 'red-cross-branch',
stopTrigger = 'stop-trigger',
evacuationCenter = 'evacuation-center',
communityNotification = 'community-notification',
typhoonTrack = 'typhoon-track',
watchIbfGuide = 'watch-ibf-guide',
waterPoint = 'water-point',
}
10 changes: 5 additions & 5 deletions interfaces/IBF-dashboard/src/app/analytics/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
ITelemetryItem,
} from '@microsoft/applicationinsights-web';
import { SeverityLevel } from 'src/app/analytics/severity-level.model';
import { DEBUG_LOG } from 'src/app/config';
import { Country } from 'src/app/models/country.model';
import { CountryService } from 'src/app/services/country.service';
import { environment } from 'src/environments/environment';
import { DEBUG_LOG } from '../config';
import { Country } from '../models/country.model';
import { CountryService } from '../services/country.service';

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -72,7 +72,7 @@ export class AnalyticsService {

logEvent(
name: string,
properties?: { [key: string]: string | number | boolean },
properties?: Record<string, boolean | number | string>,
): void {
if (this.isApplicationInsightsEnabled) {
this.applicationInsights.trackEvent({ name }, properties);
Expand All @@ -94,7 +94,7 @@ export class AnalyticsService {

logTrace(
message: string,
properties?: { [key: string]: string | number | boolean },
properties?: Record<string, boolean | number | string>,
) {
if (this.isApplicationInsightsEnabled) {
this.applicationInsights.trackTrace({ message }, properties);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable perfectionist/sort-enums */

Check warning on line 1 in interfaces/IBF-dashboard/src/app/analytics/severity-level.model.ts

View workflow job for this annotation

GitHub Actions / ibf-dashboard

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly
// Application Insights Severity Level
export enum SeverityLevel {
Verbose = 0,
Expand Down
2 changes: 1 addition & 1 deletion interfaces/IBF-dashboard/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NgModule } from '@angular/core';

Check warning on line 1 in interfaces/IBF-dashboard/src/app/app-routing.module.ts

View workflow job for this annotation

GitHub Actions / ibf-dashboard

This rule requires the `strictNullChecks` compiler option to be turned on to function correctly
import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
import { AuthGuard } from './auth/auth.guard';
import { AuthGuard } from 'src/app/auth/auth.guard';

const routes: Routes = [
{
Expand Down
2 changes: 1 addition & 1 deletion interfaces/IBF-dashboard/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { Platform } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { AppComponent } from './app.component';
import { AppComponent } from 'src/app/app.component';

describe('AppComponent', () => {
let platformReadySpy;
Expand Down
8 changes: 4 additions & 4 deletions interfaces/IBF-dashboard/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
HttpClient,
HTTP_INTERCEPTORS,
HttpClient,
provideHttpClient,
withInterceptorsFromDi,
} from '@angular/common/http';
Expand All @@ -11,11 +11,11 @@ import { ServiceWorkerModule } from '@angular/service-worker';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AppComponent } from 'src/app/app.component';
import { AppRoutingModule } from 'src/app/app-routing.module';
import { AuthInterceptorService } from 'src/app/services/auth.interceptor.service';
import { LoaderInterceptorService } from 'src/app/services/loader.interceptor.service';
import { environment } from 'src/environments/environment';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { AuthInterceptorService } from './services/auth.interceptor.service';

export function createTranslateLoader(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
Expand Down
4 changes: 2 additions & 2 deletions interfaces/IBF-dashboard/src/app/auth/auth.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UrlTree,
} from '@angular/router';
import { Observable } from 'rxjs';
import { AuthService } from './auth.service';
import { AuthService } from 'src/app/auth/auth.service';

@Injectable({
providedIn: 'root',
Expand All @@ -21,9 +21,9 @@ export class AuthGuard {
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot,
):
| boolean
| Observable<boolean | UrlTree>
| Promise<boolean | UrlTree>
| boolean
| UrlTree {
const url: string = state.url;

Expand Down
4 changes: 2 additions & 2 deletions interfaces/IBF-dashboard/src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { Router } from '@angular/router';
import { ToastController } from '@ionic/angular';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
import { User } from 'src/app/models/user/user.model';
import { UserRole } from 'src/app/models/user/user-role.enum';
import { ApiService } from 'src/app/services/api.service';
import { JwtService } from 'src/app/services/jwt.service';
import { UserRole } from '../models/user/user-role.enum';

const HTTP_STATUS_MESSAGE_MAP = {
401: 'Email and/or password unknown',
Expand Down Expand Up @@ -95,7 +95,7 @@ export class AuthService implements OnDestroy {
}

private onLoginResponse = (response) => {
if (!response.user || !response.user.token) {
if (!response.user?.token) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
DisasterType,
} from 'src/app/models/country.model';
import { CountryService } from 'src/app/services/country.service';
import { DisasterTypeService } from 'src/app/services/disaster-type.service';
import { EventService } from 'src/app/services/event.service';
import { DisasterTypeService } from '../../services/disaster-type.service';

@Component({
selector: 'app-about-btn',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';
import { TranslateModule } from '@ngx-translate/core';
import { ActionResultPopoverComponent } from './action-result-popover.component';
import { ActionResultPopoverComponent } from 'src/app/components/action-result-popover/action-result-popover.component';

describe('ActionResultPopoverComponent', () => {
let component: ActionResultPopoverComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Component, OnDestroy } from '@angular/core';
import { Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { Country, DisasterType } from '../../models/country.model';
import { CountryService } from '../../services/country.service';
import { DisasterTypeService } from '../../services/disaster-type.service';
import { Country, DisasterType } from 'src/app/models/country.model';
import { CountryService } from 'src/app/services/country.service';
import { DisasterTypeService } from 'src/app/services/disaster-type.service';

@Component({
selector: 'app-activation-log-button',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ import {
AnalyticsPage,
} from 'src/app/analytics/analytics.enum';
import { AnalyticsService } from 'src/app/analytics/analytics.service';
import {
Country,
CountryDisasterSettings,
DisasterType,
} from 'src/app/models/country.model';
import { PlaceCode } from 'src/app/models/place-code.model';
import {
AdminLevelButton,
AdminLevelService,
} from 'src/app/services/admin-level.service';
import { CountryService } from 'src/app/services/country.service';
import { DisasterTypeService } from 'src/app/services/disaster-type.service';
import { EventService } from 'src/app/services/event.service';
import { MapService } from 'src/app/services/map.service';
import { MapViewService } from 'src/app/services/map-view.service';
import { PlaceCodeService } from 'src/app/services/place-code.service';
import { AdminLevel, AdminLevelType } from 'src/app/types/admin-level';
import { DisasterTypeKey } from 'src/app/types/disaster-type-key';
import { EventState } from 'src/app/types/event-state';
import { IbfLayer, IbfLayerGroup, IbfLayerName } from 'src/app/types/ibf-layer';
import {
Country,
CountryDisasterSettings,
DisasterType,
} from '../../models/country.model';
import { PlaceCode } from '../../models/place-code.model';
import { CountryService } from '../../services/country.service';
import { DisasterTypeService } from '../../services/disaster-type.service';
import { MapViewService } from '../../services/map-view.service';
import { PlaceCodeService } from '../../services/place-code.service';
import { DisasterTypeKey } from '../../types/disaster-type-key';
import { EventState } from '../../types/event-state';
import { MapView } from '../../types/map-view';
import { MapView } from 'src/app/types/map-view';

@Component({
selector: 'app-admin-level',
Expand Down Expand Up @@ -184,9 +184,7 @@ export class AdminLevelComponent implements OnInit, OnDestroy {
}

public useBreadcrumbs(disasterType: DisasterType): boolean {
return this.breadcrumbDisasters.includes(
disasterType?.disasterType as DisasterTypeKey,
);
return this.breadcrumbDisasters.includes(disasterType?.disasterType);
}

public clickBreadcrumbButton(breadCrumb: MapView, selected: boolean) {
Expand Down Expand Up @@ -247,19 +245,19 @@ export class AdminLevelComponent implements OnInit, OnDestroy {
public showBreadcrumb(breadCrumb: MapView): boolean {
if (breadCrumb === MapView.national) {
return [
MapView.national,
MapView.event,
MapView.adminArea,
MapView.adminArea2,
MapView.adminArea3,
MapView.event,
MapView.national,
].includes(this.currentMapView);
} else if (breadCrumb === MapView.event) {
return (
[
MapView.event,
MapView.adminArea,
MapView.adminArea2,
MapView.adminArea3,
MapView.event,
].includes(this.currentMapView) &&
this.countryDisasterSettings?.isEventBased
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import { ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { Subscription } from 'rxjs';
import {
AnalyticsEvent,
AnalyticsPage,
} from 'src/app/analytics/analytics.enum';
import { AnalyticsService } from 'src/app/analytics/analytics.service';
import { LayerControlInfoPopoverComponent } from 'src/app/components/layer-control-info-popover/layer-control-info-popover.component';
import {
Country,
CountryDisasterSettings,
DisasterType,
} from 'src/app/models/country.model';
import { PlaceCode } from 'src/app/models/place-code.model';
import { ApiService } from 'src/app/services/api.service';
import { CountryService } from 'src/app/services/country.service';
import { DisasterTypeService } from 'src/app/services/disaster-type.service';
import { EapActionsService } from 'src/app/services/eap-actions.service';
import { EventService } from 'src/app/services/event.service';
import { PlaceCodeService } from 'src/app/services/place-code.service';
import { AreaOfFocus } from 'src/app/types/area-of-focus';
import { EventState } from 'src/app/types/event-state';
import { AnalyticsEvent, AnalyticsPage } from '../../analytics/analytics.enum';
import { AnalyticsService } from '../../analytics/analytics.service';
import {
Country,
CountryDisasterSettings,
DisasterType,
} from '../../models/country.model';
import { CountryService } from '../../services/country.service';
import { DisasterTypeService } from '../../services/disaster-type.service';
import { AreaOfFocus } from '../../types/area-of-focus';
import { TriggeredArea } from '../../types/triggered-area';
import { LayerControlInfoPopoverComponent } from '../layer-control-info-popover/layer-control-info-popover.component';
import { TriggeredArea } from 'src/app/types/triggered-area';

@Component({
selector: 'app-areas-of-focus-summary',
Expand Down
24 changes: 13 additions & 11 deletions interfaces/IBF-dashboard/src/app/components/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ import {
} from 'src/app/analytics/analytics.enum';
import { AnalyticsService } from 'src/app/analytics/analytics.service';
import { AuthService } from 'src/app/auth/auth.service';
import { ActionResultPopoverComponent } from 'src/app/components/action-result-popover/action-result-popover.component';
import { ToggleTriggerPopoverComponent } from 'src/app/components/toggle-trigger-popover/toggle-trigger-popover.component';
import {
Country,
CountryDisasterSettings,
DisasterType,
} from 'src/app/models/country.model';
import { PlaceCode } from 'src/app/models/place-code.model';
import { AdminLevelService } from 'src/app/services/admin-level.service';
import { AggregatesService } from 'src/app/services/aggregates.service';
import { ApiService } from 'src/app/services/api.service';
import { CountryService } from 'src/app/services/country.service';
import { DisasterTypeService } from 'src/app/services/disaster-type.service';
import { EapActionsService } from 'src/app/services/eap-actions.service';
import { EventService, EventSummary } from 'src/app/services/event.service';
import { PlaceCodeService } from 'src/app/services/place-code.service';
import { TimelineService } from 'src/app/services/timeline.service';
import { AdminLevel, AdminLevelType } from 'src/app/types/admin-level';
import { EapAction } from 'src/app/types/eap-action';
import { EventState } from 'src/app/types/event-state';
import { Indicator, NumberFormat } from 'src/app/types/indicator-group';
import { LeadTimeTriggerKey } from 'src/app/types/lead-time';
import { TimelineState } from 'src/app/types/timeline-state';
import { environment } from '../../../environments/environment';
import { AdminLevelService } from '../../services/admin-level.service';
import { AggregatesService } from '../../services/aggregates.service';
import { TimelineService } from '../../services/timeline.service';
import { AdminLevel, AdminLevelType } from '../../types/admin-level';
import { Indicator, NumberFormat } from '../../types/indicator-group';
import { LeadTimeTriggerKey } from '../../types/lead-time';
import { TriggeredArea } from '../../types/triggered-area';
import { ActionResultPopoverComponent } from '../action-result-popover/action-result-popover.component';
import { ToggleTriggerPopoverComponent } from '../toggle-trigger-popover/toggle-trigger-popover.component';
import { TriggeredArea } from 'src/app/types/triggered-area';
import { environment } from 'src/environments/environment';

@Component({
selector: 'app-chat',
Expand Down Expand Up @@ -435,7 +435,9 @@ export class ChatComponent implements OnInit, OnDestroy {
placeCode,
});
this.apiService.toggleTrigger(eventPlaceCodeId).subscribe({
next: () => this.reloadEapAndTrigger(),
next: () => {
this.reloadEapAndTrigger();
},
error: () =>
this.actionResult(
this.translateService.instant(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Component, Input, OnInit } from '@angular/core';
import { AlertController, PopoverController } from '@ionic/angular';
import { TranslateService } from '@ngx-translate/core';
import { DateTime } from 'luxon';
import { CommunityNotification } from '../../models/poi.model';
import { ApiService } from '../../services/api.service';
import { EventService } from '../../services/event.service';
import { ActionResultPopoverComponent } from '../action-result-popover/action-result-popover.component';
import { CommunityNotificationPhotoPopupComponent } from '../community-notification-photo-popup/community-notification-photo-popup.component';
import { ActionResultPopoverComponent } from 'src/app/components/action-result-popover/action-result-popover.component';
import { CommunityNotificationPhotoPopupComponent } from 'src/app/components/community-notification-photo-popup/community-notification-photo-popup.component';
import { CommunityNotification } from 'src/app/models/poi.model';
import { ApiService } from 'src/app/services/api.service';
import { EventService } from 'src/app/services/event.service';

@Component({
selector: 'app-community-notification-popup',
Expand Down
Loading

0 comments on commit 7140beb

Please sign in to comment.