Commit ac94a063ac12237ee74a3189da0f567d6953c0e5

Authored by Artem Babak
1 parent cb894d70

Fixed fetch edge rule chains for 'rulechain' Node

@@ -53,7 +53,7 @@ export class ComponentDescriptorService { @@ -53,7 +53,7 @@ export class ComponentDescriptorService {
53 } 53 }
54 } 54 }
55 55
56 - public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, config?: RequestConfig): Observable<Array<ComponentDescriptor>> { 56 + public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, ruleChainType: string, config?: RequestConfig): Observable<Array<ComponentDescriptor>> {
57 let result: ComponentDescriptor[] = []; 57 let result: ComponentDescriptor[] = [];
58 for (let i = componentTypes.length - 1; i >= 0; i--) { 58 for (let i = componentTypes.length - 1; i >= 0; i--) {
59 const componentType = componentTypes[i]; 59 const componentType = componentTypes[i];
@@ -66,7 +66,7 @@ export class ComponentDescriptorService { @@ -66,7 +66,7 @@ export class ComponentDescriptorService {
66 if (!componentTypes.length) { 66 if (!componentTypes.length) {
67 return of(result); 67 return of(result);
68 } else { 68 } else {
69 - return this.http.get<Array<ComponentDescriptor>>(`/api/components/?componentTypes=${componentTypes.join(',')}`, 69 + return this.http.get<Array<ComponentDescriptor>>(`/api/components?componentTypes=${componentTypes.join(',')}&ruleChainType=${ruleChainType}`,
70 defaultHttpOptionsFromConfig(config)).pipe( 70 defaultHttpOptionsFromConfig(config)).pipe(
71 map((componentDescriptors) => { 71 map((componentDescriptors) => {
72 componentDescriptors.forEach((componentDescriptor) => { 72 componentDescriptors.forEach((componentDescriptor) => {
@@ -323,7 +323,7 @@ export class EntityService { @@ -323,7 +323,7 @@ export class EntityService {
323 break; 323 break;
324 case EntityType.RULE_CHAIN: 324 case EntityType.RULE_CHAIN:
325 pageLink.sortOrder.property = 'name'; 325 pageLink.sortOrder.property = 'name';
326 - if (this.route.url.includes('edges')) { 326 + if (this.route.url.includes('edge')) {
327 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge, config); 327 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge, config);
328 } else { 328 } else {
329 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.core, config); 329 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.core, config);
@@ -25,7 +25,6 @@ import { @@ -25,7 +25,6 @@ import {
25 RuleChain, 25 RuleChain,
26 RuleChainConnectionInfo, 26 RuleChainConnectionInfo,
27 RuleChainMetaData, 27 RuleChainMetaData,
28 - ruleChainType,  
29 ruleChainNodeComponent, 28 ruleChainNodeComponent,
30 ruleNodeTypeComponentTypes, 29 ruleNodeTypeComponentTypes,
31 unknownNodeComponent 30 unknownNodeComponent
@@ -117,12 +116,12 @@ export class RuleChainService { @@ -117,12 +116,12 @@ export class RuleChainService {
117 ); 116 );
118 } 117 }
119 118
120 - public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, config?: RequestConfig): 119 + public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, ruleChainType: string, config?: RequestConfig):
121 Observable<Array<RuleNodeComponentDescriptor>> { 120 Observable<Array<RuleNodeComponentDescriptor>> {
122 if (this.ruleNodeComponents) { 121 if (this.ruleNodeComponents) {
123 return of(this.ruleNodeComponents); 122 return of(this.ruleNodeComponents);
124 } else { 123 } else {
125 - return this.loadRuleNodeComponents(config).pipe( 124 + return this.loadRuleNodeComponents(ruleChainType, config).pipe(
126 mergeMap((components) => { 125 mergeMap((components) => {
127 return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe( 126 return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe(
128 map((ruleNodeComponents) => { 127 map((ruleNodeComponents) => {
@@ -205,8 +204,8 @@ export class RuleChainService { @@ -205,8 +204,8 @@ export class RuleChainService {
205 } 204 }
206 } 205 }
207 206
208 - private loadRuleNodeComponents(config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {  
209 - return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, config).pipe( 207 + private loadRuleNodeComponents(ruleChainType: string, config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {
  208 + return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, ruleChainType, config).pipe(
210 map((components) => { 209 map((components) => {
211 const ruleNodeComponents: RuleNodeComponentDescriptor[] = []; 210 const ruleNodeComponents: RuleNodeComponentDescriptor[] = [];
212 components.forEach((component) => { 211 components.forEach((component) => {
@@ -71,7 +71,8 @@ export class RuleNodeComponentsResolver implements Resolve<Array<RuleNodeCompone @@ -71,7 +71,8 @@ export class RuleNodeComponentsResolver implements Resolve<Array<RuleNodeCompone
71 } 71 }
72 72
73 resolve(route: ActivatedRouteSnapshot): Observable<Array<RuleNodeComponentDescriptor>> { 73 resolve(route: ActivatedRouteSnapshot): Observable<Array<RuleNodeComponentDescriptor>> {
74 - return this.ruleChainService.getRuleNodeComponents(this.modulesMap); 74 + const ruleChainType = route.data.type;
  75 + return this.ruleChainService.getRuleNodeComponents(this.modulesMap, ruleChainType);
75 } 76 }
76 } 77 }
77 78