Rename folders

This commit is contained in:
Jesse Lucas
2020-03-29 16:51:12 -04:00
parent 7a657bf3c7
commit 03c6fb2f82
35 changed files with 65 additions and 45 deletions
@@ -0,0 +1,49 @@
import { AfterViewInit, Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTable } from '@angular/material/table';
import { DeviceListDataSource } from './device-list-datasource';
import { Device } from '../../device';
import { SystemConfigService } from '../../system-config.service';
import { dataTableElevation } from '../../style';
import { Subject } from 'rxjs';
@Component({
selector: 'app-device-list',
templateUrl: './device-list.component.html',
styleUrls: ['./device-list.component.scss']
})
export class DeviceListComponent implements AfterViewInit, OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable) table: MatTable<Device>;
dataSource: DeviceListDataSource;
elevation: string = dataTableElevation;
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['id', 'name'];
constructor(private systemConfigService: SystemConfigService) { };
ngOnInit() {
this.dataSource = new DeviceListDataSource(this.systemConfigService);
this.dataSource.dataSubject = new Subject<Device[]>()
this.dataSource.data = [];
this.systemConfigService.getDevices().subscribe(
data => {
console.log("get data??", data)
this.dataSource.data = data;
this.dataSource.dataSubject.next(data);
}
);
}
ngAfterViewInit() {
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
this.table.dataSource = this.dataSource;
}
}