Showing
10 changed files
with
178 additions
and
129 deletions
... | ... | @@ -96,6 +96,7 @@ export default class AliasController { |
96 | 96 | function success(aliasInfo) { |
97 | 97 | aliasCtrl.resolvedAliases[aliasId] = aliasInfo; |
98 | 98 | if (entityAlias.filter.stateEntity) { |
99 | + aliasInfo.stateEntity = true; | |
99 | 100 | aliasCtrl.resolvedAliasesToStateEntities[aliasId] = |
100 | 101 | aliasCtrl.stateController.getStateParams().entityId; |
101 | 102 | } |
... | ... | @@ -120,12 +121,13 @@ export default class AliasController { |
120 | 121 | function success(aliasInfo) { |
121 | 122 | datasource.aliasName = aliasInfo.alias; |
122 | 123 | if (aliasInfo.resolveMultiple) { |
124 | + var newDatasource; | |
123 | 125 | var resolvedEntities = aliasInfo.resolvedEntities; |
124 | 126 | if (resolvedEntities && resolvedEntities.length) { |
125 | 127 | var datasources = []; |
126 | 128 | for (var i=0;i<resolvedEntities.length;i++) { |
127 | 129 | var resolvedEntity = resolvedEntities[i]; |
128 | - var newDatasource = angular.copy(datasource); | |
130 | + newDatasource = angular.copy(datasource); | |
129 | 131 | newDatasource.entityId = resolvedEntity.id; |
130 | 132 | newDatasource.entityType = resolvedEntity.entityType; |
131 | 133 | newDatasource.entityName = resolvedEntity.name; |
... | ... | @@ -135,15 +137,30 @@ export default class AliasController { |
135 | 137 | } |
136 | 138 | deferred.resolve(datasources); |
137 | 139 | } else { |
138 | - deferred.reject(); | |
140 | + if (aliasInfo.stateEntity) { | |
141 | + newDatasource = angular.copy(datasource); | |
142 | + newDatasource.unresolvedStateEntity = true; | |
143 | + deferred.resolve([newDatasource]); | |
144 | + } else { | |
145 | + deferred.reject(); | |
146 | + } | |
139 | 147 | } |
140 | 148 | } else { |
141 | 149 | var entity = aliasInfo.currentEntity; |
142 | - datasource.entityId = entity.id; | |
143 | - datasource.entityType = entity.entityType; | |
144 | - datasource.entityName = entity.name; | |
145 | - datasource.name = entity.name; | |
146 | - deferred.resolve([datasource]); | |
150 | + if (entity) { | |
151 | + datasource.entityId = entity.id; | |
152 | + datasource.entityType = entity.entityType; | |
153 | + datasource.entityName = entity.name; | |
154 | + datasource.name = entity.name; | |
155 | + deferred.resolve([datasource]); | |
156 | + } else { | |
157 | + if (aliasInfo.stateEntity) { | |
158 | + datasource.unresolvedStateEntity = true; | |
159 | + deferred.resolve([datasource]); | |
160 | + } else { | |
161 | + deferred.reject(); | |
162 | + } | |
163 | + } | |
147 | 164 | } |
148 | 165 | }, |
149 | 166 | function fail() { | ... | ... |
... | ... | @@ -29,10 +29,9 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
29 | 29 | getEntitiesByNameFilter: getEntitiesByNameFilter, |
30 | 30 | resolveAlias: resolveAlias, |
31 | 31 | resolveAliasFilter: resolveAliasFilter, |
32 | + checkEntityAlias: checkEntityAlias, | |
32 | 33 | filterAliasByEntityTypes: filterAliasByEntityTypes, |
33 | - //processEntityAliases: processEntityAliases, | |
34 | 34 | getEntityKeys: getEntityKeys, |
35 | - checkEntityAlias: checkEntityAlias, | |
36 | 35 | createDatasourcesFromSubscriptionsInfo: createDatasourcesFromSubscriptionsInfo, |
37 | 36 | getRelatedEntities: getRelatedEntities, |
38 | 37 | saveRelatedEntity: saveRelatedEntity, |
... | ... | @@ -259,7 +258,32 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
259 | 258 | return entitiesInfo; |
260 | 259 | } |
261 | 260 | |
262 | - function resolveAliasFilter(filter, stateParams) { | |
261 | + function resolveAlias(entityAlias, stateParams) { | |
262 | + var deferred = $q.defer(); | |
263 | + var filter = entityAlias.filter; | |
264 | + resolveAliasFilter(filter, stateParams, 100).then( | |
265 | + function (result) { | |
266 | + var entities = result.entities; | |
267 | + var aliasInfo = { | |
268 | + alias: entityAlias.alias, | |
269 | + resolveMultiple: filter.resolveMultiple | |
270 | + }; | |
271 | + var resolvedEntities = entitiesToEntitiesInfo(entities); | |
272 | + aliasInfo.resolvedEntities = resolvedEntities; | |
273 | + aliasInfo.currentEntity = null; | |
274 | + if (aliasInfo.resolvedEntities.length) { | |
275 | + aliasInfo.currentEntity = aliasInfo.resolvedEntities[0]; | |
276 | + } | |
277 | + deferred.resolve(aliasInfo); | |
278 | + }, | |
279 | + function fail() { | |
280 | + deferred.reject(); | |
281 | + } | |
282 | + ); | |
283 | + return deferred.promise; | |
284 | + } | |
285 | + | |
286 | + function resolveAliasFilter(filter, stateParams, maxItems) { | |
263 | 287 | var deferred = $q.defer(); |
264 | 288 | var result = { |
265 | 289 | entities: [], |
... | ... | @@ -299,7 +323,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
299 | 323 | } |
300 | 324 | break; |
301 | 325 | case types.aliasFilterType.entityName.value: |
302 | - getEntitiesByNameFilter(filter.entityType, filter.entityNameFilter, 100).then( | |
326 | + getEntitiesByNameFilter(filter.entityType, filter.entityNameFilter, maxItems).then( | |
303 | 327 | function success(entities) { |
304 | 328 | if (entities && entities.length) { |
305 | 329 | result.entities = entities; |
... | ... | @@ -318,31 +342,6 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
318 | 342 | return deferred.promise; |
319 | 343 | } |
320 | 344 | |
321 | - function resolveAlias(entityAlias, stateParams) { | |
322 | - var deferred = $q.defer(); | |
323 | - var filter = entityAlias.filter; | |
324 | - resolveAliasFilter(filter, stateParams).then( | |
325 | - function (result) { | |
326 | - var entities = result.entities; | |
327 | - var aliasInfo = { | |
328 | - alias: entityAlias.alias, | |
329 | - resolveMultiple: filter.resolveMultiple | |
330 | - }; | |
331 | - var resolvedEntities = entitiesToEntitiesInfo(entities); | |
332 | - aliasInfo.resolvedEntities = resolvedEntities; | |
333 | - aliasInfo.currentEntity = null; | |
334 | - if (aliasInfo.resolvedEntities.length) { | |
335 | - aliasInfo.currentEntity = aliasInfo.resolvedEntities[0]; | |
336 | - } | |
337 | - deferred.resolve(aliasInfo); | |
338 | - }, | |
339 | - function fail() { | |
340 | - deferred.reject(); | |
341 | - } | |
342 | - ); | |
343 | - return deferred.promise; | |
344 | - } | |
345 | - | |
346 | 345 | function filterAliasByEntityTypes(entityAlias, entityTypes) { |
347 | 346 | var filter = entityAlias.filter; |
348 | 347 | switch (filter.type) { |
... | ... | @@ -359,6 +358,28 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
359 | 358 | return false; |
360 | 359 | } |
361 | 360 | |
361 | + function checkEntityAlias(entityAlias) { | |
362 | + var deferred = $q.defer(); | |
363 | + resolveAliasFilter(entityAlias.filter, null, 1).then( | |
364 | + function success(result) { | |
365 | + if (result.stateEntity) { | |
366 | + deferred.resolve(true); | |
367 | + } else { | |
368 | + var entities = result.entities; | |
369 | + if (entities && entities.length) { | |
370 | + deferred.resolve(true); | |
371 | + } else { | |
372 | + deferred.resolve(false); | |
373 | + } | |
374 | + } | |
375 | + }, | |
376 | + function fail() { | |
377 | + deferred.resolve(false); | |
378 | + } | |
379 | + ); | |
380 | + return deferred.promise; | |
381 | + } | |
382 | + | |
362 | 383 | /*function processEntityAlias(index, aliasIds, entityAliases, stateParams, resolution, deferred) { |
363 | 384 | if (index < aliasIds.length) { |
364 | 385 | var aliasId = aliasIds[index]; |
... | ... | @@ -433,33 +454,6 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
433 | 454 | return deferred.promise; |
434 | 455 | } |
435 | 456 | |
436 | - function checkEntityAlias(entityAlias) { | |
437 | - var deferred = $q.defer(); | |
438 | - var entityType = entityAlias.entityType; | |
439 | - var entityFilter = entityAlias.entityFilter; | |
440 | - var promise; | |
441 | - if (entityFilter.useFilter) { | |
442 | - var entityNameFilter = entityFilter.entityNameFilter; | |
443 | - promise = getEntitiesByNameFilter(entityType, entityNameFilter, 1); | |
444 | - } else { | |
445 | - var entityList = entityFilter.entityList; | |
446 | - promise = getEntities(entityType, entityList); | |
447 | - } | |
448 | - promise.then( | |
449 | - function success(entities) { | |
450 | - if (entities && entities.length > 0) { | |
451 | - deferred.resolve(true); | |
452 | - } else { | |
453 | - deferred.resolve(false); | |
454 | - } | |
455 | - }, | |
456 | - function fail() { | |
457 | - deferred.resolve(false); | |
458 | - } | |
459 | - ); | |
460 | - return deferred.promise; | |
461 | - } | |
462 | - | |
463 | 457 | function createDatasourcesFromSubscriptionsInfo(subscriptionsInfo) { |
464 | 458 | var deferred = $q.defer(); |
465 | 459 | var datasources = []; | ... | ... |
... | ... | @@ -125,17 +125,22 @@ export default class Subscription { |
125 | 125 | |
126 | 126 | initDataSubscription() { |
127 | 127 | var deferred = this.ctx.$q.defer(); |
128 | - var subscription = this; | |
129 | - this.ctx.aliasController.resolveDatasources(this.datasources).then( | |
130 | - function success(datasources) { | |
131 | - subscription.datasources = datasources; | |
132 | - subscription.configureData(); | |
133 | - deferred.resolve(); | |
134 | - }, | |
135 | - function fail() { | |
136 | - deferred.reject(); | |
137 | - } | |
138 | - ); | |
128 | + if (!this.ctx.aliasController) { | |
129 | + this.configureData(); | |
130 | + deferred.resolve(); | |
131 | + } else { | |
132 | + var subscription = this; | |
133 | + this.ctx.aliasController.resolveDatasources(this.datasources).then( | |
134 | + function success(datasources) { | |
135 | + subscription.datasources = datasources; | |
136 | + subscription.configureData(); | |
137 | + deferred.resolve(); | |
138 | + }, | |
139 | + function fail() { | |
140 | + deferred.reject(); | |
141 | + } | |
142 | + ); | |
143 | + } | |
139 | 144 | return deferred.promise; |
140 | 145 | } |
141 | 146 | ... | ... |
... | ... | @@ -57,6 +57,9 @@ function DashboardUtils(types, utils, timeService) { |
57 | 57 | for (aliasId in entityAliases) { |
58 | 58 | entityAlias = entityAliases[aliasId]; |
59 | 59 | entityAliases[aliasId] = validateAndUpdateEntityAlias(entityAlias); |
60 | + if (!entityAliases[aliasId].id) { | |
61 | + entityAliases[aliasId].id = aliasId; | |
62 | + } | |
60 | 63 | } |
61 | 64 | } |
62 | 65 | return configuration; |
... | ... | @@ -202,6 +205,12 @@ function DashboardUtils(types, utils, timeService) { |
202 | 205 | states[firstStateId].root = true; |
203 | 206 | } |
204 | 207 | } |
208 | + | |
209 | + /* var datasources = {}; | |
210 | + for (var widgetId in dashboard.configuration.widgets) { | |
211 | + | |
212 | + }*/ | |
213 | + | |
205 | 214 | dashboard.configuration = validateAndUpdateEntityAliases(dashboard.configuration); |
206 | 215 | |
207 | 216 | if (angular.isUndefined(dashboard.configuration.timewindow)) { | ... | ... |
... | ... | @@ -38,6 +38,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
38 | 38 | |
39 | 39 | var gridsterItemInited = false; |
40 | 40 | var subscriptionInited = false; |
41 | + var widgetSizeDetected = false; | |
41 | 42 | |
42 | 43 | var cafs = {}; |
43 | 44 | |
... | ... | @@ -206,9 +207,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
206 | 207 | |
207 | 208 | initialize().then( |
208 | 209 | function(){ |
209 | - if (checkSize()) { | |
210 | - onInit(); | |
211 | - } | |
210 | + onInit(); | |
212 | 211 | } |
213 | 212 | ); |
214 | 213 | |
... | ... | @@ -488,10 +487,15 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
488 | 487 | $scope.widgetErrorData = utils.processWidgetException(e); |
489 | 488 | } |
490 | 489 | |
491 | - function onInit() { | |
492 | - if (!widgetContext.inited && | |
493 | - subscriptionInited && | |
494 | - gridsterItemInited) { | |
490 | + function isReady() { | |
491 | + return subscriptionInited && gridsterItemInited && widgetSizeDetected; | |
492 | + } | |
493 | + | |
494 | + function onInit(skipSizeCheck) { | |
495 | + if (!skipSizeCheck) { | |
496 | + checkSize(); | |
497 | + } | |
498 | + if (!widgetContext.inited && isReady()) { | |
495 | 499 | widgetContext.inited = true; |
496 | 500 | try { |
497 | 501 | widgetTypeInstance.onInit(); |
... | ... | @@ -516,6 +520,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
516 | 520 | widgetContext.width = width; |
517 | 521 | widgetContext.height = height; |
518 | 522 | sizeChanged = true; |
523 | + widgetSizeDetected = true; | |
519 | 524 | } |
520 | 525 | } |
521 | 526 | return sizeChanged; |
... | ... | @@ -536,7 +541,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
536 | 541 | } |
537 | 542 | }); |
538 | 543 | } else { |
539 | - onInit(); | |
544 | + onInit(true); | |
540 | 545 | } |
541 | 546 | } |
542 | 547 | } |
... | ... | @@ -545,9 +550,7 @@ export default function WidgetController($scope, $timeout, $window, $element, $q |
545 | 550 | if (item && item.gridster) { |
546 | 551 | widgetContext.isMobile = item.gridster.isMobile; |
547 | 552 | gridsterItemInited = true; |
548 | - if (checkSize()) { | |
549 | - onInit(); | |
550 | - } | |
553 | + onInit(); | |
551 | 554 | // gridsterItemElement = $(item.$element); |
552 | 555 | //updateVisibility(); |
553 | 556 | } | ... | ... |
... | ... | @@ -344,6 +344,8 @@ export default function DashboardController(types, utils, dashboardUtils, widget |
344 | 344 | vm.dashboardConfiguration = vm.dashboard.configuration; |
345 | 345 | vm.dashboardCtx.dashboard = vm.dashboard; |
346 | 346 | vm.dashboardCtx.dashboardTimewindow = vm.dashboardConfiguration.timewindow; |
347 | + vm.dashboardCtx.aliasController = new AliasController($scope, $q, $filter, utils, | |
348 | + types, entityService, vm.dashboardCtx.stateController, vm.dashboardConfiguration.entityAliases); | |
347 | 349 | var parentScope = $window.parent.angular.element($window.frameElement).scope(); |
348 | 350 | parentScope.$root.$broadcast('widgetEditModeInited'); |
349 | 351 | parentScope.$root.$apply(); | ... | ... |
... | ... | @@ -22,7 +22,8 @@ import selectTargetLayoutTemplate from '../../dashboard/layouts/select-target-la |
22 | 22 | /* eslint-enable import/no-unresolved, import/default */ |
23 | 23 | |
24 | 24 | /*@ngInject*/ |
25 | -export default function AddWidgetToDashboardDialogController($scope, $mdDialog, $state, $q, $document, itembuffer, dashboardService, entityId, entityType, entityName, widget) { | |
25 | +export default function AddWidgetToDashboardDialogController($scope, $mdDialog, $state, $q, $document, | |
26 | + types, itembuffer, dashboardService, entityId, entityType, entityName, widget) { | |
26 | 27 | |
27 | 28 | var vm = this; |
28 | 29 | |
... | ... | @@ -125,12 +126,14 @@ export default function AddWidgetToDashboardDialogController($scope, $mdDialog, |
125 | 126 | targetDeviceAliases: {} |
126 | 127 | }; |
127 | 128 | aliasesInfo.datasourceAliases[0] = { |
128 | - aliasName: entityName, | |
129 | - entityType: entityType, | |
130 | - entityFilter: { | |
131 | - useFilter: false, | |
132 | - entityNameFilter: '', | |
133 | - entityList: [entityId] | |
129 | + id: 1, | |
130 | + alias: entityName, | |
131 | + filter: { | |
132 | + type: types.aliasFilterType.entityList.value, | |
133 | + stateEntity: false, | |
134 | + entityList: [entityId], | |
135 | + entityType: entityType, | |
136 | + resolveMultiple: false | |
134 | 137 | } |
135 | 138 | }; |
136 | 139 | itembuffer.addWidgetToDashboard(theDashboard, targetState, targetLayout, vm.widget, aliasesInfo, null, 48, null, -1, -1).then( | ... | ... |
... | ... | @@ -64,7 +64,7 @@ export default function EntityFilterDialogController($scope, $mdDialog, $q, enti |
64 | 64 | entity: null, |
65 | 65 | stateEntity: false |
66 | 66 | } |
67 | - entityService.resolveAliasFilter(vm.filter).then( | |
67 | + entityService.resolveAliasFilter(vm.filter, null, 1).then( | |
68 | 68 | function success(result) { |
69 | 69 | validationResult.stateEntity = result.stateEntity; |
70 | 70 | var entities = result.entities; | ... | ... |
... | ... | @@ -359,30 +359,50 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
359 | 359 | } |
360 | 360 | |
361 | 361 | function prepareEntityAlias(aliasInfo) { |
362 | - var entityFilter; | |
363 | - var entityType; | |
362 | + var alias; | |
363 | + var filter; | |
364 | 364 | if (aliasInfo.deviceId) { |
365 | - entityFilter = { | |
366 | - useFilter: false, | |
367 | - entityNameFilter: '', | |
368 | - entityList: [aliasInfo.deviceId] | |
369 | - } | |
370 | - entityType = types.entityType.device; | |
365 | + alias = aliasInfo.aliasName; | |
366 | + filter = { | |
367 | + type: types.aliasFilterType.entityList.value, | |
368 | + stateEntity: false, | |
369 | + entityType: types.entityType.device, | |
370 | + entityList: [aliasInfo.deviceId], | |
371 | + resolveMultiple: false | |
372 | + }; | |
371 | 373 | } else if (aliasInfo.deviceFilter) { |
372 | - entityFilter = { | |
373 | - useFilter: aliasInfo.deviceFilter.useFilter, | |
374 | - entityNameFilter: aliasInfo.deviceFilter.deviceNameFilter, | |
375 | - entityList: aliasInfo.deviceFilter.deviceList | |
374 | + alias = aliasInfo.aliasName; | |
375 | + filter = { | |
376 | + type: aliasInfo.deviceFilter.useFilter ? types.aliasFilterType.entityName.value : types.aliasFilterType.entityList.value, | |
377 | + entityType: types.entityType.device, | |
378 | + resolveMultiple: false | |
379 | + } | |
380 | + if (filter.type == types.aliasFilterType.entityList.value) { | |
381 | + filter.stateEntity = false; | |
382 | + filter.entityList = aliasInfo.deviceFilter.deviceList | |
383 | + } else { | |
384 | + filter.entityNameFilter = aliasInfo.deviceFilter.deviceNameFilter; | |
385 | + } | |
386 | + } else if (aliasInfo.entityFilter) { | |
387 | + alias = aliasInfo.aliasName; | |
388 | + filter = { | |
389 | + type: aliasInfo.entityFilter.useFilter ? types.aliasFilterType.entityName.value : types.aliasFilterType.entityList.value, | |
390 | + entityType: aliasInfo.entityType, | |
391 | + resolveMultiple: false | |
392 | + } | |
393 | + if (filter.type == types.aliasFilterType.entityList.value) { | |
394 | + filter.stateEntity = false; | |
395 | + filter.entityList = aliasInfo.entityFilter.entityList; | |
396 | + } else { | |
397 | + filter.entityNameFilter = aliasInfo.entityFilter.entityNameFilter; | |
376 | 398 | } |
377 | - entityType = types.entityType.device; | |
378 | 399 | } else { |
379 | - entityFilter = aliasInfo.entityFilter; | |
380 | - entityType = aliasInfo.entityType; | |
400 | + alias = aliasInfo.alias; | |
401 | + filter = aliasInfo.filter; | |
381 | 402 | } |
382 | 403 | return { |
383 | - aliasName: aliasInfo.aliasName, | |
384 | - entityType: entityType, | |
385 | - entityFilter: entityFilter | |
404 | + alias: alias, | |
405 | + filter: filter | |
386 | 406 | }; |
387 | 407 | } |
388 | 408 | |
... | ... | @@ -411,6 +431,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
411 | 431 | for (datasourceIndex in datasourceAliases) { |
412 | 432 | datasourceAliasesMap[aliasId] = datasourceIndex; |
413 | 433 | entityAliases[aliasId] = datasourceAliases[datasourceIndex]; |
434 | + entityAliases[aliasId].id = aliasId; | |
414 | 435 | aliasId++; |
415 | 436 | } |
416 | 437 | } |
... | ... | @@ -418,6 +439,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
418 | 439 | for (datasourceIndex in targetDeviceAliases) { |
419 | 440 | targetDeviceAliasesMap[aliasId] = datasourceIndex; |
420 | 441 | entityAliases[aliasId] = targetDeviceAliases[datasourceIndex]; |
442 | + entityAliases[aliasId].id = aliasId; | |
421 | 443 | aliasId++; |
422 | 444 | } |
423 | 445 | } |
... | ... | @@ -435,12 +457,10 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
435 | 457 | var datasourceIndex; |
436 | 458 | if (datasourceAliasesMap[aliasId]) { |
437 | 459 | datasourceIndex = datasourceAliasesMap[aliasId]; |
438 | - datasourceAliases[datasourceIndex].entityType = entityAlias.entityType; | |
439 | - datasourceAliases[datasourceIndex].entityFilter = entityAlias.entityFilter; | |
460 | + datasourceAliases[datasourceIndex] = entityAlias; | |
440 | 461 | } else if (targetDeviceAliasesMap[aliasId]) { |
441 | 462 | datasourceIndex = targetDeviceAliasesMap[aliasId]; |
442 | - targetDeviceAliases[datasourceIndex].entityType = entityAlias.entityType; | |
443 | - targetDeviceAliases[datasourceIndex].entityFilter = entityAlias.entityFilter; | |
463 | + targetDeviceAliases[datasourceIndex] = entityAlias; | |
444 | 464 | } |
445 | 465 | } |
446 | 466 | addImportedWidget(dashboard, targetState, targetLayoutFunction, $event, widget, |
... | ... | @@ -622,7 +642,7 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document, |
622 | 642 | checkNextEntityAliasOrComplete(index, aliasIds, entityAliases, missingEntityAliases, deferred); |
623 | 643 | } else { |
624 | 644 | var missingEntityAlias = angular.copy(entityAlias); |
625 | - missingEntityAlias.entityFilter = null; | |
645 | + missingEntityAlias.filter = null; | |
626 | 646 | missingEntityAliases[aliasId] = missingEntityAlias; |
627 | 647 | checkNextEntityAliasOrComplete(index, aliasIds, entityAliases, missingEntityAliases, deferred); |
628 | 648 | } | ... | ... |
... | ... | @@ -46,16 +46,14 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils) { |
46 | 46 | aliasesInfo { |
47 | 47 | datasourceAliases: { |
48 | 48 | datasourceIndex: { |
49 | - aliasName: "...", | |
50 | - entityType: "...", | |
51 | - entityFilter: "..." | |
49 | + alias: "...", | |
50 | + filter: "..." | |
52 | 51 | } |
53 | 52 | } |
54 | 53 | targetDeviceAliases: { |
55 | 54 | targetDeviceAliasIndex: { |
56 | - aliasName: "...", | |
57 | - entityType: "...", | |
58 | - entityFilter: "..." | |
55 | + alias: "...", | |
56 | + filter: "..." | |
59 | 57 | } |
60 | 58 | } |
61 | 59 | .... |
... | ... | @@ -64,9 +62,8 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils) { |
64 | 62 | |
65 | 63 | function prepareAliasInfo(entityAlias) { |
66 | 64 | return { |
67 | - aliasName: entityAlias.alias, | |
68 | - entityType: entityAlias.entityType, | |
69 | - entityFilter: entityAlias.entityFilter | |
65 | + alias: entityAlias.alias, | |
66 | + filter: entityAlias.filter | |
70 | 67 | }; |
71 | 68 | } |
72 | 69 | |
... | ... | @@ -288,8 +285,7 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils) { |
288 | 285 | } |
289 | 286 | |
290 | 287 | function isEntityAliasEqual(alias1, alias2) { |
291 | - return alias1.entityType === alias2.entityType && | |
292 | - angular.equals(alias1.entityFilter, alias2.entityFilter); | |
288 | + return angular.equals(alias1.filter, alias2.filter); | |
293 | 289 | } |
294 | 290 | |
295 | 291 | function getEntityAliasId(entityAliases, aliasInfo) { |
... | ... | @@ -301,13 +297,13 @@ function ItemBuffer($q, bufferStore, types, utils, dashboardUtils) { |
301 | 297 | } |
302 | 298 | } |
303 | 299 | if (!newAliasId) { |
304 | - var newAliasName = createEntityAliasName(entityAliases, aliasInfo.aliasName); | |
300 | + var newAliasName = createEntityAliasName(entityAliases, aliasInfo.alias); | |
305 | 301 | newAliasId = 0; |
306 | 302 | for (aliasId in entityAliases) { |
307 | 303 | newAliasId = Math.max(newAliasId, aliasId); |
308 | 304 | } |
309 | 305 | newAliasId++; |
310 | - entityAliases[newAliasId] = {alias: newAliasName, entityType: aliasInfo.entityType, entityFilter: aliasInfo.entityFilter}; | |
306 | + entityAliases[newAliasId] = {id: newAliasId, alias: newAliasName, filter: aliasInfo.filter}; | |
311 | 307 | } |
312 | 308 | return newAliasId; |
313 | 309 | } | ... | ... |