mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-18 17:23:37 -05:00
Start to reorganize
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<div class="weather-current">
|
||||
<div *ngIf="latestReading === null">
|
||||
Loading...
|
||||
</div>
|
||||
|
||||
<div *ngIf="latestReading !== null">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Temperature
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.HumidityTemperature.toFixed(2) }}°F
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Humidity
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.Humidity.toFixed(2) }}%
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Pressure
|
||||
</td>
|
||||
<td>
|
||||
{{ (latestReading.Pressure / 100).toFixed(2) }} mbar
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Wind
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.WindSpeed.toFixed(2) }} {{ latestReading.WindDirection }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Rain
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.Rain.toFixed(2) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="weather-current-header">
|
||||
Light
|
||||
</td>
|
||||
<td>
|
||||
{{ latestReading.LightLevel.toFixed(2) }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,9 @@
|
||||
.weather-current {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.weather-current-header {
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { WeatherCurrentComponent } from './weather-current.component';
|
||||
|
||||
describe('WeatherCurrentComponent', () => {
|
||||
let component: WeatherCurrentComponent;
|
||||
let fixture: ComponentFixture<WeatherCurrentComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WeatherCurrentComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WeatherCurrentComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { WeatherReading } from '../../../services/weather/weather-reading';
|
||||
import { WeatherService } from '../../../services/weather/weather.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-weather-current',
|
||||
templateUrl: './weather-current.component.html',
|
||||
styleUrls: ['./weather-current.component.scss']
|
||||
})
|
||||
export class WeatherCurrentComponent implements OnInit {
|
||||
|
||||
public latestReading: WeatherReading;
|
||||
|
||||
constructor(private weatherService: WeatherService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.weatherService.getLatestReading().subscribe(r => this.latestReading = r);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user