Chore: Eslint v9
Chore: Angular Zoneless Chore: Removed Angular-Hotkeys dependency Fix: Localization works properly now Chore: Using Material 3 theme now Chore: Removed toaster service to use snackbar directly Fix: F2 Date working on all components now
This commit is contained in:
@@ -9,7 +9,7 @@ import { MatFormField, MatLabel } from '@angular/material/form-field';
|
||||
import { MatInput } from '@angular/material/input';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../../core/toaster.service';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
|
||||
import { Role } from '../role';
|
||||
import { RoleService } from '../role.service';
|
||||
@@ -35,7 +35,7 @@ import { RoleService } from '../role.service';
|
||||
],
|
||||
})
|
||||
export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
|
||||
@ViewChild('nameElement', { static: true }) nameElement!: ElementRef<HTMLInputElement>;
|
||||
form: FormGroup<{
|
||||
name: FormControl<string | null>;
|
||||
permissions: FormArray<
|
||||
@@ -50,7 +50,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private toaster: ToasterService,
|
||||
private snackBar: MatSnackBar,
|
||||
private dialog: MatDialog,
|
||||
private ser: RoleService,
|
||||
) {
|
||||
@@ -79,20 +79,18 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
|
||||
ngAfterViewInit() {
|
||||
setTimeout(() => {
|
||||
if (this.nameElement) {
|
||||
this.nameElement.nativeElement.focus();
|
||||
}
|
||||
this.nameElement.nativeElement.focus();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
save() {
|
||||
this.ser.saveOrUpdate(this.getItem()).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.snackBar.open('', 'Success');
|
||||
this.router.navigateByUrl('/roles');
|
||||
},
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
this.snackBar.open(error, 'Danger');
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -100,11 +98,11 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
|
||||
delete() {
|
||||
this.ser.delete(this.item.id as string).subscribe({
|
||||
next: () => {
|
||||
this.toaster.show('Success', '');
|
||||
this.snackBar.open('', 'Success');
|
||||
this.router.navigateByUrl('/roles');
|
||||
},
|
||||
error: (error) => {
|
||||
this.toaster.show('Danger', error);
|
||||
this.snackBar.open(error, 'Danger');
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -52,10 +52,10 @@ import { RoleListDatasource } from './role-list-datasource';
|
||||
],
|
||||
})
|
||||
export class RoleListComponent implements OnInit {
|
||||
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort?: MatSort;
|
||||
@ViewChild(MatPaginator, { static: true }) paginator!: MatPaginator;
|
||||
@ViewChild(MatSort, { static: true }) sort!: MatSort;
|
||||
list: Role[] = [];
|
||||
dataSource: RoleListDatasource = new RoleListDatasource(this.list);
|
||||
dataSource: RoleListDatasource = new RoleListDatasource(this.list, this.paginator, this.sort);
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'permissions'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user