+
+ {{ ('device-profile.alarm-rule-mobile-dashboard' | translate) + ': ' }}
+
+
+ {{'device-profile.alarm-rule-mobile-dashboard-hint' | translate}}
+
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
index a0b8a83cd4..d973f261b7 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.scss
@@ -18,16 +18,24 @@
.row {
margin-top: 1em;
}
- .tb-alarm-rule-details {
+ .tb-alarm-rule-details, .tb-alarm-rule-dashboard {
padding: 4px;
- cursor: pointer;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
&.title {
opacity: 0.7;
overflow: visible;
}
}
+ .tb-alarm-rule-details {
+ overflow: hidden;
+ white-space: nowrap;
+ text-overflow: ellipsis;
+ cursor: pointer;
+ }
+ .tb-alarm-rule-dashboard {
+ &.dashboard {
+ width: 100%;
+ max-width: 350px;
+ }
+ }
}
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
index d664c5c2a4..76bfa7698e 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule.component.ts
@@ -34,6 +34,7 @@ import {
EditAlarmDetailsDialogData
} from '@home/components/profile/alarm/edit-alarm-details-dialog.component';
import { EntityId } from '@shared/models/id/entity-id';
+import { DashboardId } from '@shared/models/id/dashboard-id';
@Component({
selector: 'tb-alarm-rule',
@@ -92,7 +93,8 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
this.alarmRuleFormGroup = this.fb.group({
condition: [null, [Validators.required]],
schedule: [null],
- alarmDetails: [null]
+ alarmDetails: [null],
+ dashboardId: [null]
});
this.alarmRuleFormGroup.valueChanges.subscribe(() => {
this.updateModel();
@@ -110,7 +112,11 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
writeValue(value: AlarmRule): void {
this.modelValue = value;
- this.alarmRuleFormGroup.reset(this.modelValue || undefined, {emitEvent: false});
+ const model = this.modelValue ? {
+ ...this.modelValue,
+ dashboardId: this.modelValue.dashboardId?.id
+ } : null;
+ this.alarmRuleFormGroup.reset(model || undefined, {emitEvent: false});
}
public openEditDetailsDialog($event: Event) {
@@ -143,7 +149,7 @@ export class AlarmRuleComponent implements ControlValueAccessor, OnInit, Validat
private updateModel() {
const value = this.alarmRuleFormGroup.value;
if (this.modelValue) {
- this.modelValue = {...this.modelValue, ...value};
+ this.modelValue = {...this.modelValue, ...value, dashboardId: value.dashboardId ? new DashboardId(value.dashboardId) : null};
this.propagateChange(this.modelValue);
}
}
diff --git a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html
index 5fa6c1acdb..83bba2a266 100644
--- a/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/device-profile.component.html
@@ -60,8 +60,9 @@
formControlName="defaultRuleChainId">