diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html
index 47c9ef8645..64d40df581 100644
--- a/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-details-dialog.component.html
@@ -88,14 +88,20 @@
-
+
+
+
@@ -109,12 +115,5 @@
{{ 'alarm.clear' | translate }}
-
-
diff --git a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html
index b7f0ff21fc..bb89ff479e 100644
--- a/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/alias/entity-alias-dialog.component.html
@@ -59,16 +59,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.html b/ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.html
index f817762f95..18f3e1a795 100644
--- a/ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/alias/entity-aliases-dialog.component.html
@@ -95,11 +95,6 @@
{{ 'alias.add' | translate }}
-
+
diff --git a/ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html b/ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html
index 072858455c..f815da49e7 100644
--- a/ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/attribute/add-attribute-dialog.component.html
@@ -44,16 +44,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.html b/ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.html
index 60fe5e30d7..4899a893e5 100644
--- a/ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/attribute/add-widget-to-dashboard-dialog.component.html
@@ -55,21 +55,22 @@
-
+
+ style="margin-bottom: 0;">
{{ 'dashboard.open-dashboard' | translate }}
-
+
+
diff --git a/ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.html b/ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.html
index 8e2264fae1..fe48694983 100644
--- a/ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/attribute/edit-attribute-value-panel.component.html
@@ -26,7 +26,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html
index 29ee7364eb..e4ee790806 100644
--- a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html
@@ -31,7 +31,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html
index ab49dae445..717e8765de 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/filter-dialog.component.html
@@ -55,16 +55,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.html
index a8d205479f..587504da45 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/filter-user-info-dialog.component.html
@@ -46,12 +46,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html
index 91bbc11425..c573267d2a 100644
--- a/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/filters-dialog.component.html
@@ -88,11 +88,6 @@
{{ 'filter.add' | translate }}
-
+
diff --git a/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.html
index f601814920..5a9f8858c3 100644
--- a/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/key-filter-dialog.component.html
@@ -79,12 +79,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.html b/ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.html
index 2a0cf0be24..bf38483244 100644
--- a/ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/filter/user-filter-dialog.component.html
@@ -65,16 +65,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.html b/ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.html
index e53ff360ca..a8fe3a1f46 100644
--- a/ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/import-export/import-dialog.component.html
@@ -43,16 +43,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html
index 7be952c68d..493763756b 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-rule-condition-dialog.component.html
@@ -108,17 +108,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
index abe511fc3f..64a808fe98 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/alarm-schedule-dialog.component.html
@@ -37,17 +37,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.html b/ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.html
index 8eee1d980e..5c992d9e04 100644
--- a/ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.html
+++ b/ui-ngx/src/app/modules/home/components/profile/alarm/create-alarm-rules.component.html
@@ -47,9 +47,9 @@
remove_circle_outline
-
+
device-profile.no-create-alarm-rules
+ class="tb-prompt required">device-profile.add-create-alarm-rule-prompt
-
+
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 4fbc413d98..f74b19891e 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
@@ -41,7 +41,7 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/relation/relation-dialog.component.html b/ui-ngx/src/app/modules/home/components/relation/relation-dialog.component.html
index 2d637c4066..f1d6790ae8 100644
--- a/ui-ngx/src/app/modules/home/components/relation/relation-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/relation/relation-dialog.component.html
@@ -53,17 +53,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
index a61b3a80c6..46a0d213a4 100644
--- a/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/action/widget-action-dialog.component.html
@@ -147,16 +147,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/data-key-config-dialog.component.html b/ui-ngx/src/app/modules/home/components/widget/data-key-config-dialog.component.html
index d09b7aae24..8127b77e5d 100644
--- a/ui-ngx/src/app/modules/home/components/widget/data-key-config-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/data-key-config-dialog.component.html
@@ -38,16 +38,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/alarm-filter-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/alarm-filter-panel.component.html
index b150110fca..3a834621e6 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/alarm-filter-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/alarm-filter-panel.component.html
@@ -50,17 +50,16 @@
+
-
diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator-panel.component.html b/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator-panel.component.html
index 2ee1222168..05aabbb7a7 100644
--- a/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator-panel.component.html
+++ b/ui-ngx/src/app/modules/home/components/widget/lib/date-range-navigator/date-range-navigator-panel.component.html
@@ -28,7 +28,6 @@
diff --git a/ui-ngx/src/app/modules/home/dialogs/add-entities-to-customer-dialog.component.html b/ui-ngx/src/app/modules/home/dialogs/add-entities-to-customer-dialog.component.html
index 0b33828bc4..2fcc346477 100644
--- a/ui-ngx/src/app/modules/home/dialogs/add-entities-to-customer-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/dialogs/add-entities-to-customer-dialog.component.html
@@ -40,17 +40,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/dialogs/assign-to-customer-dialog.component.html b/ui-ngx/src/app/modules/home/dialogs/assign-to-customer-dialog.component.html
index 5c98c02fa1..18d71968fd 100644
--- a/ui-ngx/src/app/modules/home/dialogs/assign-to-customer-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/dialogs/assign-to-customer-dialog.component.html
@@ -39,17 +39,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/add-widget-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/add-widget-dialog.component.html
index 614c63d980..fb0d17e73a 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/add-widget-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/add-widget-dialog.component.html
@@ -41,11 +41,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.html
index 082ff62633..80d5412226 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/dashboard-settings-dialog.component.html
@@ -152,17 +152,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/layout/manage-dashboard-layouts-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/layout/manage-dashboard-layouts-dialog.component.html
index 8c539a8cb8..0014fcb0cb 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/layout/manage-dashboard-layouts-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/layout/manage-dashboard-layouts-dialog.component.html
@@ -54,11 +54,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.html
index 0a20f6a48e..3097e0e303 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/make-dashboard-public-dialog.component.html
@@ -54,7 +54,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/states/dashboard-state-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/states/dashboard-state-dialog.component.html
index cc27d98d9a..52788ca0e8 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/states/dashboard-state-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/states/dashboard-state-dialog.component.html
@@ -52,16 +52,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html b/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
index d75b4f41c3..7f4f486278 100644
--- a/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/dashboard/states/manage-dashboard-states-dialog.component.html
@@ -136,16 +136,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html
index d927e5222c..a803d35b1d 100644
--- a/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html
+++ b/ui-ngx/src/app/modules/home/pages/device-profile/device-profile-tabs.component.html
@@ -70,7 +70,7 @@
-
diff --git a/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html b/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
index 0c99fd7040..2936b60911 100644
--- a/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/device/device-credentials-dialog.component.html
@@ -36,17 +36,17 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/profile/change-password-dialog.component.html b/ui-ngx/src/app/modules/home/pages/profile/change-password-dialog.component.html
index 9cd30ab768..926c4d7bcc 100644
--- a/ui-ngx/src/app/modules/home/pages/profile/change-password-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/profile/change-password-dialog.component.html
@@ -46,16 +46,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html
index e8df333ecd..75ccbb764e 100644
--- a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html
@@ -40,16 +40,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.html
index 3016ab6d70..12de2706f5 100644
--- a/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-link-dialog.component.html
@@ -39,16 +39,16 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
index 52ac55275c..a66a3ab995 100644
--- a/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/user/add-user-dialog.component.html
@@ -41,11 +41,6 @@
-
+
diff --git a/ui-ngx/src/app/modules/home/pages/widget/save-widget-type-as-dialog.component.html b/ui-ngx/src/app/modules/home/pages/widget/save-widget-type-as-dialog.component.html
index 8af9a379d9..0ae1e24a07 100644
--- a/ui-ngx/src/app/modules/home/pages/widget/save-widget-type-as-dialog.component.html
+++ b/ui-ngx/src/app/modules/home/pages/widget/save-widget-type-as-dialog.component.html
@@ -46,17 +46,17 @@
-
+
diff --git a/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html b/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
index 8e1b64381d..4de07b1f80 100644
--- a/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
+++ b/ui-ngx/src/app/shared/components/dialog/color-picker-dialog.component.html
@@ -34,7 +34,6 @@
diff --git a/ui-ngx/src/app/shared/components/dialog/json-object-edit-dialog.component.html b/ui-ngx/src/app/shared/components/dialog/json-object-edit-dialog.component.html
index 8dc4f5b1d2..9d5ee6c6ef 100644
--- a/ui-ngx/src/app/shared/components/dialog/json-object-edit-dialog.component.html
+++ b/ui-ngx/src/app/shared/components/dialog/json-object-edit-dialog.component.html
@@ -41,17 +41,16 @@
-
+
diff --git a/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html b/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html
index 698ecb75ae..365445ed02 100644
--- a/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html
+++ b/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html
@@ -109,18 +109,17 @@
{{ 'rulenode.test' | translate }}
-
+
diff --git a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
index c462c150c0..398d5dd9d1 100644
--- a/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
+++ b/ui-ngx/src/app/shared/components/time/timewindow-panel.component.html
@@ -140,19 +140,18 @@
+
-
diff --git a/ui-ngx/src/app/shared/models/device.models.ts b/ui-ngx/src/app/shared/models/device.models.ts
index 9e92defa45..f6850dbc57 100644
--- a/ui-ngx/src/app/shared/models/device.models.ts
+++ b/ui-ngx/src/app/shared/models/device.models.ts
@@ -26,7 +26,7 @@ import { EntityInfoData } from '@shared/models/entity.models';
import { KeyFilter } from '@shared/models/query/query.models';
import { TimeUnit } from '@shared/models/time/time.models';
import * as _moment from 'moment-timezone';
-import { AbstractControl, FormGroup } from '@angular/forms';
+import { AbstractControl, FormGroup, ValidationErrors } from '@angular/forms';
export enum DeviceProfileType {
DEFAULT = 'DEFAULT'
@@ -87,7 +87,7 @@ export const deviceProvisionTypeTranslationMap = new Map(
[
@@ -303,6 +303,18 @@ export interface AlarmRule {
schedule?: AlarmSchedule;
}
+export function alarmRuleValidator(control: AbstractControl): ValidationErrors | null {
+ const alarmRule: AlarmRule = control.value;
+ return alarmRuleValid(alarmRule) ? null : {alarmRule: true};
+}
+
+function alarmRuleValid(alarmRule: AlarmRule): boolean {
+ if (!alarmRule || !alarmRule.condition || !alarmRule.condition.condition || !alarmRule.condition.condition.length) {
+ return false;
+ }
+ return true;
+}
+
export interface DeviceProfileAlarm {
id: string;
alarmType: string;
@@ -312,6 +324,34 @@ export interface DeviceProfileAlarm {
propagateRelationTypes?: Array;
}
+export function deviceProfileAlarmValidator(control: AbstractControl): ValidationErrors | null {
+ const deviceProfileAlarm: DeviceProfileAlarm = control.value;
+ if (deviceProfileAlarm && deviceProfileAlarm.id && deviceProfileAlarm.alarmType &&
+ deviceProfileAlarm.createRules) {
+ const severities = Object.keys(deviceProfileAlarm.createRules);
+ if (severities.length) {
+ let alarmRulesValid = true;
+ for (const severity of severities) {
+ const alarmRule = deviceProfileAlarm.createRules[severity];
+ if (!alarmRuleValid(alarmRule)) {
+ alarmRulesValid = false;
+ break;
+ }
+ }
+ if (alarmRulesValid) {
+ if (deviceProfileAlarm.clearRule && !alarmRuleValid(deviceProfileAlarm.clearRule)) {
+ alarmRulesValid = false;
+ }
+ }
+ if (alarmRulesValid) {
+ return null;
+ }
+ }
+ }
+ return {deviceProfileAlarm: true};
+}
+
+
export interface DeviceProfileData {
configuration: DeviceProfileConfiguration;
transportConfiguration: DeviceProfileTransportConfiguration;
diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json
index b5b34f8fe5..453d5d2abd 100644
--- a/ui-ngx/src/assets/locale/locale.constant-en_US.json
+++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json
@@ -908,6 +908,7 @@
"create-alarm-pattern": "Create {{alarmType}} alarm",
"create-alarm-rules": "Create alarm rules",
"no-create-alarm-rules": "No create conditions configured",
+ "add-create-alarm-rule-prompt": "Please add create alarm rule",
"clear-alarm-rule": "Clear alarm rule",
"no-clear-alarm-rule": "No clear condition configured",
"add-create-alarm-rule": "Add create condition",
diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss
index ac717e783e..190fbb1ba7 100644
--- a/ui-ngx/src/styles.scss
+++ b/ui-ngx/src/styles.scss
@@ -331,6 +331,9 @@ pre.tb-highlight {
font-weight: 400;
line-height: 18px;
color: rgba(0, 0, 0, .38);
+ &.required {
+ color: rgb(221, 44, 0);
+ }
}
.tb-fullscreen {