Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
|
||||
import { Role } from '../role';
|
||||
|
||||
export class RoleListDataSource extends DataSource<Role> {
|
||||
|
||||
constructor(public data: Role[]) {
|
||||
super();
|
||||
}
|
||||
@@ -12,6 +12,5 @@ export class RoleListDataSource extends DataSource<Role> {
|
||||
return observableOf(this.data);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
</mat-card-title-group>
|
||||
<mat-card-content>
|
||||
<mat-table #table [dataSource]="dataSource" aria-label="Elements">
|
||||
|
||||
<!-- Name Column -->
|
||||
<ng-container matColumnDef="name">
|
||||
<mat-header-cell *matHeaderCellDef>Name</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row"><a [routerLink]="['/roles', row.id]">{{row.name}}</a></mat-cell>
|
||||
<mat-cell *matCellDef="let row"
|
||||
><a [routerLink]="['/roles', row.id]">{{ row.name }}</a></mat-cell
|
||||
>
|
||||
</ng-container>
|
||||
|
||||
<!-- Permissions Column -->
|
||||
@@ -20,13 +21,13 @@
|
||||
<mat-header-cell *matHeaderCellDef>Permissions</mat-header-cell>
|
||||
<mat-cell *matCellDef="let row">
|
||||
<ul>
|
||||
<li *ngFor="let permission of row.permissions">{{permission}}</li>
|
||||
<li *ngFor="let permission of row.permissions">{{ permission }}</li>
|
||||
</ul>
|
||||
</mat-cell>
|
||||
</ng-container>
|
||||
|
||||
<mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns;"></mat-row>
|
||||
<mat-row *matRowDef="let row; columns: displayedColumns"></mat-row>
|
||||
</mat-table>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
|
||||
import {RoleListComponent} from './role-list.component';
|
||||
import { RoleListComponent } from './role-list.component';
|
||||
|
||||
describe('RoleListComponent', () => {
|
||||
let component: RoleListComponent;
|
||||
@@ -8,9 +8,8 @@ describe('RoleListComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [RoleListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [RoleListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(RoleListComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { RoleListDataSource } from './role-list-datasource';
|
||||
import { Role } from '../role';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { Role } from '../role';
|
||||
|
||||
import { RoleListDataSource } from './role-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-role-list',
|
||||
templateUrl: './role-list.component.html',
|
||||
styleUrls: ['./role-list.component.css']
|
||||
styleUrls: ['./role-list.component.css'],
|
||||
})
|
||||
export class RoleListComponent implements OnInit {
|
||||
dataSource: RoleListDataSource;
|
||||
@@ -14,14 +16,12 @@ export class RoleListComponent implements OnInit {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name', 'permissions'];
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: Role[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
this.route.data.subscribe((data: { list: Role[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new RoleListDataSource(this.list);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user