build: Use prettier for typescript
Stop ignoring .ts files in prettier and fix existing issues.
This commit is contained in:
@@ -8,9 +8,8 @@ describe('AppConfigurationComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AppConfigurationComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [AppConfigurationComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,7 +12,6 @@ import { Component } from '@angular/core';
|
||||
styleUrls: ['./app-configuration.component.scss']
|
||||
})
|
||||
export class AppConfigurationComponent {
|
||||
|
||||
/** Placeholder for languages. */
|
||||
languages: any;
|
||||
/** Placeholder for date formats. */
|
||||
@@ -26,6 +25,5 @@ export class AppConfigurationComponent {
|
||||
/** Placeholder for online banking app fonts. */
|
||||
onlineBankingAppFonts: any;
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,10 @@ const routes: Routes = [
|
||||
},
|
||||
{
|
||||
path: 'view/:id',
|
||||
data: { title: 'View Self Service User', routeResolveBreadcrumb: ['user', 'username'] },
|
||||
data: { title: 'View Self Service User', routeResolveBreadcrumb: [
|
||||
'user',
|
||||
'username'
|
||||
] },
|
||||
resolve: {
|
||||
user: ViewUserResolver
|
||||
},
|
||||
@@ -79,6 +82,7 @@ const routes: Routes = [
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -93,4 +97,4 @@ const routes: Routes = [
|
||||
ViewUserResolver
|
||||
]
|
||||
})
|
||||
export class SelfServiceRoutingModule { }
|
||||
export class SelfServiceRoutingModule {}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('SelfServiceComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ SelfServiceComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SelfServiceComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -12,7 +12,5 @@ import { Component } from '@angular/core';
|
||||
styleUrls: ['./self-service.component.scss']
|
||||
})
|
||||
export class SelfServiceComponent {
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -34,4 +34,4 @@ import { TaskManagementComponent } from './task-management/task-management.compo
|
||||
TaskManagementComponent
|
||||
]
|
||||
})
|
||||
export class SelfServiceModule { }
|
||||
export class SelfServiceModule {}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('TaskManagementComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ TaskManagementComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [TaskManagementComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -6,7 +6,5 @@ import { Component } from '@angular/core';
|
||||
styleUrls: ['./task-management.component.scss']
|
||||
})
|
||||
export class TaskManagementComponent {
|
||||
|
||||
constructor() { }
|
||||
|
||||
constructor() {}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('CreateUserComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ CreateUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [CreateUserComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -20,19 +20,25 @@ export class CreateUserComponent implements OnInit {
|
||||
createUserForm: UntypedFormGroup;
|
||||
|
||||
/** Denotes type of user. */
|
||||
userTypes = ['Existing User', 'New User'];
|
||||
userTypes = [
|
||||
'Existing User',
|
||||
'New User'
|
||||
];
|
||||
/** Radio button group form control for type of user. */
|
||||
userType = new UntypedFormControl(this.userTypes[0]);
|
||||
/** Placeholder for office data. */
|
||||
offices: any[] = [];
|
||||
/** Placeholder for staff data. */
|
||||
staffOptions: any [] = [];
|
||||
staffOptions: any[] = [];
|
||||
/** Placeholder for staff data. */
|
||||
genderOptions: any [] = [];
|
||||
genderOptions: any[] = [];
|
||||
/** Placeholder for client data. */
|
||||
clientData: any [] = [];
|
||||
clientData: any[] = [];
|
||||
/** Placeholder for gender data. */
|
||||
genderData = ['Male', 'Female'];
|
||||
genderData = [
|
||||
'Male',
|
||||
'Female'
|
||||
];
|
||||
/** Minimum date of birth of user allowed. */
|
||||
minDate = new Date(1900, 0, 1);
|
||||
/** Maximum date of birth of user allowed. */
|
||||
@@ -41,10 +47,12 @@ export class CreateUserComponent implements OnInit {
|
||||
/**
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private clientService: ClientsService,
|
||||
private settingsService: SettingsService) {
|
||||
private settingsService: SettingsService
|
||||
) {
|
||||
this.route.data.subscribe((data: { offices: any }) => {
|
||||
this.offices = data.offices;
|
||||
});
|
||||
@@ -62,8 +70,14 @@ export class CreateUserComponent implements OnInit {
|
||||
*/
|
||||
setClientForm() {
|
||||
this.createUserForm = this.formBuilder.group({
|
||||
'officeId': ['', Validators.required],
|
||||
'staffId': ['', Validators.required]
|
||||
officeId: [
|
||||
'',
|
||||
Validators.required
|
||||
],
|
||||
staffId: [
|
||||
'',
|
||||
Validators.required
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -78,5 +92,4 @@ export class CreateUserComponent implements OnInit {
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('EditUserComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ EditUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [EditUserComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -13,7 +13,6 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
styleUrls: ['./edit-user.component.scss']
|
||||
})
|
||||
export class EditUserComponent implements OnInit {
|
||||
|
||||
/** Placeholder for office data. */
|
||||
officeData: any;
|
||||
/** Placeholder for staff data. */
|
||||
@@ -28,10 +27,9 @@ export class EditUserComponent implements OnInit {
|
||||
/**
|
||||
* @param {SettingsService} settingsService Settings Service
|
||||
*/
|
||||
constructor(private settingsService: SettingsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
}
|
||||
constructor(private settingsService: SettingsService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.maxDate = this.settingsService.businessDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,11 +18,10 @@ import { User } from './user.model';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class UserService {
|
||||
|
||||
/**
|
||||
* @param {HttpClient} http Http Client to send requests.
|
||||
*/
|
||||
constructor(private http: HttpClient) { }
|
||||
constructor(private http: HttpClient) {}
|
||||
|
||||
/**
|
||||
* Gets all the self service users.
|
||||
@@ -31,18 +30,17 @@ export class UserService {
|
||||
*/
|
||||
getUsers(): Observable<User[]> {
|
||||
const httpParams = new HttpParams().set('fields', 'id,firstname,lastname,email,officeName,staff');
|
||||
return this.http.get('/users', { params: httpParams })
|
||||
.pipe(
|
||||
map((users: any) => {
|
||||
users.forEach((user: any) => {
|
||||
user.name = `${user.firstname} ${user.lastname}`;
|
||||
user.staff = user.staff ? `${user.staff.firstname} ${user.staff.lastname}` : '';
|
||||
delete user.firstname;
|
||||
delete user.lastname;
|
||||
});
|
||||
return users as User[];
|
||||
})
|
||||
);
|
||||
return this.http.get('/users', { params: httpParams }).pipe(
|
||||
map((users: any) => {
|
||||
users.forEach((user: any) => {
|
||||
user.name = `${user.firstname} ${user.lastname}`;
|
||||
user.staff = user.staff ? `${user.staff.firstname} ${user.staff.lastname}` : '';
|
||||
delete user.firstname;
|
||||
delete user.lastname;
|
||||
});
|
||||
return users as User[];
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,8 +52,6 @@ export class UserService {
|
||||
* TODO: update endpoint once API available
|
||||
*/
|
||||
changePassword(userId: string, passwordObj: any) {
|
||||
|
||||
return this.http.put(`/users/${userId}`, passwordObj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('UsersComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UsersComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [UsersComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -23,11 +23,18 @@ import { User } from './user.model';
|
||||
styleUrls: ['./users.component.scss']
|
||||
})
|
||||
export class UsersComponent implements OnInit {
|
||||
|
||||
/** Self service users. */
|
||||
userData: User[];
|
||||
/** Columns to be displayed in users table. */
|
||||
displayedColumns: string[] = ['select', 'name', 'id', 'email', 'status', 'officeName', 'staff'];
|
||||
displayedColumns: string[] = [
|
||||
'select',
|
||||
'name',
|
||||
'id',
|
||||
'email',
|
||||
'status',
|
||||
'officeName',
|
||||
'staff'
|
||||
];
|
||||
/** Data source for users table. */
|
||||
dataSource: MatTableDataSource<User>;
|
||||
/** Selection model for users table. */
|
||||
@@ -84,9 +91,8 @@ export class UsersComponent implements OnInit {
|
||||
* Toggles selection for all rows of users table.
|
||||
*/
|
||||
masterToggle() {
|
||||
this.isAllSelected() ?
|
||||
this.selection.clear() :
|
||||
this.dataSource.data.forEach((row: User) => this.selection.select(row));
|
||||
this.isAllSelected()
|
||||
? this.selection.clear()
|
||||
: this.dataSource.data.forEach((row: User) => this.selection.select(row));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,9 +8,8 @@ describe('ViewUserComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewUserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [ViewUserComponent]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -18,7 +18,6 @@ import { UserService } from '../user.service';
|
||||
styleUrls: ['./view-user.component.scss']
|
||||
})
|
||||
export class ViewUserComponent {
|
||||
|
||||
/** Self service user. */
|
||||
user: any;
|
||||
|
||||
@@ -30,10 +29,12 @@ export class ViewUserComponent {
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog Dialog reference.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private userService: UserService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog) {
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private userService: UserService,
|
||||
private router: Router,
|
||||
private dialog: MatDialog
|
||||
) {
|
||||
this.route.data.subscribe((data: { user: any }) => {
|
||||
this.user = data.user;
|
||||
});
|
||||
@@ -51,12 +52,11 @@ export class ViewUserComponent {
|
||||
if (response.password && response.repeatPassword) {
|
||||
const password = response.password;
|
||||
const repeatPassword = response.repeatPassword;
|
||||
const data = {password: password, repeatPassword: repeatPassword };
|
||||
const data = { password: password, repeatPassword: repeatPassword };
|
||||
this.userService.changePassword(this.user.id, data).subscribe(() => {
|
||||
this.router.navigate(['/..']);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import { UsersService } from 'app/users/users.service';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ViewUserResolver implements Resolve<Object> {
|
||||
|
||||
/**
|
||||
* @param {UserService} userService Self service user service.
|
||||
*/
|
||||
@@ -29,5 +28,4 @@ export class ViewUserResolver implements Resolve<Object> {
|
||||
resolve(): Observable<User> {
|
||||
return this.userService.getUser('1');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user