diff --git a/src/main/angular/src/app/dashboard/dashboard.component.html b/src/main/angular/src/app/dashboard/dashboard.component.html index 7c5f722..ad84918 100644 --- a/src/main/angular/src/app/dashboard/dashboard.component.html +++ b/src/main/angular/src/app/dashboard/dashboard.component.html @@ -1,6 +1,11 @@ -
- - - -
- Nichts -
+
+
+ +
+
+ + + +
- Nichts -
+
diff --git a/src/main/angular/src/app/dashboard/dashboard.component.ts b/src/main/angular/src/app/dashboard/dashboard.component.ts index 21a314e..2ce3969 100644 --- a/src/main/angular/src/app/dashboard/dashboard.component.ts +++ b/src/main/angular/src/app/dashboard/dashboard.component.ts @@ -12,6 +12,10 @@ import {TunableListComponent} from '../Tunable/tunable-list/tunable-list.compone import {ShutterListComponent} from '../Shutter/shutter-list/shutter-list.component'; import {Subscription, timer} from 'rxjs'; import {NgIf} from '@angular/common'; +import {SearchComponent} from '../shared/search/search.component'; +import {DeviceFilter} from '../Device/DeviceFilter'; +import {TunableFilter} from '../Tunable/TunableFilter'; +import {ShutterFilter} from '../Shutter/ShutterFilter'; @Component({ selector: 'app-dashboard', @@ -22,6 +26,8 @@ import {NgIf} from '@angular/common'; TunableListComponent, ShutterListComponent, NgIf, + SearchComponent, + ], templateUrl: './dashboard.component.html', styleUrl: './dashboard.component.less' @@ -42,19 +48,27 @@ export class DashboardComponent implements OnInit, OnDestroy { protected shuttersShouldBeOpen: boolean = false; + protected search: string = ''; + + private readonly deviceFilter: DeviceFilter = new DeviceFilter(); + + private readonly shutterFilter: ShutterFilter = new ShutterFilter(); + + private readonly tunableFilter: TunableFilter = new TunableFilter(); + constructor( protected readonly deviceService: DeviceService, - protected readonly tunableService: TunableService, protected readonly shutterService: ShutterService, + protected readonly tunableService: TunableService, ) { } ngOnInit(): void { this.newDate(); this.subs.push(timer(5000, 5000).subscribe(() => this.newDate())); - this.subs.push(this.deviceList = new CrudLiveList(this.deviceService, true, device => device.stateProperty?.state?.value === true)); - this.subs.push(this.tunableList = new CrudLiveList(this.tunableService, true, tunable => tunable.stateProperty?.state?.value === true)); - this.subs.push(this.shutterList = new CrudLiveList(this.shutterService, true, shutter => this.shutterFilter(shutter))); + this.subs.push(this.deviceList = new CrudLiveList(this.deviceService, true, device => device.stateProperty?.state?.value === true, next => this.deviceService.filter(this.deviceFilter, next))); + this.subs.push(this.shutterList = new CrudLiveList(this.shutterService, true, shutter => this.shutterFilter2(shutter), next => this.shutterService.filter(this.shutterFilter, next))); + this.subs.push(this.tunableList = new CrudLiveList(this.tunableService, true, tunable => tunable.stateProperty?.state?.value === true, next => this.tunableService.filter(this.tunableFilter, next))); } private newDate() { @@ -67,7 +81,7 @@ export class DashboardComponent implements OnInit, OnDestroy { this.subs.forEach(sub => sub.unsubscribe()); } - private shutterFilter(shutter: Shutter) { + private shutterFilter2(shutter: Shutter) { if (this.shuttersShouldBeOpen) { return shutter.positionProperty?.state?.value !== 0; } else { @@ -75,4 +89,13 @@ export class DashboardComponent implements OnInit, OnDestroy { } } + refresh() { + this.deviceFilter.search = this.search; + this.deviceList.refresh(); + this.tunableFilter.search = this.search; + this.tunableList.refresh(); + this.shutterFilter.search = this.search; + this.shutterList.refresh(); + } + }