Browse Source

Fix for setRootRuleChains button - for edge scope

pull/3811/head
Artem Babak 6 years ago
parent
commit
04e50696f6
  1. 8
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html
  2. 24
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts
  3. 1
      ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

8
ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.html

@ -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"

24
ui-ngx/src/app/modules/home/pages/rulechain/rulechain.component.ts

@ -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;
}
}
}

1
ui-ngx/src/app/modules/home/pages/rulechain/rulechains-table-config.resolver.ts

@ -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;

Loading…
Cancel
Save