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