Chore: Check for deprecations using eslint plugin
Chore: environment file replacement stopped. Chore: All components are now standalone and removed all modules Chore: App routing is now in app.routes and similarly for all submodules Chore: Http interceptors are now functional and split refresh interceptor into a separate one.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IssueDialogComponent } from './issue-dialog.component';
|
||||
|
||||
@@ -6,13 +6,11 @@ describe('IssueDialogComponent', () => {
|
||||
let component: IssueDialogComponent;
|
||||
let fixture: ComponentFixture<IssueDialogComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [IssueDialogComponent],
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [IssueDialogComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(IssueDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
|
||||
import { MatButton } from '@angular/material/button';
|
||||
import { MatOption } from '@angular/material/core';
|
||||
import {
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogRef,
|
||||
MatDialogTitle,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose,
|
||||
} from '@angular/material/dialog';
|
||||
import { MatFormField, MatLabel } from '@angular/material/form-field';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
|
||||
|
||||
@@ -14,6 +27,23 @@ import { MathService } from '../shared/math.service';
|
||||
selector: 'app-issue-dialog',
|
||||
templateUrl: './issue-dialog.component.html',
|
||||
styleUrls: ['./issue-dialog.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatDialogTitle,
|
||||
CdkScrollable,
|
||||
MatDialogContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatAutocompleteTrigger,
|
||||
MatAutocomplete,
|
||||
MatOption,
|
||||
MatDialogActions,
|
||||
MatButton,
|
||||
MatDialogClose,
|
||||
AsyncPipe,
|
||||
],
|
||||
})
|
||||
export class IssueDialogComponent implements OnInit {
|
||||
batches: Observable<Batch[]>;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { IssueRoutingModule } from './issue-routing.module';
|
||||
|
||||
describe('IssueRoutingModule', () => {
|
||||
let issueRoutingModule: IssueRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
issueRoutingModule = new IssueRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(issueRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,4 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { IssueComponent } from './issue.component';
|
||||
|
||||
@@ -9,14 +6,11 @@ describe('IssueComponent', () => {
|
||||
let component: IssueComponent;
|
||||
let fixture: ComponentFixture<IssueComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MatDialogModule, ReactiveFormsModule, RouterTestingModule],
|
||||
declarations: [IssueComponent],
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [IssueComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(IssueComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -1,7 +1,36 @@
|
||||
import { AsyncPipe, DecimalPipe, CurrencyPipe } from '@angular/common';
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, OnDestroy, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatAutocompleteSelectedEvent, MatAutocompleteTrigger, MatAutocomplete } from '@angular/material/autocomplete';
|
||||
import { MatButton, MatIconButton } from '@angular/material/button';
|
||||
import {
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
MatCardActions,
|
||||
MatCardFooter,
|
||||
} from '@angular/material/card';
|
||||
import { MatOption } from '@angular/material/core';
|
||||
import { MatDatepickerInput, MatDatepickerToggle, MatDatepicker } from '@angular/material/datepicker';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatFormField, MatLabel, MatSuffix, MatPrefix } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
} from '@angular/material/table';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { Hotkey, HotkeysService } from 'angular2-hotkeys';
|
||||
import { round } from 'mathjs';
|
||||
@@ -20,6 +49,7 @@ import { User } from '../core/user';
|
||||
import { Voucher } from '../core/voucher';
|
||||
import { VoucherService } from '../core/voucher.service';
|
||||
import { ConfirmDialogComponent } from '../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { LocalTimePipe } from '../shared/local-time.pipe';
|
||||
import { MathService } from '../shared/math.service';
|
||||
|
||||
import { IssueDataSource } from './issue-datasource';
|
||||
@@ -31,6 +61,46 @@ import { IssueGridService } from './issue-grid.service';
|
||||
selector: 'app-issue',
|
||||
templateUrl: './issue.component.html',
|
||||
styleUrls: ['./issue.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
MatSelect,
|
||||
MatOption,
|
||||
MatPrefix,
|
||||
MatAutocompleteTrigger,
|
||||
MatAutocomplete,
|
||||
MatButton,
|
||||
MatTable,
|
||||
MatSort,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatIconButton,
|
||||
MatIcon,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatCardActions,
|
||||
MatCardFooter,
|
||||
AsyncPipe,
|
||||
DecimalPipe,
|
||||
CurrencyPipe,
|
||||
LocalTimePipe,
|
||||
],
|
||||
})
|
||||
export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
@ViewChild('batchElement', { static: true }) batchElement?: ElementRef;
|
||||
@@ -263,8 +333,8 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
|
||||
save() {
|
||||
const voucher: Voucher = this.getVoucher();
|
||||
this.ser.saveOrUpdate(voucher).subscribe(
|
||||
(result) => {
|
||||
this.ser.saveOrUpdate(voucher).subscribe({
|
||||
next: (result) => {
|
||||
this.toaster.show('Success', '');
|
||||
if (voucher.id === result.id) {
|
||||
this.loadVoucher(result);
|
||||
@@ -272,10 +342,10 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
this.router.navigate(['/issue', result.id]);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
newVoucher() {
|
||||
@@ -292,15 +362,15 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.voucher.id as string).subscribe(
|
||||
() => {
|
||||
this.ser.delete(this.voucher.id as string).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/issue'], { replaceUrl: true });
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { IssueModule } from './issue.module';
|
||||
|
||||
describe('IssueModule', () => {
|
||||
let issueModule: IssueModule;
|
||||
|
||||
beforeEach(() => {
|
||||
issueModule = new IssueModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(issueModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,73 +0,0 @@
|
||||
import { A11yModule } from '@angular/cdk/a11y';
|
||||
import { CdkTableModule } from '@angular/cdk/table';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, MatNativeDateModule } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatPaginatorModule } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatSortModule } from '@angular/material/sort';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { HotkeyModule } from 'angular2-hotkeys';
|
||||
|
||||
import { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import { IssueDialogComponent } from './issue-dialog.component';
|
||||
import { IssueRoutingModule } from './issue-routing.module';
|
||||
import { IssueComponent } from './issue.component';
|
||||
|
||||
export const MY_FORMATS = {
|
||||
parse: {
|
||||
dateInput: 'DD-MMM-YYYY',
|
||||
},
|
||||
display: {
|
||||
dateInput: 'DD-MMM-YYYY',
|
||||
monthYearLabel: 'MMM YYYY',
|
||||
dateA11yLabel: 'DD-MMM-YYYY',
|
||||
monthYearA11yLabel: 'MMM YYYY',
|
||||
},
|
||||
};
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
A11yModule,
|
||||
CommonModule,
|
||||
CdkTableModule,
|
||||
HotkeyModule,
|
||||
MatAutocompleteModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatDatepickerModule,
|
||||
MatDialogModule,
|
||||
MatFormFieldModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatNativeDateModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
IssueRoutingModule,
|
||||
],
|
||||
declarations: [IssueComponent, IssueDialogComponent],
|
||||
providers: [
|
||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
|
||||
],
|
||||
})
|
||||
export class IssueModule {}
|
||||
+2
-10
@@ -1,6 +1,4 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
import { Routes } from '@angular/router';
|
||||
|
||||
import { authGuard } from '../auth/auth-guard.service';
|
||||
import { costCentreListResolver } from '../cost-centre/cost-centre-list.resolver';
|
||||
@@ -8,7 +6,7 @@ import { costCentreListResolver } from '../cost-centre/cost-centre-list.resolver
|
||||
import { IssueComponent } from './issue.component';
|
||||
import { issueResolver } from './issue.resolver';
|
||||
|
||||
const issueRoutes: Routes = [
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: IssueComponent,
|
||||
@@ -36,9 +34,3 @@ const issueRoutes: Routes = [
|
||||
runGuardsAndResolvers: 'always',
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(issueRoutes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class IssueRoutingModule {}
|
||||
Reference in New Issue
Block a user