mirror of
https://github.com/ckaczor/HomeMonitor.git
synced 2026-01-16 17:23:24 -05:00
Start to reorganize
This commit is contained in:
24
Display/src/app/components/laundry/laundry.component.html
Normal file
24
Display/src/app/components/laundry/laundry.component.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<div class="laundry-current">
|
||||
<div *ngIf="latestStatus === null">
|
||||
Loading...
|
||||
</div>
|
||||
<div *ngIf="latestStatus !== null">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="laundry-current-header">
|
||||
Washer
|
||||
</td>
|
||||
<td [ngClass]="latestStatus.washer.toString()">
|
||||
{{ latestStatus.washer ? 'On' : 'Off' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="laundry-current-header">
|
||||
Dryer
|
||||
</td>
|
||||
<td [ngClass]="latestStatus.dryer.toString()">
|
||||
{{ latestStatus.dryer ? 'On' : 'Off' }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
17
Display/src/app/components/laundry/laundry.component.scss
Normal file
17
Display/src/app/components/laundry/laundry.component.scss
Normal file
@@ -0,0 +1,17 @@
|
||||
.laundry-current {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.laundry-current-header {
|
||||
font-weight: 500;
|
||||
text-align: right;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
.true {
|
||||
color: darkgoldenrod;
|
||||
}
|
||||
|
||||
.false {
|
||||
color: darkgreen;
|
||||
}
|
||||
25
Display/src/app/components/laundry/laundry.component.spec.ts
Normal file
25
Display/src/app/components/laundry/laundry.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { LaundryComponent } from './laundry.component';
|
||||
|
||||
describe('LaundryComponent', () => {
|
||||
let component: LaundryComponent;
|
||||
let fixture: ComponentFixture<LaundryComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ LaundryComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(LaundryComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
17
Display/src/app/components/laundry/laundry.component.ts
Normal file
17
Display/src/app/components/laundry/laundry.component.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { LaundryService } from '../../services/laundry/laundry.service';
|
||||
import { LaundryStatus } from '../../services/laundry/laundry-status';
|
||||
|
||||
@Component({
|
||||
selector: 'app-laundry',
|
||||
templateUrl: './laundry.component.html',
|
||||
styleUrls: ['./laundry.component.scss']
|
||||
})
|
||||
export class LaundryComponent implements OnInit {
|
||||
public latestStatus: LaundryStatus;
|
||||
constructor(private laundryService: LaundryService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.laundryService.getLatestStatus().subscribe(s => this.latestStatus = s);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user