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);