Files
syncthing/src/app/chart/folder-chart/folder-chart.component.ts
T

41 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Component, OnInit, ViewChild } from '@angular/core';
import Folder from '../../folder'
import { cardElevation } from '../../style'
import { FolderService } from 'src/app/folder.service';
import { DonutChartComponent } from '../donut-chart/donut-chart.component';
2020-03-16 12:11:27 -04:00
@Component({
selector: 'app-folder-chart',
templateUrl: './folder-chart.component.html',
styleUrls: ['./folder-chart.component.scss']
})
export class FolderChartComponent implements OnInit {
@ViewChild(DonutChartComponent) donutChart: DonutChartComponent;
chartID: string = 'foldersChart';
elevation: string = cardElevation;
2020-03-18 19:39:25 -04:00
constructor(private folderService: FolderService) { }
2020-03-16 12:11:27 -04:00
ngOnInit(): void {
for (let state in Folder.StateType) {
console.log(state);
}
2020-03-16 12:11:27 -04:00
}
2020-03-16 17:58:20 -04:00
ngAfterViewInit() {
// TODO: Find total number of folders
this.folderService.getAll().subscribe(
folder => {
// TODO: Clear existing data
2020-03-18 19:39:25 -04:00
this.donutChart.data([40]);
// Get StateType and convert to string
const stateType: Folder.StateType = Folder.getStateType(folder);
const state: string = Folder.stateTypeToString(stateType);
console.log("folder state?", state, folder);
}
);
2020-03-16 12:11:27 -04:00
2020-03-16 17:58:20 -04:00
}
2020-03-16 12:11:27 -04:00
}