Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ import {
} from 'igniteui-angular-charts';
import { timer } from 'rxjs';
import { debounce } from 'rxjs/operators';
import { LocalDataService } from './localData.service';
import { Contract, REGIONS } from './localData/financialData';
import { LocalData } from './localData';
Comment thread
Hristo313 marked this conversation as resolved.
Outdated
import { Contract, REGIONS } from './data/financialData';
import { NgIf, NgFor, CurrencyPipe } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';

@Component({
providers: [LocalDataService],
providers: [LocalData],
selector: 'app-<%=filePrefix%>',
templateUrl: './<%=filePrefix%>.html',
styleUrl: './<%=filePrefix%>.scss',
Expand Down Expand Up @@ -136,11 +136,11 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
private timer: any;
private volumeChanged: any;
constructor(
private localService: LocalDataService,
private localData: LocalData,
private elRef: ElementRef,
private cdr: ChangeDetectorRef) {
this.subscription = this.localService.getData(this.volume);
this.localService.records.subscribe(x => { this.data = x; });
this.subscription = this.localData.getData(this.volume);
this.localData.records.subscribe(x => { this.data = x; });
}

public ngOnInit(): void {
Expand All @@ -166,7 +166,7 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
this.volumeChanged = this.volumeSlider.valueChange.pipe(debounce(() => timer(200)));
this.volumeChanged.subscribe(
() => {
this.localService.getData(this.volume);
this.localData.getData(this.volume);
},
(err: string) => console.log('Error: ' + err));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable} from 'rxjs';
import { FinancialData } from './localData/financialData';
import { FinancialData } from './data/financialData';

@Injectable()
export class LocalDataService {
export class LocalData {
public records: Observable<any[]>;
public records$: BehaviorSubject<any[]>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import {
} from '<%=igxPackage%>';
import { timer } from 'rxjs';
import { debounce } from 'rxjs/operators';
import { LocalDataService } from './localData.service';
import { LocalData } from './localData';
import { ITreeGridAggregation, <%=ClassName%>TreeGridGroupingPipe } from './tree-grid-grouping.pipe';
import { NgIf, CurrencyPipe } from '@angular/common';
import { ReactiveFormsModule, FormsModule } from '@angular/forms';

@Component({
providers: [LocalDataService],
providers: [LocalData],
selector: 'app-<%=filePrefix%>',
templateUrl: './<%=filePrefix%>.html',
styleUrl: './<%=filePrefix%>.scss',
Expand Down Expand Up @@ -140,17 +140,17 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
private timer: any;
private volumeChanged: any;

constructor(private zone: NgZone, private localService: LocalDataService, private elRef: ElementRef) {
this.subscription = this.localService.getData(this.volume);
this.localService.records.subscribe((d) => this.data = d);
constructor(private zone: NgZone, private localData: LocalData, private elRef: ElementRef) {
this.subscription = this.localData.getData(this.volume);
this.localData.records.subscribe((d) => this.data = d);
}

public ngOnInit(): void {
this.grid1.sortingExpressions = [{ fieldName: this.groupColumnKey, dir: SortingDirection.Desc }];
this.volumeChanged = this.volumeSlider.valueChange.pipe(debounce(() => timer(200)));
this.volumeChanged.subscribe(
() => {
this.localService.getData(this.volume);
this.localData.getData(this.volume);
},
(err: string) => console.log('Error: ' + err));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BehaviorSubject, Observable} from 'rxjs';
import { FinancialData } from './assets/financialData';

@Injectable()
export class LocalDataService {
export class LocalData {
public records: Observable<any[]>;
public records$: BehaviorSubject<any[]>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { provideRouter } from '@angular/router';

import { environment } from '../environments/environment';
import { routes } from './app.routes';
import { GlobalErrorHandlerService } from './error-routing/error/global-error-handler.service';
import { GlobalErrorHandler } from './error-routing/error/global-error-handler';

export const appConfig: ApplicationConfig = {
providers: [
Expand All @@ -14,6 +14,6 @@ export const appConfig: ApplicationConfig = {
provideRouter(routes),
importProvidersFrom(BrowserModule, HammerModule),
provideAnimations(),
...(environment.production ? [{ provide: ErrorHandler, useClass: GlobalErrorHandlerService }] : [])
...(environment.production ? [{ provide: ErrorHandler, useClass: GlobalErrorHandler }] : [])
]
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ErrorHandler, Injectable, Injector, NgZone, inject } from '@angular/cor
import { Router } from '@angular/router';

@Injectable()
export class GlobalErrorHandlerService implements ErrorHandler {
export class GlobalErrorHandler implements ErrorHandler {
private injector = inject(Injector);
private zone = inject(NgZone);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,39 @@ import { ApplicationConfig, importProvidersFrom, provideBrowserGlobalErrorListen
import { BrowserModule, HammerModule } from '@angular/platform-browser';
import { provideAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';
import { HTTP_INTERCEPTORS, provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { AuthModule } from 'angular-auth-oidc-client';
import {
IgxLayoutModule,
IgxNavbarModule,
IgxNavigationDrawerModule,
IgxRippleModule,
} from '<%=igxPackage%>';

import { AuthenticationModule, ExternalAuthService } from './authentication';
import { ExternalAuth } from './authentication';
import { JwtInterceptor } from './authentication/services/jwt.interceptor';
import { BackendProvider } from './authentication/services/fake-backend';
import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes),
provideHttpClient(withInterceptorsFromDi()),
importProvidersFrom(
BrowserModule,
HammerModule,
IgxLayoutModule,
IgxNavbarModule,
IgxNavigationDrawerModule,
IgxRippleModule,
AuthenticationModule
AuthModule.forRoot()
),
{ provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true },
// TODO: DELETE THIS BEFORE PRODUCTION!
BackendProvider,
provideAnimations(),
ExternalAuthService
ExternalAuth
Comment thread
damyanpetev marked this conversation as resolved.
Outdated
]
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Routes } from '@angular/router';
import { authRoutes } from './authentication/authentication.routes';

export const routes: Routes = [];
export const routes: Routes = [
...authRoutes
];
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { TestBed } from '@angular/core/testing';
import { importProvidersFrom } from '@angular/core';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { RouterModule } from '@angular/router';
import { HttpClientModule } from '@angular/common/http';
import { IgxLayoutModule, IgxNavbarModule, IgxNavigationDrawerModule, IgxRippleModule } from 'igniteui-angular';
import { AuthModule } from 'angular-auth-oidc-client';
import { App } from './app';
import { AuthenticationModule } from './authentication';

describe('App', () => {
beforeEach(async () => {
Expand All @@ -12,11 +14,13 @@ describe('App', () => {
NoopAnimationsModule,
RouterModule.forRoot([]),
IgxNavigationDrawerModule,
AuthenticationModule,
IgxNavbarModule,
IgxLayoutModule,
IgxRippleModule,
App
],
providers: [
importProvidersFrom(HttpClientModule, AuthModule)
]
}).compileComponents();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
import { UserService } from './services/user.service';
import { UserStore } from './services/user';

@Injectable({
providedIn: 'root'
})
export class AuthGuard implements CanActivate {
constructor(private router: Router, private userService: UserService) { }
constructor(private router: Router, private userStore: UserStore) { }

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
if (this.userService.currentUser) {
if (this.userStore.currentUser) {
return true;
}
this.router.navigate([''], { queryParams: { returnUrl: state.url } });
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { Routes } from '@angular/router';
import { AuthGuard } from './auth.guard';
import { Profile } from './profile/profile';
import { Redirect } from './redirect/redirect';
import { ExternalAuthProvider } from './services/external-auth-configs';
import { ExternalAuthRedirectUrl } from './services/external-auth.service';
import { ExternalAuthRedirectUrl } from './services/external-auth';

const authRoutes: Routes = [
export const authRoutes: Routes = [
{ path: 'profile', component: Profile, canActivate: [AuthGuard] },
{ path: ExternalAuthRedirectUrl.Google, component: Redirect, data: { provider: ExternalAuthProvider.Google } },
{ path: ExternalAuthRedirectUrl.Facebook, component: Redirect, data: { provider: ExternalAuthProvider.Facebook } },
{ path: ExternalAuthRedirectUrl.Microsoft, component: Redirect, data: { provider: ExternalAuthProvider.Microsoft } }
];

@NgModule({
imports: [
RouterModule.forChild(authRoutes)
],
exports: [
RouterModule
]
})
export class AuthenticationRoutingModule { }
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export * from './auth.guard';
export * from './authentication-routing-module';
export * from './authentication-module';
export * from './authentication.routes';
export * from './models/login';
export * from './models/register-info';
export * from './models/user';
export * from './services/authentication.service';
export * from './services/external-auth.service';
export * from './services/user.service';
export * from './services/authentication';
export * from './services/external-auth';
export * from './services/user';
Loading