Skip to content

Commit c3f8f72

Browse files
Copilotdamyanpetev
andcommitted
revert: undo module migration from side-nav-auth, keep variable renaming only
Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
1 parent 03e72c6 commit c3f8f72

8 files changed

Lines changed: 148 additions & 23 deletions

File tree

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { NgModule } from '@angular/core';
2+
import { FormsModule } from '@angular/forms';
3+
import { BrowserModule, HammerModule } from '@angular/platform-browser';
4+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
5+
import {
6+
IgxLayoutModule, IgxNavbarModule, IgxNavigationDrawerModule, IgxRippleModule
7+
} from 'igniteui-angular';
8+
import { AppRoutingModule } from './app-routing-module';
9+
import { App } from './app';
10+
import { AuthenticationModule, ExternalAuth } from './authentication';
11+
import { Home } from './home/home';
12+
13+
@NgModule({
14+
declarations: [
15+
App,
16+
Home
17+
],
18+
imports: [
19+
FormsModule,
20+
BrowserModule,
21+
HammerModule,
22+
BrowserAnimationsModule,
23+
// NOTE: `AuthenticationModule` defines child routes, must be imported before root `AppRoutingModule`
24+
AuthenticationModule,
25+
AppRoutingModule,
26+
IgxNavigationDrawerModule,
27+
IgxNavbarModule,
28+
IgxLayoutModule,
29+
IgxRippleModule
30+
],
31+
providers: [],
32+
bootstrap: [App]
33+
})
34+
export class AppModule {
35+
36+
constructor(private externalAuthService: ExternalAuth) {
37+
/**
38+
* To register a social login, un-comment one or more of the following and add your service provider Client ID.
39+
* See https://github.com/IgniteUI/igniteui-cli/wiki/Angular-Authentication-Project-Template#add-a-third-party-social-provider
40+
*/
41+
// this.externalAuthService.addGoogle('<CLIENT_ID>');
42+
43+
// this.externalAuthService.addMicrosoft('<CLIENT_ID>');
44+
45+
// this.externalAuthService.addFacebook('<CLIENT_ID>');
46+
}
47+
48+
}

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,30 @@ 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';
75
import {
86
IgxLayoutModule,
97
IgxNavbarModule,
108
IgxNavigationDrawerModule,
119
IgxRippleModule,
1210
} from '<%=igxPackage%>';
1311

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

1915
export const appConfig: ApplicationConfig = {
2016
providers: [
2117
provideBrowserGlobalErrorListeners(),
2218
provideZoneChangeDetection({ eventCoalescing: true }),
2319
provideRouter(routes),
24-
provideHttpClient(withInterceptorsFromDi()),
2520
importProvidersFrom(
2621
BrowserModule,
2722
HammerModule,
2823
IgxLayoutModule,
2924
IgxNavbarModule,
3025
IgxNavigationDrawerModule,
3126
IgxRippleModule,
32-
AuthModule.forRoot()
27+
AuthenticationModule
3328
),
34-
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
35-
// TODO: DELETE THIS BEFORE PRODUCTION!
36-
BackendProvider,
3729
provideAnimations(),
3830
ExternalAuth
3931
]
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import { Routes } from '@angular/router';
2-
import { authRoutes } from './authentication/authentication.routes';
32

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

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

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

108
describe('App', () => {
119
beforeEach(async () => {
@@ -14,13 +12,11 @@ describe('App', () => {
1412
NoopAnimationsModule,
1513
RouterModule.forRoot([]),
1614
IgxNavigationDrawerModule,
15+
AuthenticationModule,
1716
IgxNavbarModule,
1817
IgxLayoutModule,
1918
IgxRippleModule,
2019
App
21-
],
22-
providers: [
23-
importProvidersFrom(HttpClientModule, AuthModule)
2420
]
2521
}).compileComponents();
2622
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { AuthenticationModule } from './authentication-module';
2+
3+
describe('AuthenticationModule', () => {
4+
let authenticationModule: AuthenticationModule;
5+
6+
beforeEach(() => {
7+
authenticationModule = new AuthenticationModule();
8+
});
9+
10+
it('should create an instance', () => {
11+
expect(authenticationModule).toBeTruthy();
12+
});
13+
});
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import { CommonModule } from '@angular/common';
2+
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
3+
import { NgModule } from '@angular/core';
4+
import { ReactiveFormsModule } from '@angular/forms';
5+
import { AuthModule, OidcConfigService } from 'angular-auth-oidc-client';
6+
import {
7+
IgxAvatarModule,
8+
IgxButtonModule,
9+
IgxDialogModule,
10+
IgxDropDownModule,
11+
IgxIconModule,
12+
IgxInputGroupModule,
13+
IgxRippleModule,
14+
IgxToggleModule
15+
} from 'igniteui-angular';
16+
import { AuthGuard } from './auth.guard';
17+
import { AuthenticationRoutingModule } from './authentication-routing-module';
18+
import { LoginBar } from './login-bar/login-bar';
19+
import { LoginDialog } from './login-dialog/login-dialog';
20+
import { Login } from './login/login';
21+
import { Profile} from './profile/profile';
22+
import { Redirect } from './redirect/redirect';
23+
import { Register } from './register/register';
24+
import { BackendProvider } from './services/fake-backend';
25+
import { JwtInterceptor } from './services/jwt.interceptor';
26+
27+
@NgModule({
28+
imports: [
29+
CommonModule,
30+
HttpClientModule,
31+
ReactiveFormsModule,
32+
AuthModule.forRoot(),
33+
AuthenticationRoutingModule,
34+
IgxAvatarModule,
35+
IgxButtonModule,
36+
IgxDialogModule,
37+
IgxDropDownModule,
38+
IgxIconModule,
39+
IgxInputGroupModule,
40+
IgxRippleModule,
41+
IgxToggleModule
42+
],
43+
declarations: [
44+
LoginBar,
45+
Login,
46+
LoginDialog,
47+
Profile,
48+
Redirect,
49+
Register
50+
],
51+
providers: [
52+
AuthGuard,
53+
OidcConfigService,
54+
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
55+
// TODO: DELETE THIS BEFORE PRODUCTION!
56+
BackendProvider
57+
],
58+
exports: [
59+
LoginBar,
60+
Login,
61+
Redirect,
62+
Register,
63+
LoginDialog,
64+
Profile
65+
]
66+
})
67+
export class AuthenticationModule { }

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
1-
import { Routes } from '@angular/router';
1+
import { NgModule } from '@angular/core';
2+
import { RouterModule, Routes } from '@angular/router';
23
import { AuthGuard } from './auth.guard';
34
import { Profile } from './profile/profile';
45
import { Redirect } from './redirect/redirect';
56
import { ExternalAuthProvider } from './services/external-auth-configs';
67
import { ExternalAuthRedirectUrl } from './services/external-auth';
78

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

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export * from './auth.guard';
2-
export * from './authentication.routes';
2+
export * from './authentication-routing-module';
3+
export * from './authentication-module';
34
export * from './models/login';
45
export * from './models/register-info';
56
export * from './models/user';

0 commit comments

Comments
 (0)