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 { Section} from '../../core/section';
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
|
||||
import { Section } from '../../core/section';
|
||||
|
||||
export class SectionListDataSource extends DataSource<Section> {
|
||||
|
||||
constructor(public data: Section[]) {
|
||||
super();
|
||||
}
|
||||
@ -12,6 +12,5 @@ export class SectionListDataSource extends DataSource<Section> {
|
||||
return observableOf(this.data);
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
}
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
@ -8,15 +8,16 @@
|
||||
</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]="['/sections', row.id]">{{row.name}}</a></mat-cell>
|
||||
</ng-container>
|
||||
<mat-cell *matCellDef="let row"
|
||||
><a [routerLink]="['/sections', row.id]">{{ row.name }}</a></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 {SectionListComponent} from './section-list.component';
|
||||
import { SectionListComponent } from './section-list.component';
|
||||
|
||||
describe('SectionListComponent', () => {
|
||||
let component: SectionListComponent;
|
||||
@ -8,9 +8,8 @@ describe('SectionListComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [SectionListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
declarations: [SectionListComponent],
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(SectionListComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { SectionListDataSource } from './section-list-datasource';
|
||||
import { Section } from '../../core/section';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { Section } from '../../core/section';
|
||||
|
||||
import { SectionListDataSource } from './section-list-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-section-list',
|
||||
templateUrl: './section-list.component.html',
|
||||
styleUrls: ['./section-list.component.css']
|
||||
styleUrls: ['./section-list.component.css'],
|
||||
})
|
||||
export class SectionListComponent implements OnInit {
|
||||
dataSource: SectionListDataSource;
|
||||
@ -14,14 +16,12 @@ export class SectionListComponent implements OnInit {
|
||||
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
|
||||
displayedColumns = ['name'];
|
||||
|
||||
constructor(private route: ActivatedRoute) {
|
||||
}
|
||||
constructor(private route: ActivatedRoute) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { list: Section[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
this.route.data.subscribe((data: { list: Section[] }) => {
|
||||
this.list = data.list;
|
||||
});
|
||||
this.dataSource = new SectionListDataSource(this.list);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user