Moved from tslint to eslint as tslint was depreciated.

Added prettier and also prettied all the typescript files using prettier

ESLint is using the AirBnB rules which are the most strict to lint the files.
This commit is contained in:
2020-10-01 21:28:12 +05:30
parent 40e79ff949
commit 1350870f9e
545 changed files with 8455 additions and 7036 deletions
@@ -1,17 +1,17 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import {RoleService} from '../role.service';
import {Role} from '../role';
import {ToasterService} from '../../core/toaster.service';
import {ConfirmDialogComponent} from '../../shared/confirm-dialog/confirm-dialog.component';
import { RoleService } from '../role.service';
import { Role } from '../role';
import { ToasterService } from '../../core/toaster.service';
import { ConfirmDialogComponent } from '../../shared/confirm-dialog/confirm-dialog.component';
import { MatDialog } from '@angular/material/dialog';
import {FormArray, FormBuilder, FormGroup} from '@angular/forms';
import { FormArray, FormBuilder, FormGroup } from '@angular/forms';
@Component({
selector: 'app-role-detail',
templateUrl: './role-detail.component.html',
styleUrls: ['./role-detail.component.css']
styleUrls: ['./role-detail.component.css'],
})
export class RoleDetailComponent implements OnInit, AfterViewInit {
@ViewChild('nameElement', { static: true }) nameElement: ElementRef;
@@ -24,7 +24,7 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
private fb: FormBuilder,
private toaster: ToasterService,
private dialog: MatDialog,
private ser: RoleService
private ser: RoleService,
) {
this.createForm();
}
@@ -32,23 +32,25 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
createForm() {
this.form = this.fb.group({
name: '',
permissions: this.fb.array([])
permissions: this.fb.array([]),
});
}
ngOnInit() {
this.route.data
.subscribe((data: { item: Role }) => {
this.item = data.item;
this.form.get('name').setValue(this.item.name);
this.form.setControl('permissions', this.fb.array(
this.item.permissions.map(
x => this.fb.group({
permission: x.enabled
})
)
));
});
this.route.data.subscribe((data: { item: Role }) => {
this.item = data.item;
this.form.get('name').setValue(this.item.name);
this.form.setControl(
'permissions',
this.fb.array(
this.item.permissions.map((x) =>
this.fb.group({
permission: x.enabled,
}),
),
),
);
});
}
ngAfterViewInit() {
@@ -58,35 +60,33 @@ export class RoleDetailComponent implements OnInit, AfterViewInit {
}
save() {
this.ser.saveOrUpdate(this.getItem())
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/roles');
},
(error) => {
this.toaster.show('Danger', error);
}
);
this.ser.saveOrUpdate(this.getItem()).subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/roles');
},
(error) => {
this.toaster.show('Danger', error);
},
);
}
delete() {
this.ser.delete(this.item.id)
.subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/roles');
},
(error) => {
this.toaster.show('Danger', error);
}
);
this.ser.delete(this.item.id).subscribe(
(result) => {
this.toaster.show('Success', '');
this.router.navigateByUrl('/roles');
},
(error) => {
this.toaster.show('Danger', error);
},
);
}
confirmDelete(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
width: '250px',
data: {title: 'Delete Role?', content: 'Are you sure? This cannot be undone.'}
data: { title: 'Delete Role?', content: 'Are you sure? This cannot be undone.' },
});
dialogRef.afterClosed().subscribe((result: boolean) => {