From f34420cfa814af185328d83e2deb5860daf7bf7e Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Wed, 6 Jan 2021 11:46:59 +0200 Subject: [PATCH] Edge Downlinks refactored --- ui/src/app/common/types.constant.js | 4 ++-- .../downlinks/edge-downlinks-row.directive.js | 18 +++++++++--------- .../edge/downlinks/edge-downlinks-row.tpl.html | 4 ++-- .../edge-downlinks-table.directive.js | 4 ++-- ui/src/app/edge/edges.tpl.html | 3 +-- 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/ui/src/app/common/types.constant.js b/ui/src/app/common/types.constant.js index 33eaf16ba4..c4c110d1ee 100644 --- a/ui/src/app/common/types.constant.js +++ b/ui/src/app/common/types.constant.js @@ -384,7 +384,7 @@ export default angular.module('thingsboard.types', []) entityView: "ENTITY_VIEW", edge: "EDGE" }, - edgeDownlinksType:{ + edgeEventType:{ dashboard: "DASHBOARD", asset: "ASSET", device: "DEVICE", @@ -405,7 +405,7 @@ export default angular.module('thingsboard.types', []) widgetType: "WIDGET_TYPE", adminSettings: "ADMIN_SETTINGS" }, - edgeDownlinksStatus: { + getEdgeStatus: { "DEPLOYED": { name: "edge.deployed", color: grey900 diff --git a/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js b/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js index 8e848dfaf6..d2cf7ee0a6 100644 --- a/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js +++ b/ui/src/app/edge/downlinks/edge-downlinks-row.directive.js @@ -43,11 +43,11 @@ export default function EdgeDownlinksRowDirective($compile, $templateCache, $mdD } var content = ''; switch(scope.downlink.type) { - case types.edgeDownlinksType.relation: + case types.edgeEventType.relation: content = angular.toJson(scope.downlink.body); showDialog(); break; - case types.edgeDownlinksType.ruleChainMetaData: + case types.edgeEventType.ruleChainMetaData: content = ruleChainService.getRuleChainMetaData(scope.downlink.entityId, {ignoreErrors: true}).then( function success(info) { showDialog(); @@ -87,9 +87,9 @@ export default function EdgeDownlinksRowDirective($compile, $templateCache, $mdD } scope.checkEdgeDownlinksType = function (type) { - return !(type === types.edgeDownlinksType.widgetType || - type === types.edgeDownlinksType.adminSettings || - type === types.edgeDownlinksType.widgetsBundle ); + return !(type === types.edgeEventType.widgetType || + type === types.edgeEventType.adminSettings || + type === types.edgeEventType.widgetsBundle ); } scope.checkTooltip = function($event) { @@ -105,11 +105,11 @@ export default function EdgeDownlinksRowDirective($compile, $templateCache, $mdD scope.updateStatus = function(downlinkCreatedTime) { var status; if (downlinkCreatedTime < scope.queueStartTs) { - status = $translate.instant(types.edgeDownlinksStatus.DEPLOYED.name); - scope.statusColor = types.edgeDownlinksStatus.DEPLOYED.color; + status = $translate.instant(types.getEdgeStatus.DEPLOYED.name); + scope.statusColor = types.getEdgeStatus.DEPLOYED.color; } else { - status = $translate.instant(types.edgeDownlinksStatus.PENDING.name); - scope.statusColor = types.edgeDownlinksStatus.PENDING.color; + status = $translate.instant(types.getEdgeStatus.PENDING.name); + scope.statusColor = types.getEdgeStatus.PENDING.color; } return status; } diff --git a/ui/src/app/edge/downlinks/edge-downlinks-row.tpl.html b/ui/src/app/edge/downlinks/edge-downlinks-row.tpl.html index 369d705b04..7fe595bc8c 100644 --- a/ui/src/app/edge/downlinks/edge-downlinks-row.tpl.html +++ b/ui/src/app/edge/downlinks/edge-downlinks-row.tpl.html @@ -16,8 +16,8 @@ -->
{{ downlink.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}
-
{{ downlink.edgeDownlinksTypeText }}
-
{{ downlink.edgeDownlinksActionText }}
+
{{ downlink.edgeEventTypeText }}
+
{{ downlink.edgeEventActionText }}
{{ downlink.entityId }}
{{ updateStatus(downlink.createdTime) }}
diff --git a/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js b/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js index 06928c3e83..98bd63abb0 100644 --- a/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js +++ b/ui/src/app/edge/downlinks/edge-downlinks-table.directive.js @@ -211,8 +211,8 @@ export default function EdgeDownlinksDirective($compile, $templateCache, $rootSc data.forEach( edgeDownlink => { - edgeDownlink.edgeDownlinksActionText = $translate.instant(types.edgeEventActionTypeTranslations[edgeDownlink.action].name); - edgeDownlink.edgeDownlinksTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeDownlink.type].name); + edgeDownlink.edgeEventActionText = $translate.instant(types.edgeEventActionTypeTranslations[edgeDownlink.action].name); + edgeDownlink.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeDownlink.type].name); } ); return data; diff --git a/ui/src/app/edge/edges.tpl.html b/ui/src/app/edge/edges.tpl.html index e53ebba83a..ea40c80b06 100644 --- a/ui/src/app/edge/edges.tpl.html +++ b/ui/src/app/edge/edges.tpl.html @@ -68,8 +68,7 @@ + tenant-id="vm.grid.operatingItem().tenantId.id">