Skip to content

Commit a40dccc

Browse files
committed
Add show/hide all transducer checkboxes
1 parent 88012e9 commit a40dccc

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

src/app/components/devices/device-information/device-visualization.component.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
<div class="device-visualization">
2-
<div class="transducerList">
3-
<div *ngFor="let td of deviceTransducers">
4-
<md-checkbox [(ngModel)]="td['checked']" (change)="optionToggled()">
5-
{{ td.name }}
6-
</md-checkbox>
2+
<mat-slide-toggle [(ngModel)]="showCheckboxes">Select Transducers</mat-slide-toggle>
3+
<div *ngIf="showCheckboxes">
4+
<div class="transducerList">
5+
<button md-raised-button (click)="checkAll('show')">
6+
Show All
7+
</button>
8+
<button md-raised-button (click)="checkAll('hide')">
9+
Hide All
10+
</button>
11+
</div>
12+
<div class="transducerList">
13+
<div *ngFor="let td of deviceTransducers">
14+
<md-checkbox [(ngModel)]="td['checked']" (change)="optionToggled()">
15+
{{ td.name }}
16+
</md-checkbox>
17+
</div>
718
</div>
819
</div>
920
<div class="resolution">

src/app/components/devices/device-information/device-visualization.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export class DeviceVisualizationComponent {
1515
@Input() device: Device;
1616
@Output() updateDevice: EventEmitter<boolean> = new EventEmitter();
1717
deviceTransducers: Array<any>;
18+
showCheckboxes: boolean = false;
1819
frameURL: SafeUrl = [];
1920
currentRes: 'Hour';
2021
resOptions = [
@@ -34,6 +35,17 @@ export class DeviceVisualizationComponent {
3435
this.optionToggled();
3536
}
3637

38+
checkAll(action) {
39+
let val = true;
40+
if (action == 'hide') {
41+
val = false;
42+
}
43+
this.deviceTransducers.forEach( (td) => {
44+
td['checked'] = val;
45+
});
46+
this.optionToggled();
47+
}
48+
3749
optionToggled() {
3850
let grafana_url = this.deviceService.getGrafanaUrl();
3951
let enabledTransducers = [];

0 commit comments

Comments
 (0)