Fix for setRootRuleChains button - for edge scope

This commit is contained in:
Artem Babak 2020-12-10 12:36:52 +02:00
parent 3e67a9ad0e
commit 04e50696f6
3 changed files with 32 additions and 1 deletions

View File

@ -31,7 +31,13 @@
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setRoot')"
[fxShow]="!isEdit && !entity?.root">
[fxShow]="!isEdit && !entity?.root && !isEdgeRuleChainScope()">
{{'rulechain.set-root' | translate }}
</button>
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'setRoot')"
[fxShow]="!isEdit && isEdgeRuleChainScope() && !isRootRuleChain()">
{{'rulechain.set-root' | translate }}
</button>
<button mat-raised-button color="primary"

View File

@ -79,6 +79,14 @@ export class RuleChainComponent extends EntityComponent<RuleChain> {
}));
}
isTenantRuleChainScope() {
if (this.entitiesTableConfig) {
return this.entitiesTableConfig.componentsData.ruleChainScope == 'tenant';
} else {
return false;
}
}
isEdgesRuleChainScope() {
if (this.entitiesTableConfig) {
return this.entitiesTableConfig.componentsData.ruleChainScope == 'edges';
@ -86,4 +94,20 @@ export class RuleChainComponent extends EntityComponent<RuleChain> {
return false;
}
}
isEdgeRuleChainScope() {
if (this.entitiesTableConfig) {
return this.entitiesTableConfig.componentsData.ruleChainScope == 'edge';
} else {
return false;
}
}
isRootRuleChain() {
if (this.entitiesTableConfig && this.entityValue) {
return this.entitiesTableConfig.componentsData.rootRuleChainId == this.entityValue.id.id;
} else {
return false;
}
}
}

View File

@ -118,6 +118,7 @@ export class RuleChainsTableConfigResolver implements Resolve<EntityTableConfig<
this.config.entitySelectionEnabled = ruleChain => this.config.componentsData.edge.rootRuleChainId.id != ruleChain.id.id;
this.edgeService.getEdge(this.config.componentsData.edgeId).subscribe(edge => {
this.config.componentsData.edge = edge;
this.config.componentsData.rootRuleChainId = edge.rootRuleChainId.id;
this.config.tableTitle = edge.name + ': ' + this.translate.instant('rulechain.edge-rulechains');
});
this.config.entitiesDeleteEnabled = false;