Strict done!!

This commit is contained in:
2020-11-23 16:42:54 +05:30
parent af343cb7f9
commit afe746ecdc
142 changed files with 1258 additions and 907 deletions
@@ -1,5 +1,5 @@
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
@@ -14,9 +14,9 @@ import { UserService } from '../user.service';
styleUrls: ['./user-detail.component.css'],
})
export class UserDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@ViewChild('nameElement', { static: true }) nameElement?: ElementRef;
form: FormGroup;
item: User;
item: User = new User();
hide: boolean;
constructor(
@@ -46,9 +46,9 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
showItem(item: User) {
this.item = item;
this.form.get('name').setValue(item.name);
this.form.get('password').setValue('');
this.form.get('lockedOut').setValue(item.lockedOut);
(this.form.get('name') as FormControl).setValue(item.name);
(this.form.get('password') as FormControl).setValue('');
(this.form.get('lockedOut') as FormControl).setValue(item.lockedOut);
this.form.setControl(
'roles',
this.fb.array(
@@ -63,7 +63,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
setTimeout(() => {
this.nameElement.nativeElement.focus();
if (this.nameElement) this.nameElement.nativeElement.focus();
}, 0);
}
@@ -92,7 +92,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
}
delete() {
this.ser.delete(this.item.id).subscribe(
this.ser.delete(this.item.id as string).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
@@ -15,8 +15,8 @@ import { UserListDataSource } from './user-list-datasource';
export class UserListComponent implements OnInit {
@ViewChild(MatPaginator, { static: true }) paginator?: MatPaginator = undefined;
@ViewChild(MatSort, { static: true }) sort?: MatSort = undefined;
dataSource: UserListDataSource;
list: User[];
list: User[] = [];
dataSource: UserListDataSource = new UserListDataSource(this.list);
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['name', 'lockedOut', 'groups'];
@@ -27,6 +27,6 @@ export class UserListComponent implements OnInit {
const data = value as { list: User[] };
this.list = data.list;
});
this.dataSource = new UserListDataSource(this.paginator, this.sort, this.list);
this.dataSource = new UserListDataSource(this.list, this.paginator, this.sort);
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ const serviceName = 'UserService';
export class UserService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
get(id: string): Observable<User> {
get(id: string | null): Observable<User> {
const getUrl: string = id === null ? `${url}` : `${url}/${id}`;
return <Observable<User>>(
this.http