Fixed Rule Chains page: openRuleChain(). Refactored getRuleNodeComponents()
This commit is contained in:
parent
84a0604c08
commit
e393f3b51d
@ -53,8 +53,7 @@ export class ComponentDescriptorService {
|
||||
}
|
||||
}
|
||||
|
||||
public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, type: string,
|
||||
config?: RequestConfig): Observable<Array<ComponentDescriptor>> {
|
||||
public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, config?: RequestConfig): Observable<Array<ComponentDescriptor>> {
|
||||
let result: ComponentDescriptor[] = [];
|
||||
for (let i = componentTypes.length - 1; i >= 0; i--) {
|
||||
const componentType = componentTypes[i];
|
||||
@ -67,7 +66,7 @@ export class ComponentDescriptorService {
|
||||
if (!componentTypes.length) {
|
||||
return of(result);
|
||||
} else {
|
||||
return this.http.get<Array<ComponentDescriptor>>(`/api/components/${type}?componentTypes=${componentTypes.join(',')}`,
|
||||
return this.http.get<Array<ComponentDescriptor>>(`/api/components/?componentTypes=${componentTypes.join(',')}`,
|
||||
defaultHttpOptionsFromConfig(config)).pipe(
|
||||
map((componentDescriptors) => {
|
||||
componentDescriptors.forEach((componentDescriptor) => {
|
||||
|
||||
@ -117,12 +117,12 @@ export class RuleChainService {
|
||||
);
|
||||
}
|
||||
|
||||
public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, type: string, config?: RequestConfig):
|
||||
public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, config?: RequestConfig):
|
||||
Observable<Array<RuleNodeComponentDescriptor>> {
|
||||
if (this.ruleNodeComponents) {
|
||||
return of(this.ruleNodeComponents);
|
||||
} else {
|
||||
return this.loadRuleNodeComponents(type, config).pipe(
|
||||
return this.loadRuleNodeComponents(config).pipe(
|
||||
mergeMap((components) => {
|
||||
return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe(
|
||||
map((ruleNodeComponents) => {
|
||||
@ -205,8 +205,8 @@ export class RuleChainService {
|
||||
}
|
||||
}
|
||||
|
||||
private loadRuleNodeComponents(type: string, config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {
|
||||
return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, type, config).pipe(
|
||||
private loadRuleNodeComponents(config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> {
|
||||
return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, config).pipe(
|
||||
map((components) => {
|
||||
const ruleNodeComponents: RuleNodeComponentDescriptor[] = [];
|
||||
components.forEach((component) => {
|
||||
|
||||
@ -71,8 +71,7 @@ export class RuleNodeComponentsResolver implements Resolve<Array<RuleNodeCompone
|
||||
}
|
||||
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<Array<RuleNodeComponentDescriptor>> {
|
||||
const type = route.data.type;
|
||||
return this.ruleChainService.getRuleNodeComponents(this.modulesMap, type);
|
||||
return this.ruleChainService.getRuleNodeComponents(this.modulesMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
|
||||
this.importExport.importRuleChain().subscribe((ruleChainImport) => {
|
||||
if (ruleChainImport) {
|
||||
this.itembuffer.storeRuleChainImport(ruleChainImport);
|
||||
this.router.navigateByUrl(`ruleChains/ruleChain/import`);
|
||||
this.router.navigateByUrl(`${this.router.routerState.snapshot.url}/ruleChain/import`);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -278,7 +278,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
|
||||
if ($event) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
this.router.navigateByUrl(`ruleChains/${ruleChain.id.id}`);
|
||||
this.router.navigateByUrl(`${this.router.routerState.snapshot.url}/${ruleChain.id.id}`);
|
||||
}
|
||||
|
||||
saveRuleChain(ruleChain: RuleChain) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user