Prettied, Linted and updated angular.json according to the latest schematic of Angular CLI.
Now all that is needed is to make it ready for strict compiling. Removed eslint-plugin-prettier as it is not recommended and causes errors for both eslint and prettier Bumped to v8.0.0
This commit is contained in:
1 parent
438a98334d
commit
5ea09df272
320 files changed
+2233
-2268
No files matched your search
@@ -1,10 +1,10 @@
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
|
||||
|
||||
import { CostCentreService } from '../cost-centre.service';
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { FormBuilder, FormGroup } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { CostCentreService } from '../cost-centre.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cost-centre-detail',
|
||||
@@ -53,7 +53,7 @@ export class CostCentreDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe(
|
||||
(result) => {
|
||||
() => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/cost-centres');
|
||||
},
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { CostCentre } from '../core/cost-centre';
|
||||
import { Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { CostCentre } from '../core/cost-centre';
|
||||
|
||||
import { CostCentreService } from './cost-centre.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CostCentreListResolver implements Resolve<CostCentre[]> {
|
||||
constructor(private ser: CostCentreService, private router: Router) {}
|
||||
constructor(private ser: CostCentreService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<CostCentre[]> {
|
||||
resolve(): Observable<CostCentre[]> {
|
||||
return this.ser.list();
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { merge, Observable, of as observableOf } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
|
||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||
function compare(a, b, isAsc) {
|
||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
}
|
||||
|
||||
export class CostCentreListDataSource extends DataSource<CostCentre> {
|
||||
constructor(private paginator: MatPaginator, private sort: MatSort, public data: CostCentre[]) {
|
||||
super();
|
||||
@@ -17,9 +23,7 @@ export class CostCentreListDataSource extends DataSource<CostCentre> {
|
||||
this.paginator.length = this.data.length;
|
||||
|
||||
return merge(...dataMutations).pipe(
|
||||
map(() => {
|
||||
return this.getPagedData(this.getSortedData([...this.data]));
|
||||
}),
|
||||
map(() => this.getPagedData(this.getSortedData([...this.data]))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -48,8 +52,3 @@ export class CostCentreListDataSource extends DataSource<CostCentre> {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/** Simple sort comparator for example ID/Name columns (for client-side sorting). */
|
||||
function compare(a, b, isAsc) {
|
||||
return (a < b ? -1 : 1) * (isAsc ? 1 : -1);
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { CostCentreListDataSource } from './cost-centre-list-datasource';
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { CostCentre } from '../../core/cost-centre';
|
||||
|
||||
import { CostCentreListDataSource } from './cost-centre-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cost-centre-list',
|
||||
templateUrl: './cost-centre-list.component.html',
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { CostCentreService } from './cost-centre.service';
|
||||
import { CostCentre } from '../core/cost-centre';
|
||||
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
|
||||
import { CostCentre } from '../core/cost-centre';
|
||||
|
||||
import { CostCentreService } from './cost-centre.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CostCentreResolver implements Resolve<CostCentre> {
|
||||
constructor(private ser: CostCentreService, private router: Router) {}
|
||||
constructor(private ser: CostCentreService) {}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<CostCentre> {
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<CostCentre> {
|
||||
const id = route.paramMap.get('id');
|
||||
return this.ser.get(id);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { CostCentreListResolver } from './cost-centre-list-resolver.service';
|
||||
import { CostCentreResolver } from './cost-centre-resolver.service';
|
||||
import { CostCentreListComponent } from './cost-centre-list/cost-centre-list.component';
|
||||
import { CostCentreDetailComponent } from './cost-centre-detail/cost-centre-detail.component';
|
||||
|
||||
import { AuthGuard } from '../auth/auth-guard.service';
|
||||
|
||||
import { CostCentreDetailComponent } from './cost-centre-detail/cost-centre-detail.component';
|
||||
import { CostCentreListResolver } from './cost-centre-list-resolver.service';
|
||||
import { CostCentreListComponent } from './cost-centre-list/cost-centre-list.component';
|
||||
import { CostCentreResolver } from './cost-centre-resolver.service';
|
||||
|
||||
const costCentreRoutes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { CostCentreListComponent } from './cost-centre-list/cost-centre-list.component';
|
||||
import { CostCentreDetailComponent } from './cost-centre-detail/cost-centre-detail.component';
|
||||
import { CostCentreRoutingModule } from './cost-centre-routing.module';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -12,9 +11,10 @@ import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FlexLayoutModule } from '@angular/flex-layout';
|
||||
|
||||
import { CostCentreDetailComponent } from './cost-centre-detail/cost-centre-detail.component';
|
||||
import { CostCentreListComponent } from './cost-centre-list/cost-centre-list.component';
|
||||
import { CostCentreRoutingModule } from './cost-centre-routing.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { catchError } from 'rxjs/operators';
|
||||
|
||||
import { CostCentre } from '../core/cost-centre';
|
||||
import { ErrorLoggerService } from '../core/error-logger.service';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
|
||||
@@ -53,9 +54,8 @@ export class CostCentreService {
|
||||
saveOrUpdate(costCentre: CostCentre): Observable<CostCentre> {
|
||||
if (!costCentre.id) {
|
||||
return this.save(costCentre);
|
||||
} else {
|
||||
return this.update(costCentre);
|
||||
}
|
||||
return this.update(costCentre);
|
||||
}
|
||||
|
||||
delete(id: string): Observable<CostCentre> {
|
||||
|
||||
Reference in new issue
Block a user