Skip to content

Commit 8096fe0

Browse files
CopilotHristo313damyanpetev
authored
refactor(igx-ts): Remove suffixes from services in templates (#1547)
Co-authored-by: Hristo313 <57346540+Hristo313@users.noreply.github.com> Co-authored-by: damyanpetev <3198469+damyanpetev@users.noreply.github.com>
1 parent 502ab5c commit 8096fe0

File tree

34 files changed

+132
-132
lines changed

34 files changed

+132
-132
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ import {
4444
} from 'igniteui-angular-charts';
4545
import { timer } from 'rxjs';
4646
import { debounce } from 'rxjs/operators';
47-
import { LocalDataService } from './localData.service';
48-
import { Contract, REGIONS } from './localData/financialData';
47+
import { LocalData } from './local-data';
48+
import { Contract, REGIONS } from './data/financialData';
4949
import { NgIf, NgFor, CurrencyPipe } from '@angular/common';
5050
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
5151

5252
@Component({
53-
providers: [LocalDataService],
53+
providers: [LocalData],
5454
selector: 'app-<%=filePrefix%>',
5555
templateUrl: './<%=filePrefix%>.html',
5656
styleUrl: './<%=filePrefix%>.scss',
@@ -136,11 +136,11 @@ export class <%=ClassName%> implements OnInit, AfterViewInit, OnDestroy {
136136
private timer: any;
137137
private volumeChanged: any;
138138
constructor(
139-
private localService: LocalDataService,
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-grid/files/src/app/__path__/localData/financialData.ts renamed to packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/data/financialData.ts

File renamed without changes.

packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/localData.service.ts renamed to packages/igx-templates/igx-ts/custom-templates/fintech-grid/files/src/app/__path__/local-data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { Injectable } from '@angular/core';
22
import { BehaviorSubject, Observable} from 'rxjs';
3-
import { FinancialData } from './localData/financialData';
3+
import { FinancialData } from './data/financialData';
44

55
@Injectable()
6-
export class LocalDataService {
6+
export class LocalData {
77
public records: Observable<any[]>;
88
public records$: BehaviorSubject<any[]>;
99

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ import {
3333
} from '<%=igxPackage%>';
3434
import { timer } from 'rxjs';
3535
import { debounce } from 'rxjs/operators';
36-
import { LocalDataService } from './localData.service';
36+
import { LocalData } from './local-data';
3737
import { ITreeGridAggregation, <%=ClassName%>TreeGridGroupingPipe } from './tree-grid-grouping.pipe';
3838
import { NgIf, CurrencyPipe } from '@angular/common';
3939
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
4040

4141
@Component({
42-
providers: [LocalDataService],
42+
providers: [LocalData],
4343
selector: 'app-<%=filePrefix%>',
4444
templateUrl: './<%=filePrefix%>.html',
4545
styleUrl: './<%=filePrefix%>.scss',
@@ -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: LocalDataService, 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/custom-templates/fintech-tree-grid/files/src/app/__path__/localData.service.ts renamed to packages/igx-templates/igx-ts/custom-templates/fintech-tree-grid/files/src/app/__path__/local-data.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BehaviorSubject, Observable} from 'rxjs';
33
import { FinancialData } from './assets/financialData';
44

55
@Injectable()
6-
export class LocalDataService {
6+
export class LocalData {
77
public records: Observable<any[]>;
88
public records$: BehaviorSubject<any[]>;
99

packages/igx-templates/igx-ts/projects/_base/files/src/app/app.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { provideRouter } from '@angular/router';
55

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

1010
export const appConfig: ApplicationConfig = {
1111
providers: [
@@ -14,6 +14,6 @@ export const appConfig: ApplicationConfig = {
1414
provideRouter(routes),
1515
importProvidersFrom(BrowserModule, HammerModule),
1616
provideAnimations(),
17-
...(environment.production ? [{ provide: ErrorHandler, useClass: GlobalErrorHandlerService }] : [])
17+
...(environment.production ? [{ provide: ErrorHandler, useClass: GlobalErrorHandler }] : [])
1818
]
1919
};

packages/igx-templates/igx-ts/projects/_base/files/src/app/error-routing/error/global-error-handler.service.ts renamed to packages/igx-templates/igx-ts/projects/_base/files/src/app/error-routing/error/global-error-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ErrorHandler, Injectable, Injector, NgZone, inject } from '@angular/cor
22
import { Router } from '@angular/router';
33

44
@Injectable()
5-
export class GlobalErrorHandlerService implements ErrorHandler {
5+
export class GlobalErrorHandler implements ErrorHandler {
66
private injector = inject(Injector);
77
private zone = inject(NgZone);
88

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from 'igniteui-angular';
88
import { AppRoutingModule } from './app-routing-module';
99
import { App } from './app';
10-
import { AuthenticationModule, ExternalAuthService } from './authentication';
10+
import { AuthenticationModule, ExternalAuth } from './authentication';
1111
import { Home } from './home/home';
1212

1313
@NgModule({
@@ -33,7 +33,7 @@ import { Home } from './home/home';
3333
})
3434
export class AppModule {
3535

36-
constructor(private externalAuthService: ExternalAuthService) {
36+
constructor(private externalAuthService: ExternalAuth) {
3737
/**
3838
* To register a social login, un-comment one or more of the following and add your service provider Client ID.
3939
* See https://github.com/IgniteUI/igniteui-cli/wiki/Angular-Authentication-Project-Template#add-a-third-party-social-provider

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
IgxRippleModule,
1010
} from '<%=igxPackage%>';
1111

12-
import { AuthenticationModule, ExternalAuthService } from './authentication';
12+
import { AuthenticationModule, ExternalAuth } from './authentication';
1313
import { routes } from './app.routes';
1414

1515
export const appConfig: ApplicationConfig = {
@@ -27,6 +27,6 @@ export const appConfig: ApplicationConfig = {
2727
AuthenticationModule
2828
),
2929
provideAnimations(),
30-
ExternalAuthService
30+
ExternalAuth
3131
]
3232
};

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { Injectable } from '@angular/core';
22
import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
3-
import { UserService } from './services/user.service';
3+
import { UserStore } from './services/user-store';
44

55
@Injectable({
66
providedIn: 'root'
77
})
88
export class AuthGuard implements CanActivate {
9-
constructor(private router: Router, private userService: UserService) { }
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 } });

0 commit comments

Comments
 (0)