|
|
|
@ -20,8 +20,9 @@ export default angular.module('thingsboard.api.entity', [thingsboardTypes]) |
|
|
|
.name; |
|
|
|
|
|
|
|
/*@ngInject*/ |
|
|
|
function EntityService($http, $q, $filter, $translate, $log, userService, deviceService, |
|
|
|
assetService, tenantService, customerService, ruleChainService, dashboardService, entityRelationService, attributeService, types, utils) { |
|
|
|
function EntityService($http, $q, $filter, $translate, $log, userService, deviceService, assetService, tenantService, |
|
|
|
customerService, ruleChainService, dashboardService, entityRelationService, attributeService, |
|
|
|
entityViewService, types, utils) { |
|
|
|
var service = { |
|
|
|
getEntity: getEntity, |
|
|
|
getEntities: getEntities, |
|
|
|
@ -54,6 +55,9 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
case types.entityType.asset: |
|
|
|
promise = assetService.getAsset(entityId, true, config); |
|
|
|
break; |
|
|
|
case types.entityType.entityView: |
|
|
|
promise = entityViewService.getEntityView(entityId, true, config); |
|
|
|
break; |
|
|
|
case types.entityType.tenant: |
|
|
|
promise = tenantService.getTenant(entityId, config); |
|
|
|
break; |
|
|
|
@ -239,6 +243,13 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
promise = assetService.getTenantAssets(pageLink, false, config, subType); |
|
|
|
} |
|
|
|
break; |
|
|
|
case types.entityType.entityView: |
|
|
|
if (user.authority === 'CUSTOMER_USER') { |
|
|
|
promise = entityViewService.getCustomerEntityViews(customerId, pageLink, false, config, subType); |
|
|
|
} else { |
|
|
|
promise = entityViewService.getTenantEntityViews(pageLink, false, config, subType); |
|
|
|
} |
|
|
|
break; |
|
|
|
case types.entityType.tenant: |
|
|
|
if (user.authority === 'TENANT_ADMIN') { |
|
|
|
promise = getSingleTenantByPageLinkPromise(pageLink, config); |
|
|
|
@ -725,6 +736,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
case 'TENANT_ADMIN': |
|
|
|
entityTypes.device = types.entityType.device; |
|
|
|
entityTypes.asset = types.entityType.asset; |
|
|
|
entityTypes.entityView = types.entityType.entityView; |
|
|
|
entityTypes.tenant = types.entityType.tenant; |
|
|
|
entityTypes.customer = types.entityType.customer; |
|
|
|
entityTypes.dashboard = types.entityType.dashboard; |
|
|
|
@ -735,6 +747,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device |
|
|
|
case 'CUSTOMER_USER': |
|
|
|
entityTypes.device = types.entityType.device; |
|
|
|
entityTypes.asset = types.entityType.asset; |
|
|
|
entityTypes.entityView = types.entityType.entityView; |
|
|
|
entityTypes.customer = types.entityType.customer; |
|
|
|
entityTypes.dashboard = types.entityType.dashboard; |
|
|
|
if (useAliasEntityTypes) { |
|
|
|
|