From 35a17efc71249eb157b96bcf5689173e43348666 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Sat, 11 Jul 2020 00:29:42 +0300 Subject: [PATCH 1/9] For edgeEvents added Status of data received by Edge v.1.0 --- .../event/event-header-edge-event.tpl.html | 1 + .../app/event/event-row-edge-event.tpl.html | 1 + ui/src/app/event/event-row.directive.js | 28 +++++++++++++++++-- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ui/src/app/event/event-header-edge-event.tpl.html b/ui/src/app/event/event-header-edge-event.tpl.html index f0d2daa53b..e9770f42bd 100644 --- a/ui/src/app/event/event-header-edge-event.tpl.html +++ b/ui/src/app/event/event-header-edge-event.tpl.html @@ -20,3 +20,4 @@
edge.event-action
edge.entity-id
edge.entity-info
+
event.status
diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index 5c3a7a8576..7dea0aa804 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -32,4 +32,5 @@ +
{{receiveStatus(event.createdTime)}}
diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index 0ba533d5f1..7bec6c28dd 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -26,11 +26,13 @@ import eventRowEdgeEventTemplate from './event-row-edge-event.tpl.html'; /* eslint-enable import/no-unresolved, import/default */ /*@ngInject*/ -export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, - types, toast, entityService, ruleChainService) { +export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, $log, + types, toast, entityService, ruleChainService, userService, attributeService) { var linker = function (scope, element, attrs) { + var lastDisconnectTime; + var getTemplate = function(eventType) { var template = ''; switch(eventType) { @@ -50,6 +52,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ template = eventRowDebugRuleNodeTemplate; break; case types.eventType.edgeEvent.value: + getLastDisconnectTime(); template = eventRowEdgeEventTemplate; break; } @@ -135,6 +138,27 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ }); } + function getLastDisconnectTime() { + let params = { + entityType: types.entityType.edge, + entityId: scope.entityId, + attributeScope: types.attributesScope.server.value, + query: {order: '', limit: 1, page: 1, search: "active"} + }; + attributeService.getEntityAttributes(params.entityType, params.entityId, params.attributeScope, params.query, + function (attribute) { + if (attribute && attribute.data) { + $log.log("attribute", attribute); + lastDisconnectTime = attribute.data[0].lastUpdateTs; + $log.log("lastDisconnectTime", lastDisconnectTime, typeof(lastDisconnectTime)); + } + }); + } + + scope.receiveStatus = function(eventCreatedTime) { + return (eventCreatedTime <= lastDisconnectTime) ? $translate.instant('event.success') : $translate.instant('event.failed'); + } + scope.checkTooltip = function($event) { var el = $event.target; var $el = angular.element(el); From df62957780e50b67e589b8feeef2bd6b4b73e902 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Sat, 11 Jul 2020 00:34:00 +0300 Subject: [PATCH 2/9] For edgeEvents added Status of data received by Edge v.1.0 --- ui/src/app/event/event-row.directive.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index 7bec6c28dd..2e4163d694 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -26,7 +26,7 @@ import eventRowEdgeEventTemplate from './event-row-edge-event.tpl.html'; /* eslint-enable import/no-unresolved, import/default */ /*@ngInject*/ -export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, $log, +export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, types, toast, entityService, ruleChainService, userService, attributeService) { var linker = function (scope, element, attrs) { @@ -148,9 +148,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ attributeService.getEntityAttributes(params.entityType, params.entityId, params.attributeScope, params.query, function (attribute) { if (attribute && attribute.data) { - $log.log("attribute", attribute); lastDisconnectTime = attribute.data[0].lastUpdateTs; - $log.log("lastDisconnectTime", lastDisconnectTime, typeof(lastDisconnectTime)); } }); } From 5ab81b98a6c5f53d8691cd811c4d23b5fdd573cc Mon Sep 17 00:00:00 2001 From: deaflynx Date: Mon, 13 Jul 2020 17:13:18 +0300 Subject: [PATCH 3/9] Edge Events Status Update --- ui/src/app/api/edge.service.js | 2 +- .../app/event/event-row-edge-event.tpl.html | 2 +- ui/src/app/event/event-row.directive.js | 30 +++-------- ui/src/app/event/event-table.directive.js | 52 ++++++++++++++++++- 4 files changed, 60 insertions(+), 26 deletions(-) diff --git a/ui/src/app/api/edge.service.js b/ui/src/app/api/edge.service.js index 858dff3d18..7814e1d826 100644 --- a/ui/src/app/api/edge.service.js +++ b/ui/src/app/api/edge.service.js @@ -56,7 +56,7 @@ function EdgeService($http, $q, customerService) { deferred.reject(); }); return deferred.promise; - } // TODO: deaflynx: check usage in UI + } function getEdgesByIds(edgeIds, config) { var deferred = $q.defer(); diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index 7dea0aa804..0b088d8570 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -32,5 +32,5 @@ -
{{receiveStatus(event.createdTime)}}
+
{{updateStatus(event.createdTime)}}
diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index 2e4163d694..fd9756a697 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -27,12 +27,10 @@ import eventRowEdgeEventTemplate from './event-row-edge-event.tpl.html'; /*@ngInject*/ export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, - types, toast, entityService, ruleChainService, userService, attributeService) { + types, toast, entityService, ruleChainService) { var linker = function (scope, element, attrs) { - var lastDisconnectTime; - var getTemplate = function(eventType) { var template = ''; switch(eventType) { @@ -52,7 +50,6 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ template = eventRowDebugRuleNodeTemplate; break; case types.eventType.edgeEvent.value: - getLastDisconnectTime(); template = eventRowEdgeEventTemplate; break; } @@ -138,25 +135,6 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ }); } - function getLastDisconnectTime() { - let params = { - entityType: types.entityType.edge, - entityId: scope.entityId, - attributeScope: types.attributesScope.server.value, - query: {order: '', limit: 1, page: 1, search: "active"} - }; - attributeService.getEntityAttributes(params.entityType, params.entityId, params.attributeScope, params.query, - function (attribute) { - if (attribute && attribute.data) { - lastDisconnectTime = attribute.data[0].lastUpdateTs; - } - }); - } - - scope.receiveStatus = function(eventCreatedTime) { - return (eventCreatedTime <= lastDisconnectTime) ? $translate.instant('event.success') : $translate.instant('event.failed'); - } - scope.checkTooltip = function($event) { var el = $event.target; var $el = angular.element(el); @@ -166,6 +144,12 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ } $compile(element.contents())(scope); + + scope.updateStatus = function(eventCreatedTime) { + if (scope.queueStartTs) { + return (eventCreatedTime < scope.queueStartTs) ? $translate.instant('event.success') : $translate.instant('event.failed'); + } + } } return { diff --git a/ui/src/app/event/event-table.directive.js b/ui/src/app/event/event-table.directive.js index 4e8ae226b7..df300dd8e1 100644 --- a/ui/src/app/event/event-table.directive.js +++ b/ui/src/app/event/event-table.directive.js @@ -22,7 +22,8 @@ import eventTableTemplate from './event-table.tpl.html'; /* eslint-enable import/no-unresolved, import/default */ /*@ngInject*/ -export default function EventTableDirective($compile, $templateCache, $rootScope, types, eventService, edgeService) { +export default function EventTableDirective($compile, $templateCache, $rootScope, types, eventService, edgeService, + attributeService) { var linker = function (scope, element, attrs) { @@ -106,6 +107,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope scope.eventType, scope.tenantId, scope.events.nextPageLink); } else { promise = edgeService.getEdgeEvents(scope.entityId, scope.events.nextPageLink); + scope.loadEdgeInfo(); } if (promise) { scope.events.pending = true; @@ -135,6 +137,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope scope.$watch("entityId", function(newVal, prevVal) { if (newVal && !angular.equals(newVal, prevVal)) { + scope.loadEdgeInfo(); scope.resetFilter(); scope.reload(); } @@ -212,6 +215,53 @@ export default function EventTableDirective($compile, $templateCache, $rootScope return false; } + scope.subscriptionId = null; + scope.queueStartTs; + + scope.loadEdgeInfo = function() { + attributeService.getEntityAttributesValues(scope.entityType, scope.entityId, types.attributesScope.server.value, + ["queueStartTs"], {}) + .then(function success(attributes) { + scope.onUpdate(attributes); + }); + + scope.checkSubscription(); + + attributeService.getEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value, {order: '', limit: 1, page: 1, search: ''}, + function (attributes) { + if (attributes && attributes.data) { + scope.onUpdate(attributes.data); + } + }); + } + + scope.onUpdate = function(attributes) { + let edge = attributes.reduce(function (map, attribute) { + map[attribute.key] = attribute; + return map; + }, {}); + if (edge.queueStartTs) { + scope.queueStartTs = edge.queueStartTs.lastUpdateTs; + } + } + + scope.checkSubscription = function() { + var newSubscriptionId = null; + if (scope.entityId && scope.entityType && types.attributesScope.server.value) { + newSubscriptionId = attributeService.subscribeForEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value); + } + if (scope.subscriptionId && scope.subscriptionId != newSubscriptionId) { + attributeService.unsubscribeForEntityAttributes(scope.subscriptionId); + } + scope.subscriptionId = newSubscriptionId; + } + + scope.$on('$destroy', function () { + if (scope.subscriptionId) { + attributeService.unsubscribeForEntityAttributes(scope.subscriptionId); + } + }); + scope.reload(); $compile(element.contents())(scope); From 63de68f6952d7e2f2d3d927b51486ea4ae5330b6 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 14 Jul 2020 10:57:34 +0300 Subject: [PATCH 4/9] Added eventTypeScope for edgeEvents --- ui/src/app/event/event-table.directive.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/ui/src/app/event/event-table.directive.js b/ui/src/app/event/event-table.directive.js index df300dd8e1..205a686fe3 100644 --- a/ui/src/app/event/event-table.directive.js +++ b/ui/src/app/event/event-table.directive.js @@ -23,7 +23,7 @@ import eventTableTemplate from './event-table.tpl.html'; /*@ngInject*/ export default function EventTableDirective($compile, $templateCache, $rootScope, types, eventService, edgeService, - attributeService) { + attributeService, $log) { var linker = function (scope, element, attrs) { @@ -31,11 +31,16 @@ export default function EventTableDirective($compile, $templateCache, $rootScope element.html(template); + scope.eventTypeScope = angular.copy(types.eventType); + if (scope.entityType !== types.entityType.edge) { + delete scope.eventTypeScope.edgeEvent; + } + if (attrs.disabledEventTypes) { var disabledEventTypes = attrs.disabledEventTypes.split(','); scope.eventTypes = {}; - for (var type in types.eventType) { - var eventType = types.eventType[type]; + for (var type in scope.eventTypeScope) { + var eventType = scope.eventTypeScope[type]; var enabled = true; for (var i=0;i Date: Tue, 21 Jul 2020 08:19:16 +0300 Subject: [PATCH 5/9] Added Edge Fieldset manage... buttons. In EdgeEvents updated table columns width, status labels --- ui/src/app/edge/edge-fieldset.tpl.html | 15 +++++++++++++++ ui/src/app/edge/edge.controller.js | 5 +++++ ui/src/app/edge/edge.directive.js | 5 +++++ ui/src/app/edge/edges.tpl.html | 5 +++++ ui/src/app/event/event-header-edge-event.tpl.html | 8 ++++---- ui/src/app/event/event-row-edge-event.tpl.html | 9 +++++---- ui/src/app/event/event-row.directive.js | 10 +++++++++- ui/src/app/locale/locale.constant-en_US.json | 5 ++++- 8 files changed, 52 insertions(+), 10 deletions(-) diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index b54e1cb651..c151c03f10 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -21,6 +21,21 @@ {{ isPublic ? 'edge.make-private' : 'edge.unassign-from-customer' | translate }} +{{ 'edge.manage-edge-assets' | translate }} +{{ 'edge.manage-edge-devices' | translate }} +{{ 'edge.manage-edge-entity-views' | translate }} +{{ 'edge.manage-edge-dashboards' | translate }} +{{ 'edge.manage-edge-rulechains' | translate }} {{ 'edge.delete' | translate }} diff --git a/ui/src/app/edge/edge.controller.js b/ui/src/app/edge/edge.controller.js index 51269ea753..7e57fce6a6 100644 --- a/ui/src/app/edge/edge.controller.js +++ b/ui/src/app/edge/edge.controller.js @@ -129,6 +129,11 @@ export function EdgeController($rootScope, userService, edgeService, customerSer vm.assignToCustomer = assignToCustomer; vm.makePublic = makePublic; vm.unassignFromCustomer = unassignFromCustomer; + vm.openEdgeAssets = openEdgeAssets; + vm.openEdgeDevices = openEdgeDevices; + vm.openEdgeEntityViews = openEdgeEntityViews; + vm.openEdgeDashboards = openEdgeDashboards; + vm.openEdgeRuleChains = openEdgeRuleChains; initController(); diff --git a/ui/src/app/edge/edge.directive.js b/ui/src/app/edge/edge.directive.js index 0cbe32f79e..d96dfa4b4d 100644 --- a/ui/src/app/edge/edge.directive.js +++ b/ui/src/app/edge/edge.directive.js @@ -96,6 +96,11 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD onAssignToCustomer: '&', onMakePublic: '&', onUnassignFromCustomer: '&', + onManageEdgeAssets: '&', + onManageEdgeDevices: '&', + onManageEdgeEntityViews: '&', + onManageEdgeDashboards: '&', + onManageEdgeRuleChains: '&', onDeleteEdge: '&' } }; diff --git a/ui/src/app/edge/edges.tpl.html b/ui/src/app/edge/edges.tpl.html index 4fc3f5d75e..2600413255 100644 --- a/ui/src/app/edge/edges.tpl.html +++ b/ui/src/app/edge/edges.tpl.html @@ -29,6 +29,11 @@ on-assign-to-customer="vm.assignToCustomer(event, [ vm.grid.detailsConfig.currentItem.id.id ])" on-make-public="vm.makePublic(event, vm.grid.detailsConfig.currentItem)" on-unassign-from-customer="vm.unassignFromCustomer(event, vm.grid.detailsConfig.currentItem, isPublic)" + on-manage-edge-assets="vm.openEdgeAssets(event, vm.grid.detailsConfig.currentItem)" + on-manage-edge-devices="vm.openEdgeDevices(event, vm.grid.detailsConfig.currentItem)" + on-manage-edge-entity-views="vm.openEdgeEntityViews(event, vm.grid.detailsConfig.currentItem)" + on-manage-edge-dashboards="vm.openEdgeDashboards(event, vm.grid.detailsConfig.currentItem)" + on-manage-edge-rule-chains="vm.openEdgeRuleChains(event, vm.grid.detailsConfig.currentItem)" on-delete-edge="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"> diff --git a/ui/src/app/event/event-header-edge-event.tpl.html b/ui/src/app/event/event-header-edge-event.tpl.html index e9770f42bd..e84922f6a5 100644 --- a/ui/src/app/event/event-header-edge-event.tpl.html +++ b/ui/src/app/event/event-header-edge-event.tpl.html @@ -17,7 +17,7 @@ -->
event.event-time
event.event-type
-
edge.event-action
-
edge.entity-id
-
edge.entity-info
-
event.status
+
edge.event-action
+
edge.entity-id
+
edge.status
+
edge.entity-info
diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index 0b088d8570..ef5efee956 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -17,9 +17,10 @@ -->
{{event.createdTime | date : 'yyyy-MM-dd HH:mm:ss'}}
{{event.edgeEventType}}
-
{{event.edgeEventAction}}
-
{{event.entityId}}
-
+
{{event.edgeEventAction}}
+
{{event.entityId}}
+
{{updateStatus(event.createdTime)}}
+
@@ -32,5 +33,5 @@
-
{{updateStatus(event.createdTime)}}
+ diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index fd9756a697..11af155176 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -147,7 +147,15 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ scope.updateStatus = function(eventCreatedTime) { if (scope.queueStartTs) { - return (eventCreatedTime < scope.queueStartTs) ? $translate.instant('event.success') : $translate.instant('event.failed'); + var status; + if (eventCreatedTime < scope.queueStartTs) { + status = 'edge.success'; + scope.isPending = false; + } else { + status = 'edge.failed'; + scope.isPending = true; + } + return $translate.instant(status); } } } diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 57c54c2556..bea55fd30e 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -843,7 +843,10 @@ "entity-views": "Edge entity views", "set-root-rule-chain-text": "Please select root rule chain for edge(s)", "set-root-rule-chain-to-edges": "Set root rule chain for Edge(s)", - "set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }" + "set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }", + "status": "Received by edge", + "success": "Deployed", + "failed": "Pending" }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", From 8c9aa0c8dfe47f4b3bbf1f9660f563ef6945cca9 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 21 Jul 2020 08:44:49 +0300 Subject: [PATCH 6/9] Minor code cleaning --- ui/src/app/event/event-row-edge-event.tpl.html | 10 +++++----- ui/src/app/event/event-row.directive.js | 6 +++--- ui/src/app/event/event-table.directive.js | 6 ++---- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index ef5efee956..d47ca55b81 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -15,11 +15,11 @@ limitations under the License. --> -
{{event.createdTime | date : 'yyyy-MM-dd HH:mm:ss'}}
-
{{event.edgeEventType}}
-
{{event.edgeEventAction}}
-
{{event.entityId}}
-
{{updateStatus(event.createdTime)}}
+
{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}
+
{{ event.edgeEventType }}
+
{{ event.edgeEventAction }}
+
{{ event.entityId }}
+
{{ updateStatus(event.createdTime) | translate }}
Date: Tue, 21 Jul 2020 11:56:19 +0300 Subject: [PATCH 7/9] EdgeEvents: added toast.showError() for deleted entities --- ui/src/app/common/types.constant.js | 13 ++++++ ui/src/app/event/event-row.directive.js | 42 ++++++++++++-------- ui/src/app/locale/locale.constant-en_US.json | 2 +- 3 files changed, 39 insertions(+), 18 deletions(-) diff --git a/ui/src/app/common/types.constant.js b/ui/src/app/common/types.constant.js index 7b37ada832..f48f3e9f03 100644 --- a/ui/src/app/common/types.constant.js +++ b/ui/src/app/common/types.constant.js @@ -389,6 +389,19 @@ export default angular.module('thingsboard.types', []) customer: "CUSTOMER", relation: "RELATION" }, + edgeEventAction: { + updated: "UPDATED", + added: "ADDED", + assignedToEdge: "ASSIGNED_TO_EDGE", + deleted: "DELETED", + unassignedFromEdge: "UNASSIGNED_FROM_EDGE", + alarmAck: "ALARM_ACK", + alarmClear: "ALARM_CLEAR", + credentialsUpdated: "CREDENTIALS_UPDATED", + attributesUpdated: "ATTRIBUTES_UPDATED", + attributesDeleted: "ATTRIBUTES_DELETED", + timeseriesUpdated: "TIMESERIES_UPDATED" + }, importEntityColumnType: { name: { name: 'import.column-type.name', diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index e5908d88b0..b1b6311e5e 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -102,37 +102,45 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ switch(scope.event.edgeEventType) { case types.edgeEventType.relation: content = angular.toJson(scope.event.entityBody); + showDialog(); break; case types.edgeEventType.ruleChainMetaData: - content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {}).then( + content = ruleChainService.getRuleChainMetaData(scope.event.entityId, {ignoreErrors: true}).then( function success(info) { + showDialog(); return angular.toJson(info); }, function fail() { - toast.showError($translate.instant('edge.load-entity-error')); + showError(); }); break; default: - content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {}).then( + content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreLoading: true, ignoreErrors: true}).then( function success(info) { + showDialog(); return angular.toJson(info); }, function fail() { - toast.showError($translate.instant('edge.load-entity-error')); + showError(); }); break; } - $mdDialog.show({ - controller: 'EventContentDialogController', - controllerAs: 'vm', - templateUrl: eventErrorDialogTemplate, - locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, - parent: angular.element($document[0].body), - fullscreen: true, - targetEvent: $event, - multiple: true, - onShowing: function(scope, element) { - onShowingCallback.onShowing(scope, element); - } - }); + function showDialog() { + $mdDialog.show({ + controller: 'EventContentDialogController', + controllerAs: 'vm', + templateUrl: eventErrorDialogTemplate, + locals: {content: content, title: title, contentType: contentType, showingCallback: onShowingCallback}, + parent: angular.element($document[0].body), + fullscreen: true, + targetEvent: $event, + multiple: true, + onShowing: function(scope, element) { + onShowingCallback.onShowing(scope, element); + } + }); + } + function showError() { + toast.showError($translate.instant('edge.load-entity-error')); + } } scope.checkTooltip = function($event) { diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index bea55fd30e..f8d1c8568a 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -821,7 +821,7 @@ "make-private-edge-text": "After the confirmation the edge and all its data will be made private and won't be accessible by others.", "import": "Import edge", "label": "Label", - "load-entity-error": "Could not load entity info", + "load-entity-error": "Entity not found. Failed to load info", "assign-new-edge": "Assign new edge", "manage-edge-dashboards": "Manage edge dashboards", "unassign-from-edge": "Unassign from edge", From 48cced2d0c5a89fabe2d249701d4e95f40d2ba95 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Tue, 21 Jul 2020 11:59:04 +0300 Subject: [PATCH 8/9] Minor code fix --- ui/src/app/event/event-row.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/event/event-row.directive.js b/ui/src/app/event/event-row.directive.js index b1b6311e5e..92da9c06b9 100644 --- a/ui/src/app/event/event-row.directive.js +++ b/ui/src/app/event/event-row.directive.js @@ -114,7 +114,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ }); break; default: - content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreLoading: true, ignoreErrors: true}).then( + content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreErrors: true}).then( function success(info) { showDialog(); return angular.toJson(info); From ac18f1aa95a18ee03c72b2a9eff7fb5d03f9e64f Mon Sep 17 00:00:00 2001 From: deaflynx Date: Wed, 29 Jul 2020 12:36:48 +0300 Subject: [PATCH 9/9] Added edgeAttributeKeys constants --- ui/src/app/common/types.constant.js | 6 ++++++ ui/src/app/event/event-table.directive.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/app/common/types.constant.js b/ui/src/app/common/types.constant.js index f48f3e9f03..59f1111ab4 100644 --- a/ui/src/app/common/types.constant.js +++ b/ui/src/app/common/types.constant.js @@ -402,6 +402,12 @@ export default angular.module('thingsboard.types', []) attributesDeleted: "ATTRIBUTES_DELETED", timeseriesUpdated: "TIMESERIES_UPDATED" }, + edgeAttributeKeys: { + active: "active", + lastConnectTime: "lastConnectTime", + lastDisconnectTime: "lastDisconnectTime", + queueStartTs: "queueStartTs" + }, importEntityColumnType: { name: { name: 'import.column-type.name', diff --git a/ui/src/app/event/event-table.directive.js b/ui/src/app/event/event-table.directive.js index 1cd61c888e..9c7c57d5d7 100644 --- a/ui/src/app/event/event-table.directive.js +++ b/ui/src/app/event/event-table.directive.js @@ -225,7 +225,7 @@ export default function EventTableDirective($compile, $templateCache, $rootScope scope.loadEdgeInfo = function() { attributeService.getEntityAttributesValues(scope.entityType, scope.entityId, types.attributesScope.server.value, - ["queueStartTs"], {}) + types.edgeAttributeKeys.queueStartTs, {}) .then(function success(attributes) { scope.onUpdate(attributes); });