Skip to content

Commit c8f588b

Browse files
committed
feat: use modules
1 parent f3c7514 commit c8f588b

17 files changed

+114
-123
lines changed

frontend/src/angular/src/app/app.component.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@
1313
limitations under the License.
1414
*/
1515
import { Component } from "@angular/core";
16+
import { BrowserModule } from "@angular/platform-browser";
17+
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
18+
import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
19+
import { Router, RouterModule } from "@angular/router";
1620

1721
@Component({
1822
selector: "app-root",
23+
imports: [
24+
RouterModule,
25+
BrowserModule,
26+
BrowserAnimationsModule,
27+
MatProgressSpinnerModule],
1928
templateUrl: "./app.component.html",
2029
styleUrls: ["./app.component.scss"],
21-
standalone: false
2230
})
2331
export class AppComponent {
2432
protected title = "app";
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Copyright 2016 Sven Loesekann
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
import { ApplicationConfig, importProvidersFrom } from "@angular/core";
17+
import { provideAnimations } from "@angular/platform-browser/animations";
18+
import { provideHttpClient, withInterceptorsFromDi } from "@angular/common/http";
19+
import { provideRouter } from "@angular/router";
20+
import { routes } from "./app.routes";
21+
22+
export const appConfig: ApplicationConfig = {
23+
providers: [provideRouter(routes), provideAnimations(), provideHttpClient(withInterceptorsFromDi())]
24+
};

frontend/src/angular/src/app/app.module.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

frontend/src/angular/src/app/app-routing.module.ts renamed to frontend/src/angular/src/app/app.routes.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,14 @@
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
*/
15-
import { NgModule } from "@angular/core";
1615
import { Routes, RouterModule } from "@angular/router";
1716
import { SplashComponent } from "./splash/splash.component";
1817

19-
const routes: Routes = [
18+
export const routes: Routes = [
2019
{ path: "", redirectTo: "/splash", pathMatch: "full" },
2120
{
2221
path: "maps",
23-
loadChildren: () => import("./maps/maps.module").then((m) => m.MapsModule),
22+
loadChildren: () => import("./maps/maps.routes").then((m) => m.routes),
2423
},
2524
{ path: "splash", component: SplashComponent },
2625
];
27-
28-
@NgModule({
29-
imports: [RouterModule.forRoot(routes, {})],
30-
exports: [RouterModule],
31-
})
32-
export class AppRoutingModule {}

frontend/src/angular/src/app/maps/company-site/company-site.component.ts

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,37 @@ import {
2323
DestroyRef,
2424
inject,
2525
} from "@angular/core";
26-
import { CompanySiteService } from "../services/company-site.service";
26+
import { CompanySiteService } from "../../services/company-site.service";
2727
import "bingmaps";
28-
import { ConfigurationService } from "../services/configuration.service";
28+
import { ConfigurationService } from "../../services/configuration.service";
2929
import { MainConfiguration } from "../model/main-configuration";
3030
import { Observable, of, iif, Subject, forkJoin } from "rxjs";
3131
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
3232
import { CompanySite } from "../model/company-site";
33-
import { FormBuilder, Validators } from "@angular/forms";
33+
import { FormBuilder, FormsModule, ReactiveFormsModule, Validators } from "@angular/forms";
3434
import {
3535
switchMap,
3636
debounceTime,
3737
filter,
38-
flatMap,
39-
tap,
40-
map,
38+
mergeMap,
4139
} from "rxjs/operators";
4240
import { BingMapsService } from "../../services/bing-maps.service";
43-
import { MatSelectionListChange } from "@angular/material/list";
41+
import { MatListModule, MatSelectionListChange } from "@angular/material/list";
4442
import { Polygon } from "../model/polygon";
4543
import { Location } from "../model/location";
4644
import { Ring } from "../model/ring";
47-
import { MatDialog } from "@angular/material/dialog";
45+
import { MatDialog, MatDialogModule } from "@angular/material/dialog";
4846
import {
4947
PolygonDeleteDialogComponent,
5048
MyDialogResult,
5149
DialogMetaData,
5250
} from "../polygon-delete-dialog/polygon-delete-dialog.component";
51+
import { CommonModule } from "@angular/common";
52+
import { MatAutocompleteModule } from "@angular/material/autocomplete";
53+
import { MatButtonModule } from "@angular/material/button";
54+
import { MatFormFieldModule } from "@angular/material/form-field";
55+
import { MatInputModule } from "@angular/material/input";
56+
import { MatSliderModule } from "@angular/material/slider";
5357

5458
interface Container {
5559
companySite: CompanySite;
@@ -69,9 +73,19 @@ interface PolygonMetaData {
6973

7074
@Component({
7175
selector: "app-company-site",
76+
imports: [
77+
CommonModule,
78+
FormsModule,
79+
ReactiveFormsModule,
80+
MatAutocompleteModule,
81+
MatFormFieldModule,
82+
MatSliderModule,
83+
MatInputModule,
84+
MatListModule,
85+
MatButtonModule,
86+
MatDialogModule,],
7287
templateUrl: "./company-site.component.html",
7388
styleUrls: ["./company-site.component.scss"],
74-
standalone: false
7589
})
7690
export class CompanySiteComponent implements OnInit, AfterViewInit, OnDestroy {
7791
@ViewChild("bingMap")
@@ -173,10 +187,10 @@ export class CompanySiteComponent implements OnInit, AfterViewInit, OnDestroy {
173187
!!myContainer.companySite.polygons &&
174188
!!myContainer.mainConfiguration
175189
),
176-
flatMap((myContainer) =>
190+
mergeMap((myContainer) =>
177191
this.bingMapsService
178192
.initialize(myContainer.mainConfiguration.mapKey)
179-
.pipe(flatMap(() => of(myContainer)))
193+
.pipe(mergeMap(() => of(myContainer)))
180194
),
181195
takeUntilDestroyed(this.destroy)
182196
)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/**
2+
* Copyright 2018 Sven Loesekann
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
http://www.apache.org/licenses/LICENSE-2.0
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.
12+
*/
13+
export * from './maps.routes';

frontend/src/angular/src/app/maps/maps.module.ts

Lines changed: 0 additions & 49 deletions
This file was deleted.

frontend/src/angular/src/app/maps/maps-routing.module.ts renamed to frontend/src/angular/src/app/maps/maps.routes.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,14 @@
1313
limitations under the License.
1414
*/
1515
import { Routes, RouterModule } from "@angular/router";
16-
import { NgModule } from "@angular/core";
1716
import { CompanySiteComponent } from "./company-site/company-site.component";
1817
import { AuthGuardService } from "../services/auth-guard.service";
1918

20-
const routes: Routes = [
19+
export const routes: Routes = [
2120
{ path: "", redirectTo: "companySite", pathMatch: "full" },
2221
{
2322
path: "companySite",
2423
component: CompanySiteComponent,
2524
canActivate: [AuthGuardService],
2625
},
2726
];
28-
29-
@NgModule({
30-
imports: [RouterModule.forChild(routes)],
31-
exports: [RouterModule],
32-
})
33-
export class MapsRoutingModule {}

frontend/src/angular/src/app/maps/polygon-delete-dialog/polygon-delete-dialog.component.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@
99
See the License for the specific language governing permissions and
1010
limitations under the License.
1111
*/
12+
import { CommonModule } from "@angular/common";
1213
import { Component, Inject } from "@angular/core";
13-
import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material/dialog";
14+
import { ReactiveFormsModule, FormsModule } from "@angular/forms";
15+
import { MatAutocompleteModule } from "@angular/material/autocomplete";
16+
import { MatButtonModule } from "@angular/material/button";
17+
import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from "@angular/material/dialog";
18+
import { MatFormFieldModule } from "@angular/material/form-field";
19+
import { MatInputModule } from "@angular/material/input";
20+
import { MatListModule } from "@angular/material/list";
21+
import { MatSliderModule } from "@angular/material/slider";
1422

1523
// eslint-disable-next-line no-shadow
1624
export enum MyDialogResult {
@@ -25,9 +33,20 @@ export interface DialogMetaData {
2533

2634
@Component({
2735
selector: "app-polygon-delete-dialog",
36+
imports: [
37+
CommonModule,
38+
ReactiveFormsModule,
39+
FormsModule,
40+
MatAutocompleteModule,
41+
MatFormFieldModule,
42+
MatSliderModule,
43+
MatInputModule,
44+
MatListModule,
45+
MatButtonModule,
46+
MatDialogModule
47+
],
2848
templateUrl: "./polygon-delete-dialog.component.html",
29-
styleUrls: ["./polygon-delete-dialog.component.scss"],
30-
standalone: false
49+
styleUrls: ["./polygon-delete-dialog.component.scss"],
3150
})
3251
export class PolygonDeleteDialogComponent {
3352
protected dialogResults = MyDialogResult;

0 commit comments

Comments
 (0)