Blacked and isorted the python files

Prettied and eslinted the typescript/html files
This commit is contained in:
2020-10-11 10:56:29 +05:30
parent b31db593c2
commit d677cfb1ea
505 changed files with 7559 additions and 5649 deletions
@@ -5,31 +5,60 @@
</mat-card-title-group>
<mat-card-content>
<form [formGroup]="form" fxLayout="column">
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Name</mat-label>
<input matInput #nameElement placeholder="Name" formControlName="name">
<input matInput #nameElement placeholder="Name" formControlName="name" />
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-form-field fxFlex>
<mat-label>Password</mat-label>
<input matInput placeholder="Password" formControlName="password" [type]="hide ? 'password' : 'text'">
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility' : 'visibility_off'}}</mat-icon>
</mat-form-field>
<input
matInput
placeholder="Password"
formControlName="password"
[type]="hide ? 'password' : 'text'"
/>
<mat-icon matSuffix (click)="hide = !hide">{{
hide ? 'visibility' : 'visibility_off'
}}</mat-icon>
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<div
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="lockedOut">Is Locked Out?</mat-checkbox>
</div>
<mat-divider></mat-divider>
<div formArrayName="roles">
<div fxLayout="row" *ngFor="let r of item.roles; index as i" [formGroupName]="i" fxLayout="row"
fxLayoutAlign="space-around start" fxLayout.lt-md="column" fxLayoutGap="20px"
fxLayoutGap.lt-md="0px">
<mat-checkbox formControlName="role" fxFlex>{{r.name}}</mat-checkbox>
<div
fxLayout="row"
*ngFor="let r of item.roles; index as i"
[formGroupName]="i"
fxLayout="row"
fxLayoutAlign="space-around start"
fxLayout.lt-md="column"
fxLayoutGap="20px"
fxLayoutGap.lt-md="0px"
>
<mat-checkbox formControlName="role" fxFlex>{{ r.name }}</mat-checkbox>
</div>
</div>
</form>
@@ -1,6 +1,6 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {UserDetailComponent} from './user-detail.component';
import { UserDetailComponent } from './user-detail.component';
describe('UserDetailComponent', () => {
let component: UserDetailComponent;
@@ -8,9 +8,8 @@ describe('UserDetailComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [UserDetailComponent]
})
.compileComponents();
declarations: [UserDetailComponent],
}).compileComponents();
}));
beforeEach(() => {
@@ -1,17 +1,17 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {UserService} from '../user.service';
import {User} from '../../core/user';
import {ToasterService} from '../../core/toaster.service';
import {ConfirmDialogComponent} from '../../shared/confirm-dialog/confirm-dialog.component';
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import {FormArray, FormBuilder, FormGroup} from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { ToasterService } from '../../core/toaster.service';
import { User } from '../../core/user';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { UserService } from '../user.service';
@Component({
selector: 'app-user-detail',
templateUrl: './user-detail.component.html',
styleUrls: ['./user-detail.component.css']
styleUrls: ['./user-detail.component.css'],
})
export class UserDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@@ -25,7 +25,7 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
private fb: FormBuilder,
private toaster: ToasterService,
private dialog: MatDialog,
private ser: UserService
private ser: UserService,
) {
this.hide = true;
this.createForm();
@@ -36,15 +36,14 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
name: '',
password: '',
lockedOut: '',
roles: this.fb.array([])
roles: this.fb.array([]),
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: User }) => {
this.showItem(data.item);
});
this.route.data.subscribe((data: { item: User }) => {
this.showItem(data.item);
});
}
showItem(item: User) {
@@ -52,16 +51,18 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
this.form.get('name').setValue(item.name);
this.form.get('password').setValue('');
this.form.get('lockedOut').setValue(item.lockedOut);
this.form.setControl('roles', this.fb.array(
item.roles.map(
x => this.fb.group({
role: x.enabled
})
)
));
this.form.setControl(
'roles',
this.fb.array(
item.roles.map((x) =>
this.fb.group({
role: x.enabled,
}),
),
),
);
}
ngAfterViewInit() {
setTimeout(() => {
this.nameElement.nativeElement.focus();
@@ -69,35 +70,33 @@ export class UserDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.saveOrUpdate(this.getItem()).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
this.toaster.show('Danger', error.error);
}
);
this.ser.delete(this.item.id).subscribe(
() => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/users');
},
(error) => {
this.toaster.show('Danger', error.error);
},
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete User?', content: 'Are you sure? This cannot be undone.'}
data: { title: 'Delete User?', content: 'Are you sure? This cannot be undone.' },
});
dialogRef.afterClosed().subscribe((result: boolean) => {