start of toggle to switch between devices and folders data table
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
import { DataSource } from '@angular/cdk/collections';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
|
||||
import { map } from 'rxjs/operators';
|
||||
import { Observable, of as observableOf, merge } from 'rxjs';
|
||||
import { Folder } from '../folder';
|
||||
import { SystemConfigService } from '../system-config.service';
|
||||
import { FOLDERS } from '../mock-folders';
|
||||
|
||||
/**
|
||||
* Data source for the StatusList view. This class should
|
||||
* encapsulate all logic for fetching and manipulating the displayed data
|
||||
* (including sorting, pagination, and filtering).
|
||||
*/
|
||||
export class StatusListFolderDataSource extends DataSource<Folder> {
|
||||
data: Folder[] = FOLDERS;
|
||||
export class StatusListFolderDataSource extends DataSource<any> {
|
||||
data: any[];
|
||||
paginator: MatPaginator;
|
||||
sort: MatSort;
|
||||
|
||||
constructor(private systemConfigService: SystemConfigService) {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<app-status-toggle></app-status-toggle>
|
||||
<div class="mat-elevation-z8">
|
||||
<table mat-table class="full-width-table" matSort aria-label="Elements">
|
||||
<!-- Id Column -->
|
||||
|
||||
@@ -2,10 +2,12 @@ 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';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-status-list',
|
||||
templateUrl: './status-list.component.html',
|
||||
@@ -23,7 +25,12 @@ export class StatusListComponent implements AfterViewInit, OnInit {
|
||||
constructor(private systemConfigService: SystemConfigService) { };
|
||||
|
||||
ngOnInit() {
|
||||
this.dataSource = new StatusListFolderDataSource(this.systemConfigService);
|
||||
this.dataSource = new StatusListFolderDataSource();
|
||||
this.systemConfigService.getDevices().subscribe(
|
||||
data => {
|
||||
this.dataSource.data = data;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
||||
Reference in New Issue
Block a user