|
|
@ -43,7 +43,13 @@ import { RuleChainService } from '@core/http/rule-chain.service'; |
|
|
import { AliasInfo, StateParams, SubscriptionInfo } from '@core/api/widget-api.models'; |
|
|
import { AliasInfo, StateParams, SubscriptionInfo } from '@core/api/widget-api.models'; |
|
|
import { DataKey, Datasource, DatasourceType, KeyInfo } from '@app/shared/models/widget.models'; |
|
|
import { DataKey, Datasource, DatasourceType, KeyInfo } from '@app/shared/models/widget.models'; |
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
import { UtilsService } from '@core/services/utils.service'; |
|
|
import { AliasFilterType, EntityAlias, EntityAliasFilter, EntityAliasFilterResult } from '@shared/models/alias.models'; |
|
|
import { |
|
|
|
|
|
AliasFilterType, |
|
|
|
|
|
edgeAliasFilterTypes, |
|
|
|
|
|
EntityAlias, |
|
|
|
|
|
EntityAliasFilter, |
|
|
|
|
|
EntityAliasFilterResult |
|
|
|
|
|
} from '@shared/models/alias.models'; |
|
|
import { |
|
|
import { |
|
|
EdgeImportEntityData, |
|
|
EdgeImportEntityData, |
|
|
EntitiesKeysByQuery, |
|
|
EntitiesKeysByQuery, |
|
|
@ -495,7 +501,16 @@ export class EntityService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public getAliasFilterTypesByEntityTypes(entityTypes: Array<EntityType | AliasEntityType>): Array<AliasFilterType> { |
|
|
public getAliasFilterTypesByEntityTypes(entityTypes: Array<EntityType | AliasEntityType>): Array<AliasFilterType> { |
|
|
const allAliasFilterTypes: Array<AliasFilterType> = Object.keys(AliasFilterType).map((key) => AliasFilterType[key]); |
|
|
const authState = getCurrentAuthState(this.store); |
|
|
|
|
|
const allAliasFilterTypes: Array<AliasFilterType> = Object.keys(AliasFilterType) |
|
|
|
|
|
.map((key) => AliasFilterType[key]) |
|
|
|
|
|
.filter(aft => { |
|
|
|
|
|
if (authState.edgesSupportEnabled) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} else { |
|
|
|
|
|
return edgeAliasFilterTypes.indexOf(aft) === -1; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
if (!entityTypes || !entityTypes.length) { |
|
|
if (!entityTypes || !entityTypes.length) { |
|
|
return allAliasFilterTypes; |
|
|
return allAliasFilterTypes; |
|
|
} |
|
|
} |
|
|
@ -622,14 +637,14 @@ export class EntityService { |
|
|
case Authority.TENANT_ADMIN: |
|
|
case Authority.TENANT_ADMIN: |
|
|
entityTypes.push(EntityType.DEVICE); |
|
|
entityTypes.push(EntityType.DEVICE); |
|
|
entityTypes.push(EntityType.ASSET); |
|
|
entityTypes.push(EntityType.ASSET); |
|
|
if (authState.edgesSupportEnabled) { |
|
|
|
|
|
entityTypes.push(EntityType.EDGE); |
|
|
|
|
|
} |
|
|
|
|
|
entityTypes.push(EntityType.ENTITY_VIEW); |
|
|
entityTypes.push(EntityType.ENTITY_VIEW); |
|
|
entityTypes.push(EntityType.TENANT); |
|
|
entityTypes.push(EntityType.TENANT); |
|
|
entityTypes.push(EntityType.CUSTOMER); |
|
|
entityTypes.push(EntityType.CUSTOMER); |
|
|
entityTypes.push(EntityType.USER); |
|
|
entityTypes.push(EntityType.USER); |
|
|
entityTypes.push(EntityType.DASHBOARD); |
|
|
entityTypes.push(EntityType.DASHBOARD); |
|
|
|
|
|
if (authState.edgesSupportEnabled) { |
|
|
|
|
|
entityTypes.push(EntityType.EDGE); |
|
|
|
|
|
} |
|
|
if (useAliasEntityTypes) { |
|
|
if (useAliasEntityTypes) { |
|
|
entityTypes.push(AliasEntityType.CURRENT_CUSTOMER); |
|
|
entityTypes.push(AliasEntityType.CURRENT_CUSTOMER); |
|
|
entityTypes.push(AliasEntityType.CURRENT_TENANT); |
|
|
entityTypes.push(AliasEntityType.CURRENT_TENANT); |
|
|
@ -638,13 +653,13 @@ export class EntityService { |
|
|
case Authority.CUSTOMER_USER: |
|
|
case Authority.CUSTOMER_USER: |
|
|
entityTypes.push(EntityType.DEVICE); |
|
|
entityTypes.push(EntityType.DEVICE); |
|
|
entityTypes.push(EntityType.ASSET); |
|
|
entityTypes.push(EntityType.ASSET); |
|
|
if (authState.edgesSupportEnabled) { |
|
|
|
|
|
entityTypes.push(EntityType.EDGE); |
|
|
|
|
|
} |
|
|
|
|
|
entityTypes.push(EntityType.ENTITY_VIEW); |
|
|
entityTypes.push(EntityType.ENTITY_VIEW); |
|
|
entityTypes.push(EntityType.CUSTOMER); |
|
|
entityTypes.push(EntityType.CUSTOMER); |
|
|
entityTypes.push(EntityType.USER); |
|
|
entityTypes.push(EntityType.USER); |
|
|
entityTypes.push(EntityType.DASHBOARD); |
|
|
entityTypes.push(EntityType.DASHBOARD); |
|
|
|
|
|
if (authState.edgesSupportEnabled) { |
|
|
|
|
|
entityTypes.push(EntityType.EDGE); |
|
|
|
|
|
} |
|
|
if (useAliasEntityTypes) { |
|
|
if (useAliasEntityTypes) { |
|
|
entityTypes.push(AliasEntityType.CURRENT_CUSTOMER); |
|
|
entityTypes.push(AliasEntityType.CURRENT_CUSTOMER); |
|
|
} |
|
|
} |
|
|
|