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:
2020-10-10 08:45:05 +05:30
parent 438a98334d
commit 5ea09df272
320 changed files with 2233 additions and 2268 deletions

View File

@ -1,9 +1,15 @@
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 { ProfitLossItem } from './profit-loss';
import { map } from 'rxjs/operators';
import { ProfitLossItem } from './profit-loss-item';
/** 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 ProfitLossDataSource extends DataSource<ProfitLossItem> {
constructor(
@ -21,9 +27,7 @@ export class ProfitLossDataSource extends DataSource<ProfitLossItem> {
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]))),
);
}
@ -56,8 +60,3 @@ export class ProfitLossDataSource extends DataSource<ProfitLossItem> {
});
}
}
/** 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);
}

View File

@ -0,0 +1,6 @@
export class ProfitLossItem {
group: string;
name: string;
amount: number;
total: number;
}

View File

@ -1,6 +1,7 @@
import { Injectable } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve, RouterStateSnapshot } from '@angular/router';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';
import { Observable } from 'rxjs/internal/Observable';
import { ProfitLoss } from './profit-loss';
import { ProfitLossService } from './profit-loss.service';
@ -10,7 +11,7 @@ import { ProfitLossService } from './profit-loss.service';
export class ProfitLossResolver implements Resolve<ProfitLoss> {
constructor(private ser: ProfitLossService) {}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<ProfitLoss> {
resolve(route: ActivatedRouteSnapshot): Observable<ProfitLoss> {
const startDate = route.queryParamMap.get('startDate') || null;
const finishDate = route.queryParamMap.get('finishDate') || null;
return this.ser.list(startDate, finishDate);

View File

@ -1,8 +1,10 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { ProfitLossResolver } from './profit-loss-resolver.service';
import { AuthGuard } from '../auth/auth-guard.service';
import { ProfitLossResolver } from './profit-loss-resolver.service';
import { ProfitLossComponent } from './profit-loss.component';
const profitLossRoutes: Routes = [

View File

@ -4,8 +4,9 @@ import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { ActivatedRoute, Router } from '@angular/router';
import * as moment from 'moment';
import { ProfitLossDataSource } from './profit-loss-datasource';
import { ProfitLoss } from './profit-loss';
import { ProfitLossDataSource } from './profit-loss-datasource';
@Component({
selector: 'app-profit-loss',

View File

@ -1,5 +1,10 @@
import { NgModule } from '@angular/core';
import { A11yModule } from '@angular/cdk/a11y';
import { CdkTableModule } from '@angular/cdk/table';
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { FlexLayoutModule } from '@angular/flex-layout';
import { ReactiveFormsModule } from '@angular/forms';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
@ -18,14 +23,11 @@ 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 { SharedModule } from '../shared/shared.module';
import { ReactiveFormsModule } from '@angular/forms';
import { CdkTableModule } from '@angular/cdk/table';
import { ProfitLossRoutingModule } from './profit-loss-routing.module';
import { ProfitLossComponent } from './profit-loss.component';
import { MomentDateAdapter } from '@angular/material-moment-adapter';
import { A11yModule } from '@angular/cdk/a11y';
import { FlexLayoutModule } from '@angular/flex-layout';
export const MY_FORMATS = {
parse: {

View File

@ -1,13 +1,11 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { catchError } from 'rxjs/operators';
import { Observable } from 'rxjs/internal/Observable';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { ProfitLoss } from './profit-loss';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
const httpOptions = {
headers: new HttpHeaders({ 'Content-Type': 'application/json' }),
};
import { ProfitLoss } from './profit-loss';
const url = '/api/profit-loss';
const serviceName = 'ProfitLossService';
@ -19,11 +17,11 @@ export class ProfitLossService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
list(startDate: string, finishDate): Observable<ProfitLoss> {
startDate = startDate ? `/${startDate}` : '';
finishDate = finishDate ? `/${finishDate}` : '';
const startDateWithSlash = startDate ? `/${startDate}` : '';
const finishDateWithSlash = finishDate ? `/${finishDate}` : '';
return <Observable<ProfitLoss>>(
this.http
.get<ProfitLoss>(`${url}${startDate}${finishDate}`)
.get<ProfitLoss>(`${url}${startDateWithSlash}${finishDateWithSlash}`)
.pipe(catchError(this.log.handleError(serviceName, 'list')))
);
}

View File

@ -1,9 +1,4 @@
export class ProfitLossItem {
group: string;
name: string;
amount: number;
total: number;
}
import { ProfitLossItem } from './profit-loss-item';
export class ProfitLoss {
startDate: string;