Skip to content

Commit 03e72c6

Browse files
Copilotdamyanpetev
andcommitted
refactor: remove NgModule files, migrate to standalone structure; fix service variable names
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
1 parent 51514d3 commit 03e72c6

21 files changed

Lines changed: 74 additions & 199 deletions

File tree

packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/__filePrefix__.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
136136
private timer: any;
137137
private volumeChanged: any;
138138
constructor(
139-
private localService: LocalData,
139+
private localData: LocalData,
140140
private elRef: ElementRef,
141141
private cdr: ChangeDetectorRef) {
142-
this.subscription = this.localService.getData(this.volume);
143-
this.localService.records.subscribe(x => { this.data = x; });
142+
this.subscription = this.localData.getData(this.volume);
143+
this.localData.records.subscribe(x => { this.data = x; });
144144
}
145145

146146
public ngOnInit(): void {
@@ -166,7 +166,7 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
166166
this.volumeChanged = this.volumeSlider.valueChange.pipe(debounce(() => timer(200)));
167167
this.volumeChanged.subscribe(
168168
() => {
169-
this.localService.getData(this.volume);
169+
this.localData.getData(this.volume);
170170
},
171171
(err: string) => console.log('Error: ' + err));
172172
}

packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/__filePrefix__.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
140140
private timer: any;
141141
private volumeChanged: any;
142142

143-
constructor(private zone: NgZone, private localService: LocalData, private elRef: ElementRef) {
144-
this.subscription = this.localService.getData(this.volume);
145-
this.localService.records.subscribe((d) => this.data = d);
143+
constructor(private zone: NgZone, private localData: LocalData, private elRef: ElementRef) {
144+
this.subscription = this.localData.getData(this.volume);
145+
this.localData.records.subscribe((d) => this.data = d);
146146
}
147147

148148
public ngOnInit(): void {
149149
this.grid1.sortingExpressions = [{ fieldName: this.groupColumnKey, dir: SortingDirection.Desc }];
150150
this.volumeChanged = this.volumeSlider.valueChange.pipe(debounce(() => timer(200)));
151151
this.volumeChanged.subscribe(
152152
() => {
153-
this.localService.getData(this.volume);
153+
this.localData.getData(this.volume);
154154
},
155155
(err: string) => console.log('Error: ' + err));
156156
}

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/app-module.ts

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

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/app.config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,38 @@ import { ApplicationConfig, importProvidersFrom, provideBrowserGlobalErrorListen
22
import { BrowserModule, HammerModule } from '@angular/platform-browser';
33
import { provideAnimations } from '@angular/platform-browser/animations';
44
import { provideRouter } from '@angular/router';
5+
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
6+
import { AuthModule } from 'angular-auth-oidc-client';
57
import {
68
IgxLayoutModule,
79
IgxNavbarModule,
810
IgxNavigationDrawerModule,
911
IgxRippleModule,
1012
} from '<%=igxPackage%>';
1113

12-
import { AuthenticationModule, ExternalAuth } from './authentication';
14+
import { ExternalAuth } from './authentication';
15+
import { JwtInterceptor } from './authentication/services/jwt.interceptor';
16+
import { BackendProvider } from './authentication/services/fake-backend';
1317
import { routes } from './app.routes';
1418

1519
export const appConfig: ApplicationConfig = {
1620
providers: [
1721
provideBrowserGlobalErrorListeners(),
1822
provideZoneChangeDetection({ eventCoalescing: true }),
1923
provideRouter(routes),
24+
provideHttpClient(withInterceptorsFromDi()),
2025
importProvidersFrom(
2126
BrowserModule,
2227
HammerModule,
2328
IgxLayoutModule,
2429
IgxNavbarModule,
2530
IgxNavigationDrawerModule,
2631
IgxRippleModule,
27-
AuthenticationModule
32+
AuthModule.forRoot()
2833
),
34+
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
35+
// TODO: DELETE THIS BEFORE PRODUCTION!
36+
BackendProvider,
2937
provideAnimations(),
3038
ExternalAuth
3139
]
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
import { Routes } from '@angular/router';
2+
import { authRoutes } from './authentication/authentication.routes';
23

3-
export const routes: Routes = [];
4+
export const routes: Routes = [
5+
...authRoutes
6+
];

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/app.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { TestBed } from '@angular/core/testing';
2+
import { importProvidersFrom } from '@angular/core';
23
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
34
import { RouterModule } from '@angular/router';
5+
import { HttpClientModule } from '@angular/common/http';
46
import { IgxLayoutModule, IgxNavbarModule, IgxNavigationDrawerModule, IgxRippleModule } from 'igniteui-angular';
7+
import { AuthModule } from 'angular-auth-oidc-client';
58
import { App } from './app';
6-
import { AuthenticationModule } from './authentication';
79

810
describe('App', () => {
911
beforeEach(async () => {
@@ -12,11 +14,13 @@ describe('App', () => {
1214
NoopAnimationsModule,
1315
RouterModule.forRoot([]),
1416
IgxNavigationDrawerModule,
15-
AuthenticationModule,
1617
IgxNavbarModule,
1718
IgxLayoutModule,
1819
IgxRippleModule,
1920
App
21+
],
22+
providers: [
23+
importProvidersFrom(HttpClientModule, AuthModule)
2024
]
2125
}).compileComponents();
2226
});

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/auth.guard.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import { UserStore } from './services/user';
66
providedIn: 'root'
77
})
88
export class AuthGuard implements CanActivate {
9-
constructor(private router: Router, private userService: UserStore) { }
9+
constructor(private router: Router, private userStore: UserStore) { }
1010

1111
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
12-
if (this.userService.currentUser) {
12+
if (this.userStore.currentUser) {
1313
return true;
1414
}
1515
this.router.navigate([''], { queryParams: { returnUrl: state.url } });

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/authentication-module.spec.ts

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

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/authentication-module.ts

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

packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/authentication-routing-module.ts renamed to packages/igx-templates/igx-ts/projects/side-nav-auth/files/src/app/authentication/authentication.routes.ts

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,13 @@
1-
import { NgModule } from '@angular/core';
2-
import { RouterModule, Routes } from '@angular/router';
1+
import { Routes } from '@angular/router';
32
import { AuthGuard } from './auth.guard';
43
import { Profile } from './profile/profile';
54
import { Redirect } from './redirect/redirect';
65
import { ExternalAuthProvider } from './services/external-auth-configs';
76
import { ExternalAuthRedirectUrl } from './services/external-auth';
87

9-
const authRoutes: Routes = [
8+
export const authRoutes: Routes = [
109
{ path: 'profile', component: Profile, canActivate: [AuthGuard] },
1110
{ path: ExternalAuthRedirectUrl.Google, component: Redirect, data: { provider: ExternalAuthProvider.Google } },
1211
{ path: ExternalAuthRedirectUrl.Facebook, component: Redirect, data: { provider: ExternalAuthProvider.Facebook } },
1312
{ path: ExternalAuthRedirectUrl.Microsoft, component: Redirect, data: { provider: ExternalAuthProvider.Microsoft } }
1413
];
15-
16-
@NgModule({
17-
imports: [
18-
RouterModule.forChild(authRoutes)
19-
],
20-
exports: [
21-
RouterModule
22-
]
23-
})
24-
export class AuthenticationRoutingModule { }

0 commit comments

Comments
 (0)