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 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 57 let result: ComponentDescriptor[] = [];
58 58 for (let i = componentTypes.length - 1; i >= 0; i--) {
59 59 const componentType = componentTypes[i];
... ... @@ -66,7 +66,7 @@ export class ComponentDescriptorService {
66 66 if (!componentTypes.length) {
67 67 return of(result);
68 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 70 defaultHttpOptionsFromConfig(config)).pipe(
71 71 map((componentDescriptors) => {
72 72 componentDescriptors.forEach((componentDescriptor) => {
... ...
... ... @@ -323,7 +323,7 @@ export class EntityService {
323 323 break;
324 324 case EntityType.RULE_CHAIN:
325 325 pageLink.sortOrder.property = 'name';
326   - if (this.route.url.includes('edges')) {
  326 + if (this.route.url.includes('edge')) {
327 327 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge, config);
328 328 } else {
329 329 entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.core, config);
... ...
... ... @@ -25,7 +25,6 @@ import {
25 25 RuleChain,
26 26 RuleChainConnectionInfo,
27 27 RuleChainMetaData,
28   - ruleChainType,
29 28 ruleChainNodeComponent,
30 29 ruleNodeTypeComponentTypes,
31 30 unknownNodeComponent
... ... @@ -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 120 Observable<Array<RuleNodeComponentDescriptor>> {
122 121 if (this.ruleNodeComponents) {
123 122 return of(this.ruleNodeComponents);
124 123 } else {
125   - return this.loadRuleNodeComponents(config).pipe(
  124 + return this.loadRuleNodeComponents(ruleChainType, config).pipe(
126 125 mergeMap((components) => {
127 126 return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe(
128 127 map((ruleNodeComponents) => {
... ... @@ -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 209 map((components) => {
211 210 const ruleNodeComponents: RuleNodeComponentDescriptor[] = [];
212 211 components.forEach((component) => {
... ...
... ... @@ -71,7 +71,8 @@ export class RuleNodeComponentsResolver implements Resolve<Array<RuleNodeCompone
71 71 }
72 72
73 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
... ...