build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -7,7 +7,7 @@ import { UntypedFormControl } from '@angular/forms';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { merge } from 'rxjs';
|
||||
import { tap, startWith, map, distinctUntilChanged, debounceTime} from 'rxjs/operators';
|
||||
import { tap, startWith, map, distinctUntilChanged, debounceTime } from 'rxjs/operators';
|
||||
|
||||
/** Custom Services */
|
||||
import { GroupsService } from './groups.service';
|
||||
@@ -29,7 +29,13 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
/** Name form control. */
|
||||
name = new UntypedFormControl();
|
||||
/** Columns to be displayed in groups table. */
|
||||
displayedColumns = ['name', 'accountNo', 'externalId', 'status', 'officeName'];
|
||||
displayedColumns = [
|
||||
'name',
|
||||
'accountNo',
|
||||
'externalId',
|
||||
'status',
|
||||
'officeName'
|
||||
];
|
||||
/** Data source for groups table. */
|
||||
dataSource: GroupsDataSource;
|
||||
/** Groups filter. */
|
||||
@@ -48,7 +54,7 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
/**
|
||||
* @param {GroupsService} groupsService Groups Service
|
||||
*/
|
||||
constructor(private groupsService: GroupsService) { }
|
||||
constructor(private groupsService: GroupsService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.getGroups();
|
||||
@@ -60,7 +66,6 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
* sort change and page change.
|
||||
*/
|
||||
ngAfterViewInit() {
|
||||
|
||||
this.name.valueChanges
|
||||
.pipe(
|
||||
debounceTime(500),
|
||||
@@ -71,12 +76,10 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
)
|
||||
.subscribe();
|
||||
|
||||
this.sort.sortChange.subscribe(() => this.paginator.pageIndex = 0);
|
||||
this.sort.sortChange.subscribe(() => (this.paginator.pageIndex = 0));
|
||||
|
||||
merge(this.sort.sortChange, this.paginator.page)
|
||||
.pipe(
|
||||
tap(() => this.loadGroupsPage())
|
||||
)
|
||||
.pipe(tap(() => this.loadGroupsPage()))
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
@@ -91,7 +94,14 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
if (!this.sort.direction) {
|
||||
delete this.sort.active;
|
||||
}
|
||||
this.dataSource.getGroups(this.filterGroupsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize, !this.showClosedGroups.checked);
|
||||
this.dataSource.getGroups(
|
||||
this.filterGroupsBy,
|
||||
this.sort.active,
|
||||
this.sort.direction,
|
||||
this.paginator.pageIndex,
|
||||
this.paginator.pageSize,
|
||||
!this.showClosedGroups.checked
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,7 +111,7 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
applyFilter(filterValue: string, property: string) {
|
||||
this.paginator.pageIndex = 0;
|
||||
const findIndex = this.filterGroupsBy.findIndex(filter => filter.type === property);
|
||||
const findIndex = this.filterGroupsBy.findIndex((filter) => filter.type === property);
|
||||
this.filterGroupsBy[findIndex].value = filterValue;
|
||||
this.loadGroupsPage();
|
||||
}
|
||||
@@ -111,7 +121,12 @@ export class GroupsComponent implements OnInit, AfterViewInit {
|
||||
*/
|
||||
getGroups() {
|
||||
this.dataSource = new GroupsDataSource(this.groupsService);
|
||||
this.dataSource.getGroups(this.filterGroupsBy, this.sort.active, this.sort.direction, this.paginator.pageIndex, this.paginator.pageSize);
|
||||
this.dataSource.getGroups(
|
||||
this.filterGroupsBy,
|
||||
this.sort.active,
|
||||
this.sort.direction,
|
||||
this.paginator.pageIndex,
|
||||
this.paginator.pageSize
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user