Revize 715d2e8c
Přidáno uživatelem Martin Lácha před více než 3 roky(ů)
src/app/dashboard/components/dashboard.component.ts | ||
---|---|---|
19 | 19 |
groups: Group[]; |
20 | 20 |
units: Array<{ drivers?: Drivers; generalInfo?: GeneralInfo; holder?: any; lastpos?: Lastpos; sensors?: Array<Sensor>; unit?: Unit }>; |
21 | 21 |
showUnitPopup = false; |
22 |
showSensorPopup = false; |
|
23 | 22 |
editedUnit: Unit; |
24 |
editedSensor: Sensor; |
|
25 | 23 |
|
26 | 24 |
constructor( |
27 | 25 |
private groupService: GroupService, |
src/app/dashboard/components/sensor-popup/sensor-popup.component.html | ||
---|---|---|
1 |
<p>sensor-popup works!</p> |
|
1 |
<p-dialog [visible]="isVisible" [closable]="false" [draggable]="false" header="Nejlepsi popup" [style]="{width: '50vw'}" [baseZIndex]="10000"> |
|
2 |
{{ sensor | json}} |
|
3 |
<p-footer> |
|
4 |
<div class="row justify-content-end align-items-center"> |
|
5 |
<div> |
|
6 |
<p-button icon="pi pi-check" type="submit" label="Uložit" class="pr-2"></p-button> |
|
7 |
<p-button icon="pi pi-times" (click)="close()" label="Zavřít" class="pr-2"></p-button> |
|
8 |
</div> |
|
9 |
</div> |
|
10 |
</p-footer> |
|
11 |
</p-dialog> |
src/app/dashboard/components/sensor-popup/sensor-popup.component.ts | ||
---|---|---|
1 |
import { Component, OnInit } from '@angular/core';
|
|
1 |
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
2 | 2 |
|
3 | 3 |
@Component({ |
4 | 4 |
selector: 'app-sensor-popup', |
... | ... | |
7 | 7 |
}) |
8 | 8 |
export class SensorPopupComponent implements OnInit { |
9 | 9 |
|
10 |
@Input() isVisible; |
|
11 |
@Input() sensor; |
|
12 |
@Output() isVisibleChange: EventEmitter<boolean> = new EventEmitter<boolean>(); |
|
13 |
|
|
10 | 14 |
constructor() { } |
11 | 15 |
|
12 | 16 |
ngOnInit(): void { |
13 | 17 |
} |
14 | 18 |
|
19 |
close() { |
|
20 |
this.isVisibleChange.emit(false); |
|
21 |
} |
|
22 |
|
|
15 | 23 |
} |
src/app/dashboard/components/sensors/sensors.component.html | ||
---|---|---|
6 | 6 |
<div class="col"> |
7 | 7 |
</div> |
8 | 8 |
<div class="col"> |
9 |
<p-button ></p-button>
|
|
9 |
<p-button icon="pi pi-cog" (onClick)="editSensor($event, sensor)"></p-button>
|
|
10 | 10 |
<p-button [routerLink]="['/dashboard/unit', unitId, 'sensor', sensor.sensorId]" title="Sensor" icon="pi pi-chart-line"></p-button> |
11 | 11 |
</div> |
12 | 12 |
</div> |
13 |
|
|
14 |
<app-sensor-popup [(isVisible)]="showSensorPopup" [sensor]="editedSensor"></app-sensor-popup> |
src/app/dashboard/components/sensors/sensors.component.ts | ||
---|---|---|
10 | 10 |
|
11 | 11 |
@Input() sensor: Sensor; |
12 | 12 |
@Input() unitId: number; |
13 |
showSensorPopup = false; |
|
14 |
editedSensor: Sensor; |
|
13 | 15 |
constructor() { } |
14 | 16 |
|
15 | 17 |
ngOnInit(): void { |
16 | 18 |
} |
17 | 19 |
|
20 |
editSensor($event: MouseEvent, sensor: Sensor) { |
|
21 |
$event.stopPropagation(); |
|
22 |
this.editedSensor = sensor; |
|
23 |
this.showSensorPopup = true; |
|
24 |
} |
|
18 | 25 |
} |
Také k dispozici: Unified diff
Re #8621 - Návrh modelu dashboardu
- úprava modelu dashboardu