feat(data): update data module, add new mock data (#1960)

This commit is contained in:
Denis Strigo 2019-01-08 16:17:20 +03:00 committed by GitHub
parent 773c14e74a
commit 47d232b606
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 635 additions and 256 deletions

View file

@ -1,6 +1,7 @@
import {Component, OnDestroy} from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { takeWhile } from 'rxjs/operators' ;
import { SolarService } from '../../@core/data/solar.service';
interface CardSettings {
title: string;
@ -17,6 +18,7 @@ export class DashboardComponent implements OnDestroy {
private alive = true;
solarValue: number;
lightCard: CardSettings = {
title: 'Light',
iconClass: 'nb-lightbulb',
@ -74,12 +76,19 @@ export class DashboardComponent implements OnDestroy {
],
};
constructor(private themeService: NbThemeService) {
constructor(private themeService: NbThemeService,
private solarService: SolarService) {
this.themeService.getJsTheme()
.pipe(takeWhile(() => this.alive))
.subscribe(theme => {
this.statusCards = this.statusCardsByThemes[theme.name];
});
this.solarService.getSolarData()
.pipe(takeWhile(() => this.alive))
.subscribe((data) => {
this.solarValue = data;
});
}
ngOnDestroy() {