|
|
@ -26,11 +26,13 @@ import eventRowEdgeEventTemplate from './event-row-edge-event.tpl.html'; |
|
|
/* eslint-enable import/no-unresolved, import/default */ |
|
|
/* eslint-enable import/no-unresolved, import/default */ |
|
|
|
|
|
|
|
|
/*@ngInject*/ |
|
|
/*@ngInject*/ |
|
|
export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, |
|
|
export default function EventRowDirective($compile, $templateCache, $mdDialog, $document, $translate, $log, |
|
|
types, toast, entityService, ruleChainService) { |
|
|
types, toast, entityService, ruleChainService, userService, attributeService) { |
|
|
|
|
|
|
|
|
var linker = function (scope, element, attrs) { |
|
|
var linker = function (scope, element, attrs) { |
|
|
|
|
|
|
|
|
|
|
|
var lastDisconnectTime; |
|
|
|
|
|
|
|
|
var getTemplate = function(eventType) { |
|
|
var getTemplate = function(eventType) { |
|
|
var template = ''; |
|
|
var template = ''; |
|
|
switch(eventType) { |
|
|
switch(eventType) { |
|
|
@ -50,6 +52,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $ |
|
|
template = eventRowDebugRuleNodeTemplate; |
|
|
template = eventRowDebugRuleNodeTemplate; |
|
|
break; |
|
|
break; |
|
|
case types.eventType.edgeEvent.value: |
|
|
case types.eventType.edgeEvent.value: |
|
|
|
|
|
getLastDisconnectTime(); |
|
|
template = eventRowEdgeEventTemplate; |
|
|
template = eventRowEdgeEventTemplate; |
|
|
break; |
|
|
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) { |
|
|
scope.checkTooltip = function($event) { |
|
|
var el = $event.target; |
|
|
var el = $event.target; |
|
|
var $el = angular.element(el); |
|
|
var $el = angular.element(el); |
|
|
|