refactor chart and list component structure

This commit is contained in:
Jesse Lucas 2020-03-16 12:11:27 -04:00
parent 37f2f2cdf6
commit eaffbc0f92
27 changed files with 108 additions and 20 deletions

View File

@ -6,22 +6,27 @@ import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
import { MatButtonToggleModule } from '@angular/material/button-toggle';
import { MatCardModule } from '@angular/material/card';
import { FlexLayoutModule } from '@angular/flex-layout';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { StatusListComponent } from './status-list/status-list.component';
import { FolderListComponent } from './folder-list/folder-list.component';
import { DeviceListComponent } from './device-list/device-list.component';
import { StatusListComponent } from './list/status-list/status-list.component';
import { FolderListComponent } from './list/folder-list/folder-list.component';
import { DeviceListComponent } from './list/device-list/device-list.component';
import { DonutChartComponent } from './chart/donut-chart/donut-chart.component';
import { DeviceChartComponent } from './chart/device-chart/device-chart.component';
import { FolderChartComponent } from './chart/folder-chart/folder-chart.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { StatusToggleComponent } from './status-toggle/status-toggle.component';
import { HttpClientInMemoryWebApiModule } from 'angular-in-memory-web-api';
import { InMemoryConfigDataService } from './in-memory-config-data.service';
import { deviceID } from './api-utils';
import { environment } from '../environments/environment';
import { DashboardComponent } from './dashboard/dashboard.component';
import { MatCardModule } from '@angular/material/card';
import { FlexLayoutModule } from '@angular/flex-layout';
import { DonutChartComponent } from './donut-chart/donut-chart.component';
@NgModule({
declarations: [
@ -32,6 +37,8 @@ import { DonutChartComponent } from './donut-chart/donut-chart.component';
StatusToggleComponent,
DashboardComponent,
DonutChartComponent,
DeviceChartComponent,
FolderChartComponent,
],
imports: [
BrowserModule,
@ -41,6 +48,8 @@ import { DonutChartComponent } from './donut-chart/donut-chart.component';
MatPaginatorModule,
MatSortModule,
MatButtonToggleModule,
MatCardModule,
FlexLayoutModule,
HttpClientModule,
HttpClientXsrfModule.withOptions({
headerName: 'X-CSRF-Token-' + deviceID(),
@ -48,8 +57,6 @@ import { DonutChartComponent } from './donut-chart/donut-chart.component';
}),
environment.production ?
[] : HttpClientInMemoryWebApiModule.forRoot(InMemoryConfigDataService, { delay: 200 }),
MatCardModule,
FlexLayoutModule
],
providers: [],
bootstrap: [AppComponent]

View File

@ -0,0 +1 @@
<p>device-chart works!</p>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DeviceChartComponent } from './device-chart.component';
describe('DeviceChartComponent', () => {
let component: DeviceChartComponent;
let fixture: ComponentFixture<DeviceChartComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DeviceChartComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DeviceChartComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-device-chart',
templateUrl: './device-chart.component.html',
styleUrls: ['./device-chart.component.scss']
})
export class DeviceChartComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -26,7 +26,7 @@ export class DonutChartComponent implements OnInit {
data: {
labels: ["Up to Date", "Syncing", "Waiting to Sync", "Out of Sync", "Failed Items"],
datasets: [{
data: [1, 2, 3, 0, 0],
data: [100, 200, 300, 0, 0],
backgroundColor: [
'#56C568',
'rgba(54, 162, 235, 1)',

View File

@ -0,0 +1 @@
<p>folder-chart works!</p>

View File

@ -0,0 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FolderChartComponent } from './folder-chart.component';
describe('FolderChartComponent', () => {
let component: FolderChartComponent;
let fixture: ComponentFixture<FolderChartComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ FolderChartComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FolderChartComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-folder-chart',
templateUrl: './folder-chart.component.html',
styleUrls: ['./folder-chart.component.scss']
})
export class FolderChartComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -4,8 +4,8 @@ import { MatSort } from '@angular/material/sort';
import { map } from 'rxjs/operators';
import { Observable, of as observableOf, merge } from 'rxjs';
import { Device } from '../device';
import { SystemConfigService } from '../system-config.service';
import { Device } from '../../device';
import { SystemConfigService } from '../../system-config.service';
/**
* Data source for the DeviceList view. This class should

View File

@ -4,9 +4,8 @@ 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 { flatMap } from 'rxjs/operators';
import { Device } from '../../device';
import { SystemConfigService } from '../../system-config.service';
@Component({

View File

@ -4,8 +4,8 @@ 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 { Folder } from '../../folder';
import { SystemConfigService } from '../../system-config.service';
/**
* Data source for the FolderList view. This class should

View File

@ -4,8 +4,8 @@ import { MatSort } from '@angular/material/sort';
import { MatTable } from '@angular/material/table';
import { FolderListDataSource } from './folder-list-datasource';
import { Folder } from '../folder';
import { SystemConfigService } from '../system-config.service';
import { Folder } from '../../folder';
import { SystemConfigService } from '../../system-config.service';
@Component({

View File

@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Status } from '../status';
import { Status } from '../../status';
@Component({