Commit 04e50696f679e697c13fe52e75bed345b8882987
1 parent
3e67a9ad
Fix for setRootRuleChains button - for edge scope
Showing
3 changed files
with
32 additions
and
1 deletions
... | ... | @@ -31,7 +31,13 @@ |
31 | 31 | <button mat-raised-button color="primary" |
32 | 32 | [disabled]="(isLoading$ | async)" |
33 | 33 | (click)="onEntityAction($event, 'setRoot')" |
34 | - [fxShow]="!isEdit && !entity?.root"> | |
34 | + [fxShow]="!isEdit && !entity?.root && !isEdgeRuleChainScope()"> | |
35 | + {{'rulechain.set-root' | translate }} | |
36 | + </button> | |
37 | + <button mat-raised-button color="primary" | |
38 | + [disabled]="(isLoading$ | async)" | |
39 | + (click)="onEntityAction($event, 'setRoot')" | |
40 | + [fxShow]="!isEdit && isEdgeRuleChainScope() && !isRootRuleChain()"> | |
35 | 41 | {{'rulechain.set-root' | translate }} |
36 | 42 | </button> |
37 | 43 | <button mat-raised-button color="primary" | ... | ... |
... | ... | @@ -79,6 +79,14 @@ export class RuleChainComponent extends EntityComponent<RuleChain> { |
79 | 79 | })); |
80 | 80 | } |
81 | 81 | |
82 | + isTenantRuleChainScope() { | |
83 | + if (this.entitiesTableConfig) { | |
84 | + return this.entitiesTableConfig.componentsData.ruleChainScope == 'tenant'; | |
85 | + } else { | |
86 | + return false; | |
87 | + } | |
88 | + } | |
89 | + | |
82 | 90 | isEdgesRuleChainScope() { |
83 | 91 | if (this.entitiesTableConfig) { |
84 | 92 | return this.entitiesTableConfig.componentsData.ruleChainScope == 'edges'; |
... | ... | @@ -86,4 +94,20 @@ export class RuleChainComponent extends EntityComponent<RuleChain> { |
86 | 94 | return false; |
87 | 95 | } |
88 | 96 | } |
97 | + | |
98 | + isEdgeRuleChainScope() { | |
99 | + if (this.entitiesTableConfig) { | |
100 | + return this.entitiesTableConfig.componentsData.ruleChainScope == 'edge'; | |
101 | + } else { | |
102 | + return false; | |
103 | + } | |
104 | + } | |
105 | + | |
106 | + isRootRuleChain() { | |
107 | + if (this.entitiesTableConfig && this.entityValue) { | |
108 | + return this.entitiesTableConfig.componentsData.rootRuleChainId == this.entityValue.id.id; | |
109 | + } else { | |
110 | + return false; | |
111 | + } | |
112 | + } | |
89 | 113 | } | ... | ... |
... | ... | @@ -118,6 +118,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig< |
118 | 118 | this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id; |
119 | 119 | this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => { |
120 | 120 | this.config.componentsData.edge = edge; |
121 | + this.config.componentsData.rootRuleChainId = edge.rootRuleChainId.id; | |
121 | 122 | this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains'); |
122 | 123 | }); |
123 | 124 | this.config.entitiesDeleteEnabled = false; | ... | ... |