create folder and device list components

refactor status-list to contain device and folder list
This commit is contained in:
Jesse Lucas
2020-03-11 21:24:02 -04:00
parent 031fd72dfd
commit 61b4de581d
19 changed files with 2045 additions and 153 deletions
+4 -30
View File
@@ -1,41 +1,15 @@
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 { StatusListFolderDataSource } from './status-list-folder-datasource';
import { Folder } from '../folder';
import { SystemConfigService } from '../system-config.service';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-status-list',
templateUrl: './status-list.component.html',
styleUrls: ['./status-list.component.scss']
})
export class StatusListComponent implements AfterViewInit, OnInit {
@ViewChild(MatPaginator) paginator: MatPaginator;
@ViewChild(MatSort) sort: MatSort;
@ViewChild(MatTable) table: MatTable<Folder>;
dataSource: StatusListFolderDataSource;
export class StatusListComponent implements OnInit {
/** Columns displayed in the table. Columns IDs can be added, removed, or reordered. */
displayedColumns = ['id', 'name'];
constructor() { }
constructor(private systemConfigService: SystemConfigService) { };
ngOnInit() {
this.dataSource = new StatusListFolderDataSource();
this.systemConfigService.getDevices().subscribe(
data => {
this.dataSource.data = data;
}
);
ngOnInit(): void {
}
ngAfterViewInit() {
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
this.table.dataSource = this.dataSource;
}
}