From dae1f990a55ebc8903c5c65b98b5c439d7ba4d55 Mon Sep 17 00:00:00 2001 From: Jesse Lucas Date: Mon, 30 Mar 2020 17:02:46 -0400 Subject: [PATCH] Combine types --- src/app/chart.ts | 4 ---- src/app/charts/chart/chart.component.ts | 12 ++++++------ src/app/dashboard/dashboard.component.ts | 6 +++--- src/app/list-toggle/list-toggle.component.html | 4 ++-- src/app/list-toggle/list-toggle.component.ts | 12 ++++++------ src/app/list-type.ts | 4 ---- src/app/lists/status-list/status-list.component.html | 4 ++-- src/app/lists/status-list/status-list.component.ts | 9 +++++---- src/app/type.ts | 4 ++++ 9 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 src/app/chart.ts delete mode 100644 src/app/list-type.ts create mode 100644 src/app/type.ts diff --git a/src/app/chart.ts b/src/app/chart.ts deleted file mode 100644 index b6145574c..000000000 --- a/src/app/chart.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const enum ChartType { - Folder = 0, - Device -} \ No newline at end of file diff --git a/src/app/charts/chart/chart.component.ts b/src/app/charts/chart/chart.component.ts index 32d1c3bcb..dd7beb3fe 100644 --- a/src/app/charts/chart/chart.component.ts +++ b/src/app/charts/chart/chart.component.ts @@ -5,7 +5,7 @@ import { FolderService } from 'src/app/services/folder.service'; import { DonutChartComponent } from '../donut-chart/donut-chart.component'; import { DeviceService } from 'src/app/services/device.service'; import Device from 'src/app/device'; -import { ChartType } from '../../chart'; +import { Type } from '../../type'; @@ -17,7 +17,7 @@ import { ChartType } from '../../chart'; export class ChartComponent implements OnInit { @ViewChild(DonutChartComponent) donutChart: DonutChartComponent; - @Input() type: ChartType; + @Input() type: Type; title: string; chartID: string; states: { label: string, count: number, color: string }[] = []; @@ -29,12 +29,12 @@ export class ChartComponent implements OnInit { ngOnInit(): void { switch (this.type) { - case ChartType.Folder: + case Type.Folder: this.title = "Folders"; this.chartID = 'foldersChart'; this.service = this.folderService; break; - case ChartType.Device: + case Type.Device: this.title = "Devices"; this.chartID = 'devicesChart'; this.service = this.deviceServce; @@ -55,12 +55,12 @@ export class ChartComponent implements OnInit { let state: string; let color; switch (this.type) { - case ChartType.Folder: + case Type.Folder: stateType = Folder.getStateType(folder); state = Folder.stateTypeToString(stateType); color = Folder.stateTypeToColor(stateType); break; - case ChartType.Device: + case Type.Device: stateType = Device.getStateType(folder); state = Device.stateTypeToString(stateType); color = Device.stateTypeToColor(stateType); diff --git a/src/app/dashboard/dashboard.component.ts b/src/app/dashboard/dashboard.component.ts index 30d8f6729..7a956f569 100644 --- a/src/app/dashboard/dashboard.component.ts +++ b/src/app/dashboard/dashboard.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { SystemConfigService } from '../services/system-config.service'; -import { ChartType } from '../chart'; +import { Type } from '../type'; @Component({ selector: 'app-dashboard', @@ -8,8 +8,8 @@ import { ChartType } from '../chart'; styleUrls: ['./dashboard.component.scss'] }) export class DashboardComponent { - folderChart: ChartType = ChartType.Folder; - deviceChart: ChartType = ChartType.Device; + folderChart: Type = Type.Folder; + deviceChart: Type = Type.Device; constructor(private systemConfigService: SystemConfigService) { } diff --git a/src/app/list-toggle/list-toggle.component.html b/src/app/list-toggle/list-toggle.component.html index 16b2bec0d..f360d7f5d 100644 --- a/src/app/list-toggle/list-toggle.component.html +++ b/src/app/list-toggle/list-toggle.component.html @@ -1,4 +1,4 @@ - Folders - Devices + Folders + Devices \ No newline at end of file diff --git a/src/app/list-toggle/list-toggle.component.ts b/src/app/list-toggle/list-toggle.component.ts index db5d523f3..e1f3e6a0e 100644 --- a/src/app/list-toggle/list-toggle.component.ts +++ b/src/app/list-toggle/list-toggle.component.ts @@ -1,5 +1,5 @@ import { Component, EventEmitter, OnInit, Output } from '@angular/core'; -import { ListType } from '../list-type'; +import { Type } from '../type'; @@ -10,20 +10,20 @@ import { ListType } from '../list-type'; }) export class ListToggleComponent implements OnInit { - public listType = ListType; - @Output() listTypeEvent = new EventEmitter(); + public listType = Type; + @Output() listTypeEvent = new EventEmitter(); constructor() { } ngOnInit(): void { } - onSelect(t: ListType): void { + onSelect(t: Type): void { this.listTypeEvent.emit(t); switch (t) { - case ListType.Folders: + case Type.Folder: console.log("folder action"); break; - case ListType.Devices: + case Type.Device: console.log("Device action"); break; } diff --git a/src/app/list-type.ts b/src/app/list-type.ts deleted file mode 100644 index 9aa953a9c..000000000 --- a/src/app/list-type.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum ListType { - Folders = 1, - Devices, -} \ No newline at end of file diff --git a/src/app/lists/status-list/status-list.component.html b/src/app/lists/status-list/status-list.component.html index 8fd9d2fa6..8783944a5 100644 --- a/src/app/lists/status-list/status-list.component.html +++ b/src/app/lists/status-list/status-list.component.html @@ -4,7 +4,7 @@
- - + +
\ No newline at end of file diff --git a/src/app/lists/status-list/status-list.component.ts b/src/app/lists/status-list/status-list.component.ts index b0ad877c8..910ca4798 100644 --- a/src/app/lists/status-list/status-list.component.ts +++ b/src/app/lists/status-list/status-list.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { ListType } from '../../list-type'; +import { Type } from '../../type'; import { cardElevation } from '../../style'; @@ -9,17 +9,18 @@ import { cardElevation } from '../../style'; styleUrls: ['./status-list.component.scss'] }) export class StatusListComponent implements OnInit { - currentListType: ListType = ListType.Folders; - listType = ListType; // used in html + currentListType: Type = Type.Folder; + listType = Type; // used in html elevation: string = cardElevation; title: string = 'Status'; + folderList: Type = Type.Folder; constructor() { } ngOnInit(): void { } - onToggle(t: ListType) { + onToggle(t: Type) { this.currentListType = t; } } diff --git a/src/app/type.ts b/src/app/type.ts new file mode 100644 index 000000000..ac23f2e66 --- /dev/null +++ b/src/app/type.ts @@ -0,0 +1,4 @@ +export enum Type { + Folder = 1, + Device, +} \ No newline at end of file