Feature: Lazy loading
Lazy loaded everything TODO: The cash flow module when clicking on sub-links, it reloads the whole page, it needs to be diagnosed and fixed, this problem also exists in the other modules TODO: Rename folders and modules such as account to accounts to match the url
This commit is contained in:
1 parent
fea48e1a3e
commit
72044476a8
184 files changed
+786
-664
No files matched your search
@@ -1,7 +1,7 @@
|
||||
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
|
||||
|
||||
import {CostCentreService} from '../cost-centre.service';
|
||||
import {CostCentre} from '../cost-centre';
|
||||
import {CostCentre} from '../../core/cost-centre';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ToasterService} from '../../core/toaster.service';
|
||||
import {FormBuilder, FormGroup} from '@angular/forms';
|
||||
@@ -57,7 +57,7 @@ export class CostCentreDetailComponent implements OnInit, AfterViewInit {
|
||||
.subscribe(
|
||||
(result) => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/CostCentres');
|
||||
this.router.navigateByUrl('/cost-centres');
|
||||
},
|
||||
(error) => {
|
||||
this.toaster.show('Danger', error.error);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {CostCentre} from './cost-centre';
|
||||
import {CostCentre} from '../core/cost-centre';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
import {CostCentreService} from './cost-centre.service';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ 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 {CostCentre} from '../cost-centre';
|
||||
import {CostCentre} from '../../core/cost-centre';
|
||||
|
||||
export class CostCentreListDataSource extends DataSource<CostCentre> {
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<mat-card>
|
||||
<mat-card-title-group>
|
||||
<mat-card-title>Cost Centers</mat-card-title>
|
||||
<a mat-button [routerLink]="['/CostCentre']">
|
||||
<a mat-button [routerLink]="['/cost-centres', 'new']">
|
||||
<mat-icon>add_box</mat-icon>
|
||||
Add
|
||||
</a>
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef mat-sort-header>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/CostCentre', row.id]">{{row.name}}</a></mat-cell>
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/cost-centres', row.id]">{{row.name}}</a></mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<!-- Name Column -->
|
||||
|
||||
@@ -2,7 +2,7 @@ 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 '../cost-centre';
|
||||
import {CostCentre} from '../../core/cost-centre';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {ActivatedRouteSnapshot, Resolve, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {CostCentreService} from './cost-centre.service';
|
||||
import {CostCentre} from './cost-centre';
|
||||
import {CostCentre} from '../core/cost-centre';
|
||||
import {Observable} from 'rxjs/internal/Observable';
|
||||
|
||||
@Injectable({
|
||||
|
||||
@@ -9,7 +9,7 @@ import {AuthGuard} from '../auth/auth-guard.service';
|
||||
|
||||
const costCentreRoutes: Routes = [
|
||||
{
|
||||
path: 'CostCentres',
|
||||
path: '',
|
||||
component: CostCentreListComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
@@ -20,7 +20,7 @@ const costCentreRoutes: Routes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'CostCentre',
|
||||
path: 'new',
|
||||
component: CostCentreDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
@@ -31,7 +31,7 @@ const costCentreRoutes: Routes = [
|
||||
}
|
||||
},
|
||||
{
|
||||
path: 'CostCentre/:id',
|
||||
path: ':id',
|
||||
component: CostCentreDetailComponent,
|
||||
canActivate: [AuthGuard],
|
||||
data: {
|
||||
|
||||
@@ -3,12 +3,12 @@ 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 {CostCentre} from './cost-centre';
|
||||
import {CostCentre} from '../core/cost-centre';
|
||||
|
||||
const httpOptions = {
|
||||
headers: new HttpHeaders({'Content-Type': 'application/json'})
|
||||
};
|
||||
const url = '/api/CostCentre';
|
||||
const url = '/api/cost-centres';
|
||||
const serviceName = 'CostCentreService';
|
||||
|
||||
@Injectable({
|
||||
@@ -19,7 +19,7 @@ export class CostCentreService {
|
||||
}
|
||||
|
||||
get(id: string): Observable<CostCentre> {
|
||||
const getUrl: string = (id === null) ? url : `${url}/${id}`;
|
||||
const getUrl: string = (id === null) ? `${url}/new` : `${url}/${id}`;
|
||||
return <Observable<CostCentre>>this.http.get<CostCentre>(getUrl)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, `get id=${id}`))
|
||||
@@ -35,7 +35,7 @@ export class CostCentreService {
|
||||
}
|
||||
|
||||
save(costCentre: CostCentre): Observable<CostCentre> {
|
||||
return <Observable<CostCentre>>this.http.post<CostCentre>(url, costCentre, httpOptions)
|
||||
return <Observable<CostCentre>>this.http.post<CostCentre>(`${url}/new`, costCentre, httpOptions)
|
||||
.pipe(
|
||||
catchError(this.log.handleError(serviceName, 'save'))
|
||||
);
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export class CostCentre {
|
||||
id: string;
|
||||
name: string;
|
||||
isFixture: boolean;
|
||||
}
|
||||
Reference in new issue
Block a user