diff --git a/ui-ngx/src/app/core/http/entity.service.ts b/ui-ngx/src/app/core/http/entity.service.ts index fa2dd79c53..5f8164434d 100644 --- a/ui-ngx/src/app/core/http/entity.service.ts +++ b/ui-ngx/src/app/core/http/entity.service.ts @@ -320,11 +320,11 @@ export class EntityService { break; case EntityType.RULE_CHAIN: pageLink.sortOrder.property = 'name'; - if (subType) { - entitiesObservable = this.ruleChainService.getRuleChains(pageLink, subType, config); + if (RuleChainType[subType]) { + entitiesObservable = this.ruleChainService.getRuleChains(pageLink, subType as RuleChainType, config); } else { // safe fallback to default core type - entitiesObservable = this.ruleChainService.getRuleChains(pageLink, RuleChainType.core, config); + entitiesObservable = this.ruleChainService.getRuleChains(pageLink, RuleChainType.CORE, config); } break; case EntityType.DASHBOARD: diff --git a/ui-ngx/src/app/core/http/rule-chain.service.ts b/ui-ngx/src/app/core/http/rule-chain.service.ts index d67eec5468..14a47a5e24 100644 --- a/ui-ngx/src/app/core/http/rule-chain.service.ts +++ b/ui-ngx/src/app/core/http/rule-chain.service.ts @@ -26,9 +26,9 @@ import { RuleChainConnectionInfo, RuleChainMetaData, ruleChainNodeComponent, + RuleChainType, ruleNodeTypeComponentTypes, - unknownNodeComponent, - RuleChainType + unknownNodeComponent } from '@shared/models/rule-chain.models'; import { ComponentDescriptorService } from './component-descriptor.service'; import { @@ -62,7 +62,7 @@ export class RuleChainService { private translate: TranslateService ) { } - public getRuleChains(pageLink: PageLink, type: string, config?: RequestConfig): Observable> { + public getRuleChains(pageLink: PageLink, type: RuleChainType = RuleChainType.CORE, config?: RequestConfig): Observable> { return this.http.get>(`/api/ruleChains${pageLink.toQuery()}&type=${type}`, defaultHttpOptionsFromConfig(config)); } @@ -151,7 +151,7 @@ export class RuleChainService { return this.ruleNodeConfigFactories[directive]; } - public getRuleNodeComponentByClazz(ruleChainType: RuleChainType = RuleChainType.core, clazz: string): RuleNodeComponentDescriptor { + public getRuleNodeComponentByClazz(ruleChainType: RuleChainType = RuleChainType.CORE, clazz: string): RuleNodeComponentDescriptor { const found = this.ruleNodeComponentsMap.get(ruleChainType).filter((component) => component.clazz === clazz); if (found && found.length) { return found[0]; diff --git a/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts b/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts index dc71e02d72..cc993718d4 100644 --- a/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts +++ b/ui-ngx/src/app/modules/home/components/import-export/import-export.service.ts @@ -469,7 +469,7 @@ export class ImportExportService { return false; } if (isUndefined(ruleChainImport.ruleChain.type)) { - ruleChainImport.ruleChain.type = RuleChainType.core; + ruleChainImport.ruleChain.type = RuleChainType.CORE; } return true; } diff --git a/ui-ngx/src/app/modules/home/components/rule-chain/rule-chain-autocomplete.component.ts b/ui-ngx/src/app/modules/home/components/rule-chain/rule-chain-autocomplete.component.ts index cdc8935d74..8262b89a2e 100644 --- a/ui-ngx/src/app/modules/home/components/rule-chain/rule-chain-autocomplete.component.ts +++ b/ui-ngx/src/app/modules/home/components/rule-chain/rule-chain-autocomplete.component.ts @@ -190,7 +190,7 @@ export class RuleChainAutocompleteComponent implements ControlValueAccessor, OnI this.searchText = searchText; // voba: at the moment device profiles are not supported by edge, so 'core' hardcoded return this.entityService.getEntitiesByNameFilter(EntityType.RULE_CHAIN, searchText, - 50, RuleChainType.core, {ignoreLoading: true}); + 50, RuleChainType.CORE, {ignoreLoading: true}); } clear() { diff --git a/ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts b/ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts index 2ce5c9ae38..b9b9b2f6a5 100644 --- a/ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/dialogs/add-entities-to-edge-dialog.component.ts @@ -85,7 +85,7 @@ export class AddEntitiesToEdgeDialogComponent extends case EntityType.RULE_CHAIN: this.assignToEdgeTitle = 'rulechain.assign-rulechain-to-edge-title'; this.assignToEdgeText = 'rulechain.assign-rulechain-to-edge-text'; - this.subType = RuleChainType.edge; + this.subType = RuleChainType.EDGE; break; case EntityType.ASSET: this.assignToEdgeTitle = 'asset.assign-asset-to-edge-title'; diff --git a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts index 2dc4a46a17..56e6fcb3bd 100644 --- a/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/edge/edge-routing.module.ts @@ -189,7 +189,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], title: 'rulechain.edge-rulechain', import: false, - ruleChainType: RuleChainType.edge + ruleChainType: RuleChainType.EDGE }, resolve: { ruleChain: RuleChainResolver, @@ -210,7 +210,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], title: 'rulechain.edge-rulechain', import: true, - ruleChainType: RuleChainType.edge + ruleChainType: RuleChainType.EDGE }, resolve: { ruleNodeComponents: RuleNodeComponentsResolver diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts index 9ab1e505e9..9c29820f6d 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts @@ -151,7 +151,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O $event.stopPropagation(); } if (this.ruleNode.targetRuleChainId) { - if (this.ruleChainType === RuleChainType.edge) { + if (this.ruleChainType === RuleChainType.EDGE) { this.router.navigateByUrl(`/edges/ruleChains/${this.ruleNode.targetRuleChainId}`); } else { this.router.navigateByUrl(`/ruleChains/${this.ruleNode.targetRuleChainId}`); diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts index a68796d214..77746387c5 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts @@ -1286,7 +1286,7 @@ export class RuleChainPageComponent extends PageComponent if (this.isImport) { this.isDirtyValue = false; this.isImport = false; - if (this.ruleChainType !== RuleChainType.edge) { + if (this.ruleChainType !== RuleChainType.EDGE) { this.router.navigateByUrl(`ruleChains/${this.ruleChain.id.id}`); } else { this.router.navigateByUrl(`edges/ruleChains/${this.ruleChain.id.id}`); diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts index cfbbe198b2..27cc82ad08 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts @@ -144,7 +144,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], title: 'rulechain.rulechain', import: false, - ruleChainType: RuleChainType.core + ruleChainType: RuleChainType.CORE }, resolve: { ruleChain: RuleChainResolver, @@ -165,7 +165,7 @@ const routes: Routes = [ auth: [Authority.TENANT_ADMIN], title: 'rulechain.rulechain', import: true, - ruleChainType: RuleChainType.core + ruleChainType: RuleChainType.CORE }, resolve: { ruleNodeComponents: RuleNodeComponentsResolver diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts index 54855ea05f..6c60b3cd31 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts @@ -272,7 +272,7 @@ export class RuleChainsTableConfigResolver implements Resolve { if (ruleChainImport) { this.itembuffer.storeRuleChainImport(ruleChainImport); @@ -299,12 +299,12 @@ export class RuleChainsTableConfigResolver implements Resolve { this.config.componentsData.autoAssignToEdgeRuleChainIds = []; ruleChains.map(ruleChain => this.config.componentsData.autoAssignToEdgeRuleChainIds.push(ruleChain.id.id)); - return this.ruleChainService.getRuleChains(pageLink, RuleChainType.edge); + return this.ruleChainService.getRuleChains(pageLink, RuleChainType.EDGE); }) ); } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts index 362dc7b98c..9a4e8041fa 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rulenode.component.ts @@ -49,7 +49,7 @@ export class RuleNodeComponent extends FcNodeComponent implements OnInit { $event.stopPropagation(); } if (node.targetRuleChainId) { - if (node.ruleChainType === RuleChainType.edge) { + if (node.ruleChainType === RuleChainType.EDGE) { this.router.navigateByUrl(`/edges/ruleChains/${node.targetRuleChainId}`); } else { this.router.navigateByUrl(`/ruleChains/${node.targetRuleChainId}`); diff --git a/ui-ngx/src/app/shared/models/rule-chain.models.ts b/ui-ngx/src/app/shared/models/rule-chain.models.ts index a2dc82be40..8379825cc0 100644 --- a/ui-ngx/src/app/shared/models/rule-chain.models.ts +++ b/ui-ngx/src/app/shared/models/rule-chain.models.ts @@ -114,6 +114,6 @@ export const inputNodeComponent: RuleNodeComponentDescriptor = { }; export enum RuleChainType { - core = 'CORE', - edge = 'EDGE' + CORE = 'CORE', + EDGE = 'EDGE' }