Showing
3 changed files
with
17 additions
and
12 deletions
... | ... | @@ -54,14 +54,16 @@ export class ComponentDescriptorService { |
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | - public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, ruleChainType: RuleChainType, config?: RequestConfig): Observable<Array<ComponentDescriptor>> { | |
57 | + public getComponentDescriptorsByTypes(componentTypes: Array<ComponentType>, ruleChainType: RuleChainType, ruleNodeScope: RuleChainType, config?: RequestConfig): Observable<Array<ComponentDescriptor>> { | |
58 | 58 | let result: ComponentDescriptor[] = []; |
59 | - for (let i = componentTypes.length - 1; i >= 0; i--) { | |
60 | - const componentType = componentTypes[i]; | |
61 | - const componentDescriptors = this.componentsByType.get(componentType); | |
62 | - if (componentDescriptors) { | |
63 | - result = result.concat(componentDescriptors); | |
64 | - componentTypes.splice(i, 1); | |
59 | + if (ruleNodeScope === ruleChainType) { | |
60 | + for (let i = componentTypes.length - 1; i >= 0; i--) { | |
61 | + const componentType = componentTypes[i]; | |
62 | + const componentDescriptors = this.componentsByType.get(componentType); | |
63 | + if (componentDescriptors) { | |
64 | + result = result.concat(componentDescriptors); | |
65 | + componentTypes.splice(i, 1); | |
66 | + } | |
65 | 67 | } |
66 | 68 | } |
67 | 69 | if (!componentTypes.length) { | ... | ... |
... | ... | @@ -53,6 +53,7 @@ export class RuleChainService { |
53 | 53 | |
54 | 54 | private ruleNodeComponents: Array<RuleNodeComponentDescriptor>; |
55 | 55 | private ruleNodeConfigFactories: {[directive: string]: ComponentFactory<IRuleNodeConfigurationComponent>} = {}; |
56 | + private ruleNodeScope: RuleChainType; | |
56 | 57 | |
57 | 58 | constructor( |
58 | 59 | private http: HttpClient, |
... | ... | @@ -120,13 +121,14 @@ export class RuleChainService { |
120 | 121 | |
121 | 122 | public getRuleNodeComponents(ruleNodeConfigResourcesModulesMap: {[key: string]: any}, ruleChainType: RuleChainType, config?: RequestConfig): |
122 | 123 | Observable<Array<RuleNodeComponentDescriptor>> { |
123 | - if (this.ruleNodeComponents) { | |
124 | + if (this.ruleNodeComponents && this.ruleNodeScope == ruleChainType) { | |
124 | 125 | return of(this.ruleNodeComponents); |
125 | 126 | } else { |
126 | - return this.loadRuleNodeComponents(ruleChainType, config).pipe( | |
127 | + return this.loadRuleNodeComponents(ruleChainType, config).pipe( | |
127 | 128 | mergeMap((components) => { |
128 | 129 | return this.resolveRuleNodeComponentsUiResources(components, ruleNodeConfigResourcesModulesMap).pipe( |
129 | 130 | map((ruleNodeComponents) => { |
131 | + this.ruleNodeScope = ruleChainType; | |
130 | 132 | this.ruleNodeComponents = ruleNodeComponents; |
131 | 133 | this.ruleNodeComponents.push(ruleChainNodeComponent); |
132 | 134 | this.ruleNodeComponents.sort( |
... | ... | @@ -207,7 +209,7 @@ export class RuleChainService { |
207 | 209 | } |
208 | 210 | |
209 | 211 | private loadRuleNodeComponents(ruleChainType: RuleChainType, config?: RequestConfig): Observable<Array<RuleNodeComponentDescriptor>> { |
210 | - return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, ruleChainType, config).pipe( | |
212 | + return this.componentDescriptorService.getComponentDescriptorsByTypes(ruleNodeTypeComponentTypes, ruleChainType, this.ruleNodeScope, config).pipe( | |
211 | 213 | map((components) => { |
212 | 214 | const ruleNodeComponents: RuleNodeComponentDescriptor[] = []; |
213 | 215 | components.forEach((component) => { | ... | ... |
... | ... | @@ -414,7 +414,8 @@ |
414 | 414 | "unassign-asset-from-edge-text": "After the confirmation the asset will be unassigned and won't be accessible by the edge.", |
415 | 415 | "unassign-assets-from-edge-action-title": "Unassign { count, plural, 1 {1 asset} other {# assets} } from edge", |
416 | 416 | "unassign-assets-from-edge-title": "Are you sure you want to unassign { count, plural, 1 {1 asset} other {# assets} }?", |
417 | - "unassign-assets-from-edge-text": "After the confirmation all selected assets will be unassigned and won't be accessible by the edge." | |
417 | + "unassign-assets-from-edge-text": "After the confirmation all selected assets will be unassigned and won't be accessible by the edge.", | |
418 | + "selected-assets": "{ count, plural, 1 {1 asset} other {# assets} } selected" | |
418 | 419 | }, |
419 | 420 | "attribute": { |
420 | 421 | "attributes": "Attributes", |
... | ... | @@ -2044,7 +2045,7 @@ |
2044 | 2045 | "edge-rulechain": "Edge Rule chain", |
2045 | 2046 | "core-rulechains": "Core Rule chains", |
2046 | 2047 | "unassign-rulechain-from-edge-text": "After the confirmation the rulechain will be unassigned and won't be accessible by the edge.", |
2047 | - "unassign-rulechains-from-edge-title": "Unassign { count, plural, 1 {1 rulechain} other {# rulechains} } from edge", | |
2048 | + "unassign-rulechains-from-edge-title": "Are you sure you want to unassign { count, plural, 1 {1 rulechain} other {# rulechains} }?", | |
2048 | 2049 | "unassign-rulechains-from-edge-text": "After the confirmation all selected rulechains will be unassigned and won't be accessible by the edge.", |
2049 | 2050 | "assign-rulechain-to-edge-title": "Assign Rule Chain(s) To Edge", |
2050 | 2051 | "assign-rulechain-to-edge-text": "Please select the rulechains to assign to the edge", | ... | ... |