Skip to content

Commit

Permalink
remove legacy dialog usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablo Lopez committed Aug 20, 2024
1 parent ef15582 commit fa767fa
Show file tree
Hide file tree
Showing 43 changed files with 79 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatLegacyButtonHarness as MatButtonHarness } from '@angular/material/legacy-button/testing';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialog as MatDialog,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs';
import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { AuthService } from '@services';

import { DeleteAccountDialogComponent } from './delete-account-dialog.component';
import {
MAT_DIALOG_DATA,
MatDialog,
MatDialogRef,
} from '@angular/material/dialog';

describe('DeleteAccountDialogComponent', () => {
let component: DeleteAccountDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Component, Inject } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { AuthService } from '@services';
import { User } from '@types';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-delete-account-dialog',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';

import { DeleteAccountComponent } from './delete-account.component';
import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';

import { MockProvider } from 'ng-mocks';
import { AuthService } from '@services';
import { Router } from '@angular/router';
import { MatDialogModule } from '@angular/material/dialog';

describe('DeleteAccountComponent', () => {
let component: DeleteAccountComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Component } from '@angular/core';
import { AuthService } from '@services';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
import { Router } from '@angular/router';
import { DeleteAccountDialogComponent } from '../delete-account-dialog/delete-account-dialog.component';
import { MatDialog } from '@angular/material/dialog';

@Component({
selector: 'app-delete-account',
Expand Down
2 changes: 1 addition & 1 deletion src/interface/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { FeaturesModule } from './features/features.module';
import { HomeComponent } from './home/home.component';
import { JwtInterceptor, WINDOW_PROVIDERS } from '@services';
import { MapModule } from './map/map.module';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';

import { LegacyMaterialModule } from './material/legacy-material.module';

Expand All @@ -37,6 +36,7 @@ import { environment } from 'src/environments/environment';
import { DeleteDialogComponent } from './standalone/delete-dialog/delete-dialog.component';
import { LegacyPlanningAreasComponent } from './home/legacy-planning-areas/legacy-planning-areas.component';
import { PlanningAreasComponent } from './standalone/planning-areas/planning-areas.component';
import { MatDialogModule } from '@angular/material/dialog';

@NgModule({
declarations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import { DeleteDialogComponent } from '../../standalone/delete-dialog/delete-dia
import { FeaturesModule } from '../../features/features.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MOCK_PLAN } from '@services/mocks';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';

import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { MockComponent } from 'ng-mocks';
import { Plan } from '@types';
import { PlanTableComponent } from './plan-table.component';
import { Router } from '@angular/router';
import { SectionLoaderComponent } from '@shared';
import { MatDialog } from '@angular/material/dialog';

describe('PlanTableComponent', () => {
const fakePlan1: Plan = MOCK_PLAN;
Expand Down
6 changes: 2 additions & 4 deletions src/interface/src/app/home/plan-table/plan-table.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import {
MatLegacyDialog as MatDialog,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { MatSort } from '@angular/material/sort';
import { MatLegacyTableDataSource as MatTableDataSource } from '@angular/material/legacy-table';
Expand All @@ -19,6 +16,7 @@ import {
} from '../../plan/permissions';
import { Plan, PreviewPlan } from '@types';
import { DeleteDialogComponent } from '../../standalone/delete-dialog/delete-dialog.component';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-plan-table',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ import { SharePlanDialogComponent } from './share-plan-dialog.component';
import { MatLegacySnackBarModule as MatSnackBarModule } from '@angular/material/legacy-snack-bar';
import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { MockComponents, MockProvider } from 'ng-mocks';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { AuthService, InvitesService, PlanStateService } from '@services';
import { BehaviorSubject, NEVER, of } from 'rxjs';
import { User } from '@types';
import { ChipInputComponent } from '../chip-input/chip-input.component';
import { SectionLoaderComponent } from '@shared';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

describe('SharePlanDialogComponent', () => {
let component: SharePlanDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Component, Inject } from '@angular/core';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { FormMessageType, Invite, INVITE_ROLE, User } from '@types';
import { SNACK_BOTTOM_NOTICE_CONFIG } from '@shared';
import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { AuthService, InvitesService, PlanStateService } from '@services';
import { filter, map, shareReplay, switchMap, tap } from 'rxjs';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

const Roles: Record<INVITE_ROLE, INVITE_ROLE> = {
Viewer: 'Viewer',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { InvalidLinkDialogComponent } from './invalid-link-dialog.component';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { MatDialogRef } from '@angular/material/dialog';

describe('InvalidLinkDialogComponent', () => {
let component: InvalidLinkDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-invalid-link-dialog',
Expand Down
6 changes: 2 additions & 4 deletions src/interface/src/app/map/map.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import {
} from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { MatLegacyButtonHarness as MatButtonHarness } from '@angular/material/legacy-button/testing';
import {
MatLegacyDialog as MatDialog,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ActivatedRoute, Router } from '@angular/router';
import { featureCollection, point } from '@turf/helpers';
Expand Down Expand Up @@ -57,6 +54,7 @@ import {
import * as esri from 'esri-leaflet';
import { MockProvider } from 'ng-mocks';
import { MOCK_FEATURE_COLLECTION, MOCK_PLAN } from '@services/mocks';
import { MatDialog, MatDialogRef } from '@angular/material/dialog';

describe('MapComponent', () => {
let component: MapComponent;
Expand Down
3 changes: 2 additions & 1 deletion src/interface/src/app/map/map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
OnInit,
} from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';

import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { ActivatedRoute, Router } from '@angular/router';
import { Feature, FeatureCollection, Geometry } from 'geojson';
Expand Down Expand Up @@ -78,6 +78,7 @@ import { getPlanPath } from '../plan/plan-helpers';
import { InvalidLinkDialogComponent } from './invalid-link-dialog/invalid-link-dialog.component';
import { Location } from '@angular/common';
import { HomeParametersStorageService } from '@services/local-storage.service';
import { MatDialog } from '@angular/material/dialog';

@UntilDestroy()
@Component({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
display: block;
padding: 20px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { LegacyMaterialModule } from '../../material/legacy-material.module';
import { DialogModule } from '@angular/cdk/dialog';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { MatDialogRef } from '@angular/material/dialog';

describe('OutsideRegionDialogComponent', () => {
let component: OutsideRegionDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-outside-region-dialog',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import {
TestBed,
tick,
} from '@angular/core/testing';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';

import {
PlanCreateDialogComponent,
Expand All @@ -23,6 +19,7 @@ import { DialogModule } from '@angular/cdk/dialog';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Region, regionToString } from '@types';
import { Geometry } from 'geojson';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

describe('PlanCreateDialogComponent', () => {
let component: PlanCreateDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';
import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Component, Inject } from '@angular/core';
import { PlanService, SessionService } from '@services';
Expand All @@ -11,6 +7,7 @@ import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack
import { Region, regionToString } from '@types';
import { isValidTotalArea } from '../../plan/plan-helpers';
import { Geometry } from 'geojson';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

export interface PlanCreateDialogData {
shape: Geometry;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';

import { SignInDialogComponent } from './sign-in-dialog.component';
import { MatDialogRef } from '@angular/material/dialog';

describe('SignInCardComponent', () => {
let component: SignInDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-sign-in-dialog',
Expand Down
3 changes: 2 additions & 1 deletion src/interface/src/app/material/legacy-material.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/lega
import { MatLegacyCardModule as MatCardModule } from '@angular/material/legacy-card';
import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
import { MatLegacyChipsModule as MatChipsModule } from '@angular/material/legacy-chips';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';

import { MatDividerModule } from '@angular/material/divider';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field';
Expand All @@ -27,6 +27,7 @@ import { MatLegacyTabsModule as MatTabsModule } from '@angular/material/legacy-t
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatLegacyTooltipModule as MatTooltipModule } from '@angular/material/legacy-tooltip';
import { MatTreeModule } from '@angular/material/tree';
import { MatDialogModule } from '@angular/material/dialog';

@NgModule({
exports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuthService, PlanNotesService } from '@services';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';

import { MatLegacySnackBarModule as MatSnackBarModule } from '@angular/material/legacy-snack-bar';

import { AreaNotesComponent } from './area-notes.component';
import { MockProvider } from 'ng-mocks';
import { of } from 'rxjs';
import { MatDialogModule } from '@angular/material/dialog';

describe('AreaNotesComponent', () => {
let component: AreaNotesComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component, Input, OnInit } from '@angular/core';
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';

import { MatLegacySnackBar as MatSnackBar } from '@angular/material/legacy-snack-bar';
import { DeleteNoteDialogComponent } from '../delete-note-dialog/delete-note-dialog.component';
import { take } from 'rxjs';
import { Plan } from '@types';
import { AuthService, Note, PlanNotesService } from '@services';
import { SNACK_ERROR_CONFIG, SNACK_NOTICE_CONFIG } from '@shared';
import { MatDialog } from '@angular/material/dialog';

@Component({
selector: 'app-area-notes',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DeleteNoteDialogComponent } from './delete-note-dialog.component';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

describe('DeleteNoteDialogComponent', () => {
let component: DeleteNoteDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component } from '@angular/core';
import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dialog';
import { MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-delete-note-dialog',
Expand All @@ -8,6 +8,7 @@ import { MatLegacyDialogRef as MatDialogRef } from '@angular/material/legacy-dia
})
export class DeleteNoteDialogComponent {
disableDeleteButton = false;

constructor(private dialogRef: MatDialogRef<DeleteNoteDialogComponent>) {}

cancel(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MapLayerSelectDialogComponent } from './map-layer-select-dialog.component';
import {
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
MatLegacyDialog as MatDialog,
MatLegacyDialogRef as MatDialogRef,
} from '@angular/material/legacy-dialog';
MAT_DIALOG_DATA,
MatDialog,
MatDialogRef,
} from '@angular/material/dialog';

describe('MapLayerSelectDialogComponent', () => {
let component: MapLayerSelectDialogComponent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Component, Inject } from '@angular/core';
import {
MatLegacyDialogRef as MatDialogRef,
MAT_LEGACY_DIALOG_DATA as MAT_DIALOG_DATA,
} from '@angular/material/legacy-dialog';
import { BaseLayerType } from '@types';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';

@Component({
selector: 'app-map-layer-select-dialog',
Expand All @@ -12,6 +9,7 @@ import { BaseLayerType } from '@types';
})
export class MapLayerSelectDialogComponent {
disableDeleteButton = false;

constructor(
@Inject(MatDialogRef)
private dialogRef: MatDialogRef<MapLayerSelectDialogComponent>,
Expand All @@ -20,6 +18,7 @@ export class MapLayerSelectDialogComponent {
selectedLayer: number;
}
) {}

givenLayer = this.data.selectedLayer;
currentLayer = this.givenLayer;
baseLayerTypes: number[] = [
Expand All @@ -28,6 +27,7 @@ export class MapLayerSelectDialogComponent {
BaseLayerType.Satellite,
];
readonly BaseLayerType = BaseLayerType;

cancel(): void {
this.dialogRef.close(undefined);
}
Expand Down
Loading

0 comments on commit fa767fa

Please sign in to comment.