diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 9044d6a2c..4428ad605 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -13,12 +13,12 @@ import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-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 { StatusListComponent } from './lists/status-list/status-list.component';
+import { FolderListComponent } from './lists/folder-list/folder-list.component';
+import { DeviceListComponent } from './lists/device-list/device-list.component';
+import { DonutChartComponent } from './charts/donut-chart/donut-chart.component';
+import { DeviceChartComponent } from './charts/device-chart/device-chart.component';
+import { FolderChartComponent } from './charts/folder-chart/folder-chart.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { ListToggleComponent } from './list-toggle/list-toggle.component';
@@ -27,7 +27,7 @@ import { InMemoryConfigDataService } from './in-memory-config-data.service';
import { deviceID } from './api-utils';
import { environment } from '../environments/environment';
-import { ChartItemComponent } from './chart/chart-item/chart-item.component';
+import { ChartItemComponent } from './charts/chart-item/chart-item.component';
@NgModule({
declarations: [
diff --git a/src/app/chart/device-chart/device-chart.component.html b/src/app/chart/device-chart/device-chart.component.html
deleted file mode 100644
index 05e1b4422..000000000
--- a/src/app/chart/device-chart/device-chart.component.html
+++ /dev/null
@@ -1,6 +0,0 @@
-
- Devices
-
-
-
-
\ No newline at end of file
diff --git a/src/app/chart/device-chart/device-chart.component.ts b/src/app/chart/device-chart/device-chart.component.ts
deleted file mode 100644
index 7f47023e3..000000000
--- a/src/app/chart/device-chart/device-chart.component.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { Component, OnInit, ViewChild } from '@angular/core';
-import { cardElevation } from '../../style';
-import { SystemConfigService } from 'src/app/system-config.service';
-import { DonutChartComponent } from '../donut-chart/donut-chart.component';
-
-@Component({
- selector: 'app-device-chart',
- templateUrl: './device-chart.component.html',
- styleUrls: ['./device-chart.component.scss']
-})
-export class DeviceChartComponent implements OnInit {
- @ViewChild(DonutChartComponent) donutChart: DonutChartComponent;
-
- chartID: string = 'devicesChart';
- elevation: string = cardElevation;
-
- constructor(private systemConfigService: SystemConfigService) { }
-
- ngOnInit(): void {
-
- }
-
- ngAfterViewInit(): void {
- this.systemConfigService.getDevices().subscribe(
- devices => {
- this.donutChart.data([0, 230, 32, 40]);
- }
- );
- }
-}
diff --git a/src/app/chart/chart-item/chart-item.component.html b/src/app/charts/chart-item/chart-item.component.html
similarity index 100%
rename from src/app/chart/chart-item/chart-item.component.html
rename to src/app/charts/chart-item/chart-item.component.html
diff --git a/src/app/chart/chart-item/chart-item.component.scss b/src/app/charts/chart-item/chart-item.component.scss
similarity index 100%
rename from src/app/chart/chart-item/chart-item.component.scss
rename to src/app/charts/chart-item/chart-item.component.scss
diff --git a/src/app/chart/chart-item/chart-item.component.spec.ts b/src/app/charts/chart-item/chart-item.component.spec.ts
similarity index 100%
rename from src/app/chart/chart-item/chart-item.component.spec.ts
rename to src/app/charts/chart-item/chart-item.component.spec.ts
diff --git a/src/app/chart/chart-item/chart-item.component.ts b/src/app/charts/chart-item/chart-item.component.ts
similarity index 100%
rename from src/app/chart/chart-item/chart-item.component.ts
rename to src/app/charts/chart-item/chart-item.component.ts
diff --git a/src/app/charts/device-chart/device-chart.component.html b/src/app/charts/device-chart/device-chart.component.html
new file mode 100644
index 000000000..077cf3e01
--- /dev/null
+++ b/src/app/charts/device-chart/device-chart.component.html
@@ -0,0 +1,12 @@
+
+ Devices
+
+
+
+
\ No newline at end of file
diff --git a/src/app/chart/device-chart/device-chart.component.scss b/src/app/charts/device-chart/device-chart.component.scss
similarity index 100%
rename from src/app/chart/device-chart/device-chart.component.scss
rename to src/app/charts/device-chart/device-chart.component.scss
diff --git a/src/app/chart/device-chart/device-chart.component.spec.ts b/src/app/charts/device-chart/device-chart.component.spec.ts
similarity index 100%
rename from src/app/chart/device-chart/device-chart.component.spec.ts
rename to src/app/charts/device-chart/device-chart.component.spec.ts
diff --git a/src/app/charts/device-chart/device-chart.component.ts b/src/app/charts/device-chart/device-chart.component.ts
new file mode 100644
index 000000000..2bd4644a6
--- /dev/null
+++ b/src/app/charts/device-chart/device-chart.component.ts
@@ -0,0 +1,46 @@
+import { Component, OnInit, ViewChild } from '@angular/core';
+import { cardElevation } from '../../style';
+import { DonutChartComponent } from '../donut-chart/donut-chart.component';
+import Folder from '../../folder'
+import { FolderService } from 'src/app/folder.service';
+
+@Component({
+ selector: 'app-device-chart',
+ templateUrl: './device-chart.component.html',
+ styleUrls: ['./device-chart.component.scss']
+})
+export class DeviceChartComponent implements OnInit {
+ @ViewChild(DonutChartComponent) donutChart: DonutChartComponent;
+ chartID: string = 'devicesChart';
+ elevation: string = cardElevation;
+ states: Map;
+
+ constructor(private folderService: FolderService) {
+ this.states = new Map();
+ }
+
+ ngOnInit(): void {
+
+ }
+
+ ngAfterViewInit(): void {
+ // TODO switch to deviceService
+ this.folderService.getAll().subscribe(
+ folder => {
+ // TODO: Clear existing data
+ this.donutChart.data([10]);
+
+ // Get StateType and convert to string
+ const stateType: Folder.StateType = Folder.getStateType(folder);
+ const state: string = Folder.stateTypeToString(stateType);
+
+ // Instantiate empty count states
+ if (!this.states.has(state)) {
+ this.states.set(state, 0);
+ }
+ const count: number = this.states.get(state) + 1;
+ this.states.set(state, count);
+ }
+ );
+ }
+}
diff --git a/src/app/chart/donut-chart/donut-chart.component.html b/src/app/charts/donut-chart/donut-chart.component.html
similarity index 100%
rename from src/app/chart/donut-chart/donut-chart.component.html
rename to src/app/charts/donut-chart/donut-chart.component.html
diff --git a/src/app/chart/donut-chart/donut-chart.component.scss b/src/app/charts/donut-chart/donut-chart.component.scss
similarity index 100%
rename from src/app/chart/donut-chart/donut-chart.component.scss
rename to src/app/charts/donut-chart/donut-chart.component.scss
diff --git a/src/app/chart/donut-chart/donut-chart.component.spec.ts b/src/app/charts/donut-chart/donut-chart.component.spec.ts
similarity index 100%
rename from src/app/chart/donut-chart/donut-chart.component.spec.ts
rename to src/app/charts/donut-chart/donut-chart.component.spec.ts
diff --git a/src/app/chart/donut-chart/donut-chart.component.ts b/src/app/charts/donut-chart/donut-chart.component.ts
similarity index 100%
rename from src/app/chart/donut-chart/donut-chart.component.ts
rename to src/app/charts/donut-chart/donut-chart.component.ts
diff --git a/src/app/chart/folder-chart/folder-chart.component.html b/src/app/charts/folder-chart/folder-chart.component.html
similarity index 100%
rename from src/app/chart/folder-chart/folder-chart.component.html
rename to src/app/charts/folder-chart/folder-chart.component.html
diff --git a/src/app/chart/folder-chart/folder-chart.component.scss b/src/app/charts/folder-chart/folder-chart.component.scss
similarity index 100%
rename from src/app/chart/folder-chart/folder-chart.component.scss
rename to src/app/charts/folder-chart/folder-chart.component.scss
diff --git a/src/app/chart/folder-chart/folder-chart.component.spec.ts b/src/app/charts/folder-chart/folder-chart.component.spec.ts
similarity index 100%
rename from src/app/chart/folder-chart/folder-chart.component.spec.ts
rename to src/app/charts/folder-chart/folder-chart.component.spec.ts
diff --git a/src/app/chart/folder-chart/folder-chart.component.ts b/src/app/charts/folder-chart/folder-chart.component.ts
similarity index 97%
rename from src/app/chart/folder-chart/folder-chart.component.ts
rename to src/app/charts/folder-chart/folder-chart.component.ts
index 3b3689d0c..0b2079970 100644
--- a/src/app/chart/folder-chart/folder-chart.component.ts
+++ b/src/app/charts/folder-chart/folder-chart.component.ts
@@ -26,7 +26,6 @@ export class FolderChartComponent implements OnInit {
}
ngAfterViewInit() {
- // TODO: Find total number of folders
this.folderService.getAll().subscribe(
folder => {
// TODO: Clear existing data
@@ -44,6 +43,5 @@ export class FolderChartComponent implements OnInit {
this.states.set(state, count);
}
);
-
}
}
diff --git a/src/app/list/device-list/device-list-datasource.ts b/src/app/lists/device-list/device-list-datasource.ts
similarity index 100%
rename from src/app/list/device-list/device-list-datasource.ts
rename to src/app/lists/device-list/device-list-datasource.ts
diff --git a/src/app/list/device-list/device-list.component.html b/src/app/lists/device-list/device-list.component.html
similarity index 100%
rename from src/app/list/device-list/device-list.component.html
rename to src/app/lists/device-list/device-list.component.html
diff --git a/src/app/list/device-list/device-list.component.scss b/src/app/lists/device-list/device-list.component.scss
similarity index 100%
rename from src/app/list/device-list/device-list.component.scss
rename to src/app/lists/device-list/device-list.component.scss
diff --git a/src/app/list/device-list/device-list.component.spec.ts b/src/app/lists/device-list/device-list.component.spec.ts
similarity index 100%
rename from src/app/list/device-list/device-list.component.spec.ts
rename to src/app/lists/device-list/device-list.component.spec.ts
diff --git a/src/app/list/device-list/device-list.component.ts b/src/app/lists/device-list/device-list.component.ts
similarity index 100%
rename from src/app/list/device-list/device-list.component.ts
rename to src/app/lists/device-list/device-list.component.ts
diff --git a/src/app/list/folder-list/folder-list-datasource.ts b/src/app/lists/folder-list/folder-list-datasource.ts
similarity index 100%
rename from src/app/list/folder-list/folder-list-datasource.ts
rename to src/app/lists/folder-list/folder-list-datasource.ts
diff --git a/src/app/list/folder-list/folder-list.component.html b/src/app/lists/folder-list/folder-list.component.html
similarity index 100%
rename from src/app/list/folder-list/folder-list.component.html
rename to src/app/lists/folder-list/folder-list.component.html
diff --git a/src/app/list/folder-list/folder-list.component.scss b/src/app/lists/folder-list/folder-list.component.scss
similarity index 100%
rename from src/app/list/folder-list/folder-list.component.scss
rename to src/app/lists/folder-list/folder-list.component.scss
diff --git a/src/app/list/folder-list/folder-list.component.spec.ts b/src/app/lists/folder-list/folder-list.component.spec.ts
similarity index 100%
rename from src/app/list/folder-list/folder-list.component.spec.ts
rename to src/app/lists/folder-list/folder-list.component.spec.ts
diff --git a/src/app/list/folder-list/folder-list.component.ts b/src/app/lists/folder-list/folder-list.component.ts
similarity index 100%
rename from src/app/list/folder-list/folder-list.component.ts
rename to src/app/lists/folder-list/folder-list.component.ts
diff --git a/src/app/list/status-list/status-list.component.html b/src/app/lists/status-list/status-list.component.html
similarity index 100%
rename from src/app/list/status-list/status-list.component.html
rename to src/app/lists/status-list/status-list.component.html
diff --git a/src/app/list/status-list/status-list.component.scss b/src/app/lists/status-list/status-list.component.scss
similarity index 100%
rename from src/app/list/status-list/status-list.component.scss
rename to src/app/lists/status-list/status-list.component.scss
diff --git a/src/app/list/status-list/status-list.component.spec.ts b/src/app/lists/status-list/status-list.component.spec.ts
similarity index 100%
rename from src/app/list/status-list/status-list.component.spec.ts
rename to src/app/lists/status-list/status-list.component.spec.ts
diff --git a/src/app/list/status-list/status-list.component.ts b/src/app/lists/status-list/status-list.component.ts
similarity index 100%
rename from src/app/list/status-list/status-list.component.ts
rename to src/app/lists/status-list/status-list.component.ts
diff --git a/src/app/mock/mock-config.ts b/src/app/mocks/mock-config.ts
similarity index 100%
rename from src/app/mock/mock-config.ts
rename to src/app/mocks/mock-config.ts
diff --git a/src/app/mock/mock-db-status.ts b/src/app/mocks/mock-db-status.ts
similarity index 100%
rename from src/app/mock/mock-db-status.ts
rename to src/app/mocks/mock-db-status.ts