Showing
1 changed file
with
14 additions
and
16 deletions
... | ... | @@ -221,39 +221,37 @@ export default function EventTableDirective($compile, $templateCache, $rootScope |
221 | 221 | } |
222 | 222 | |
223 | 223 | scope.subscriptionId = null; |
224 | - scope.queueStartTs; | |
224 | + scope.queueStartTs = 0; | |
225 | 225 | |
226 | 226 | scope.loadEdgeInfo = function() { |
227 | - attributeService.getEntityAttributesValues(scope.entityType, scope.entityId, types.attributesScope.server.value, | |
228 | - types.edgeAttributeKeys.queueStartTs, {}) | |
227 | + attributeService.getEntityAttributesValues( | |
228 | + scope.entityType, | |
229 | + scope.entityId, | |
230 | + types.attributesScope.server.value, | |
231 | + types.edgeAttributeKeys.queueStartTs, | |
232 | + {}) | |
229 | 233 | .then(function success(attributes) { |
230 | - scope.onUpdate(attributes); | |
234 | + scope.onEdgeAttributesUpdate(attributes); | |
231 | 235 | }); |
232 | 236 | |
233 | 237 | scope.checkSubscription(); |
234 | - | |
235 | - attributeService.getEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value, {order: '', limit: 1, page: 1, search: ''}, | |
236 | - function (attributes) { | |
237 | - if (attributes && attributes.data) { | |
238 | - scope.onUpdate(attributes.data); | |
239 | - } | |
240 | - }); | |
241 | 238 | } |
242 | 239 | |
243 | - scope.onUpdate = function(attributes) { | |
244 | - let edge = attributes.reduce(function (map, attribute) { | |
240 | + scope.onEdgeAttributesUpdate = function(attributes) { | |
241 | + let edgeAttributes = attributes.reduce(function (map, attribute) { | |
245 | 242 | map[attribute.key] = attribute; |
246 | 243 | return map; |
247 | 244 | }, {}); |
248 | - if (edge.queueStartTs) { | |
249 | - scope.queueStartTs = edge.queueStartTs.lastUpdateTs; | |
245 | + if (edgeAttributes.queueStartTs) { | |
246 | + scope.queueStartTs = edgeAttributes.queueStartTs.lastUpdateTs; | |
250 | 247 | } |
251 | 248 | } |
252 | 249 | |
253 | 250 | scope.checkSubscription = function() { |
254 | 251 | var newSubscriptionId = null; |
255 | 252 | if (scope.entityId && scope.entityType && types.attributesScope.server.value) { |
256 | - newSubscriptionId = attributeService.subscribeForEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value); | |
253 | + newSubscriptionId = | |
254 | + attributeService.subscribeForEntityAttributes(scope.entityType, scope.entityId, types.attributesScope.server.value); | |
257 | 255 | } |
258 | 256 | if (scope.subscriptionId && scope.subscriptionId != newSubscriptionId) { |
259 | 257 | attributeService.unsubscribeForEntityAttributes(scope.subscriptionId); | ... | ... |