Browse Source

Fixed fetch edge rule chains for 'rulechain' Node

pull/3811/head
Artem Babak 6 years ago
parent
commit
ac94a063ac
  1. 4
      ui-ngx/src/app/core/http/component-descriptor.service.ts
  2. 2
      ui-ngx/src/app/core/http/entity.service.ts
  3. 9
      ui-ngx/src/app/core/http/rule-chain.service.ts
  4. 3
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts

4
ui-ngx/src/app/core/http/component-descriptor.service.ts

@ -53,7 +53,7 @@ export class ComponentDescriptorService {
}
}
public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, config?: RequestConfig): Observable<Array<ComponentDescriptor>> {
public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, ruleChainType: string, config?: RequestConfig): Observable<Array<ComponentDescriptor>> {
let result: ComponentDescriptor[] = [];
for (let i = componentTypes.length - 1; i >= 0; i--) {
const componentType = componentTypes[i];
@ -66,7 +66,7 @@ export class ComponentDescriptorService {
if (!componentTypes.length) {
return of(result);
} else {
return this.http.get<Array<ComponentDescriptor>>(`/api/components/?componentTypes=${componentTypes.join(',')}`,
return this.http.get<Array<ComponentDescriptor>>(`/api/components?componentTypes=${componentTypes.join(',')}&ruleChainType=${ruleChainType}`,
defaultHttpOptionsFromConfig(config)).pipe(
map((componentDescriptors) => {
componentDescriptors.forEach((componentDescriptor) => {

2
ui-ngx/src/app/core/http/entity.service.ts

@ -323,7 +323,7 @@ export class EntityService {
break;
case EntityType.RULE_CHAIN:
pageLink.sortOrder.property = 'name';
if (this.route.url.includes('edges')) {
if (this.route.url.includes('edge')) {
entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.edge, config);
} else {
entitiesObservable = this.ruleChainService.getRuleChains(pageLink, ruleChainType.core, config);

9
ui-ngx/src/app/core/http/rule-chain.service.ts

@ -25,7 +25,6 @@ import {
RuleChain,
RuleChainConnectionInfo,
RuleChainMetaData,
ruleChainType,
ruleChainNodeComponent,
ruleNodeTypeComponentTypes,
unknownNodeComponent
@ -117,12 +116,12 @@ export class RuleChainService {
);
}
public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, config?: RequestConfig):
public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, ruleChainType: string, config?: RequestConfig):
Observable<Array<RuleNodeComponentDescriptor>> {
if (this.ruleNodeComponents) {
return of(this.ruleNodeComponents);
} else {
return this.loadRuleNodeComponents(config).pipe(
return this.loadRuleNodeComponents(ruleChainType, config).pipe(
mergeMap((components) => {
return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe(
map((ruleNodeComponents) => {
@ -205,8 +204,8 @@ export class RuleChainService {
}
}
private loadRuleNodeComponents(config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {
return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, config).pipe(
private loadRuleNodeComponents(ruleChainType: string, config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {
return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, ruleChainType, config).pipe(
map((components) => {
const ruleNodeComponents: RuleNodeComponentDescriptor[] = [];
components.forEach((component) => {

3
ui-ngx/src/app/modules/home/pages/rulechain/rulechain-routing.module.ts

@ -71,7 +71,8 @@ export class RuleNodeComponentsResolver implements Resolve<Array<RuleNodeCompone
}
resolve(route: ActivatedRouteSnapshot): Observable<Array<RuleNodeComponentDescriptor>> {
return this.ruleChainService.getRuleNodeComponents(this.modulesMap);
const ruleChainType = route.data.type;
return this.ruleChainService.getRuleNodeComponents(this.modulesMap, ruleChainType);
}
}

Loading…
Cancel
Save