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,6 +1,4 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { RecipeDetailComponent } from './recipe-detail.component';
|
||||
|
||||
@@ -8,14 +6,11 @@ describe('ProductGroupDetailComponent', () => {
|
||||
let component: RecipeDetailComponent;
|
||||
let fixture: ComponentFixture<RecipeDetailComponent>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ReactiveFormsModule, RouterTestingModule],
|
||||
declarations: [RecipeDetailComponent],
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [RecipeDetailComponent],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(RecipeDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -1,7 +1,28 @@
|
||||
import { AsyncPipe, DecimalPipe } from '@angular/common';
|
||||
import { AfterViewInit, Component, ElementRef, OnInit, 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 } 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 } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
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 moment from 'moment';
|
||||
import { BehaviorSubject, Observable, of as observableOf } from 'rxjs';
|
||||
@@ -24,6 +45,41 @@ import { RecipeDetailDatasource } from './recipe-detail-datasource';
|
||||
selector: 'app-product-group-detail',
|
||||
templateUrl: './recipe-detail.component.html',
|
||||
styleUrls: ['./recipe-detail.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitle,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatLabel,
|
||||
MatInput,
|
||||
MatDatepickerInput,
|
||||
MatDatepickerToggle,
|
||||
MatSuffix,
|
||||
MatDatepicker,
|
||||
MatAutocompleteTrigger,
|
||||
MatAutocomplete,
|
||||
MatOption,
|
||||
MatButton,
|
||||
MatTable,
|
||||
MatSort,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatIconButton,
|
||||
MatIcon,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatCardActions,
|
||||
AsyncPipe,
|
||||
DecimalPipe,
|
||||
],
|
||||
})
|
||||
export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('productElement', { static: true }) productElement?: ElementRef;
|
||||
@@ -196,27 +252,27 @@ export class RecipeDetailComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe(
|
||||
() => {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigateByUrl('/recipes');
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
delete() {
|
||||
this.ser.delete(this.item.id as string).subscribe(
|
||||
() => {
|
||||
this.ser.delete(this.item.id as string).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.router.navigate(['/recipes']);
|
||||
},
|
||||
(error) => {
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
confirmDelete(): void {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
|
||||
import { RecipeListComponent } from './recipe-list.component';
|
||||
|
||||
@@ -9,8 +8,7 @@ describe('RoleListComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [RouterTestingModule],
|
||||
declarations: [RecipeListComponent],
|
||||
imports: [RouterTestingModule, RecipeListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RecipeListComponent);
|
||||
|
||||
@@ -1,8 +1,26 @@
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatIconAnchor, MatAnchor } from '@angular/material/button';
|
||||
import { MatCard, MatCardHeader, MatCardTitleGroup, MatCardTitle, MatCardContent } from '@angular/material/card';
|
||||
import { MatOption } from '@angular/material/core';
|
||||
import { MatFormField, MatLabel } from '@angular/material/form-field';
|
||||
import { MatIcon } from '@angular/material/icon';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatSelect } from '@angular/material/select';
|
||||
import { MatSort, MatSortHeader } from '@angular/material/sort';
|
||||
import {
|
||||
MatTable,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
} from '@angular/material/table';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { Period } from 'src/app/period/period';
|
||||
|
||||
@@ -15,6 +33,36 @@ import { RecipeListDatasource } from './recipe-list-datasource';
|
||||
selector: 'app-role-list',
|
||||
templateUrl: './recipe-list.component.html',
|
||||
styleUrls: ['./recipe-list.component.css'],
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCard,
|
||||
MatCardHeader,
|
||||
MatCardTitleGroup,
|
||||
MatCardTitle,
|
||||
MatIconAnchor,
|
||||
MatIcon,
|
||||
MatAnchor,
|
||||
RouterLink,
|
||||
MatCardContent,
|
||||
ReactiveFormsModule,
|
||||
MatFormField,
|
||||
MatSelect,
|
||||
MatOption,
|
||||
MatLabel,
|
||||
MatTable,
|
||||
MatSort,
|
||||
MatColumnDef,
|
||||
MatHeaderCellDef,
|
||||
MatHeaderCell,
|
||||
MatSortHeader,
|
||||
MatCellDef,
|
||||
MatCell,
|
||||
MatHeaderRowDef,
|
||||
MatHeaderRow,
|
||||
MatRowDef,
|
||||
MatRow,
|
||||
MatPaginator,
|
||||
],
|
||||
})
|
||||
export class RecipeListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { RecipeRoutingModule } from './recipe-routing.module';
|
||||
|
||||
describe('RecipeRoutingModule', () => {
|
||||
let recipeRoutingModule: RecipeRoutingModule;
|
||||
|
||||
beforeEach(() => {
|
||||
recipeRoutingModule = new RecipeRoutingModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(recipeRoutingModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
import { RecipeModule } from './recipe.module';
|
||||
|
||||
describe('RoleModule', () => {
|
||||
let roleModule: RecipeModule;
|
||||
|
||||
beforeEach(() => {
|
||||
roleModule = new RecipeModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(roleModule).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
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 } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
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 { SharedModule } from '../shared/shared.module';
|
||||
|
||||
import { RecipeDetailComponent } from './recipe-detail/recipe-detail.component';
|
||||
import { RecipeListComponent } from './recipe-list/recipe-list.component';
|
||||
import { RecipeRoutingModule } from './recipe-routing.module';
|
||||
|
||||
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: [
|
||||
CommonModule,
|
||||
CdkTableModule,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatInputModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSortModule,
|
||||
MatTableModule,
|
||||
ReactiveFormsModule,
|
||||
SharedModule,
|
||||
RecipeRoutingModule,
|
||||
MatAutocompleteModule,
|
||||
MatDatepickerModule,
|
||||
MatSelectModule,
|
||||
],
|
||||
declarations: [RecipeListComponent, RecipeDetailComponent],
|
||||
providers: [
|
||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
|
||||
],
|
||||
})
|
||||
export class RecipeModule {}
|
||||
+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 { periodListResolver } from '../period/period-list.resolver';
|
||||
@@ -11,7 +9,7 @@ import { RecipeListComponent } from './recipe-list/recipe-list.component';
|
||||
import { recipeListResolver } from './recipe-list.resolver';
|
||||
import { recipeResolver } from './recipe.resolver';
|
||||
|
||||
const recipeRoutes: Routes = [
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: RecipeListComponent,
|
||||
@@ -51,9 +49,3 @@ const recipeRoutes: Routes = [
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild(recipeRoutes)],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class RecipeRoutingModule {}
|
||||
Reference in New Issue
Block a user