Browse Source

Add button open Rule Chain

pull/3230/head
Vladyslav_Prykhodko 6 years ago
parent
commit
164200769d
  1. 1
      ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html
  2. 14
      ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html
  3. 16
      ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts
  4. 3
      ui-ngx/src/app/modules/home/pages/rulechain/rulechain-page.component.ts

1
ui-ngx/src/app/modules/home/pages/rulechain/add-rule-node-dialog.component.html

@ -34,6 +34,7 @@
[ruleNode]="ruleNode" [ruleNode]="ruleNode"
[ruleChainId]="ruleChainId" [ruleChainId]="ruleChainId"
[isEdit]="true" [isEdit]="true"
[isAdd]="true"
[isReadOnly]="false"> [isReadOnly]="false">
</tb-rule-node> </tb-rule-node>
</fieldset> </fieldset>

14
ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html

@ -15,6 +15,12 @@
limitations under the License. limitations under the License.
--> -->
<div class="tb-details-buttons" *ngIf="!isAdd && ruleNode.component.type === ruleNodeType.RULE_CHAIN">
<button mat-raised-button color="primary"
(click)="openRuleChain($event)">
{{'rulechain.open-rulechain' | translate }}
</button>
</div>
<div class="mat-padding" fxLayout="column"> <div class="mat-padding" fxLayout="column">
<form [formGroup]="ruleNodeFormGroup"> <form [formGroup]="ruleNodeFormGroup">
<fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly"> <fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly">
@ -44,14 +50,6 @@
</div> </div>
</section> </section>
<section *ngIf="ruleNode.component.type === ruleNodeType.RULE_CHAIN"> <section *ngIf="ruleNode.component.type === ruleNodeType.RULE_CHAIN">
<div class="tb-details-buttons" fxLayout.xs="column">
<button mat-raised-button color="primary"
[disabled]="(isLoading$ | async)"
(click)="onEntityAction($event, 'disableAccount')"
[fxShow]="!isEdit && isUserCredentialsEnabled()">
{{'user.disable-account' | translate }}
</button>
</div>
<tb-entity-autocomplete required <tb-entity-autocomplete required
[excludeEntityIds]="[ruleChainId]" [excludeEntityIds]="[ruleChainId]"
[entityType]="entityType.RULE_CHAIN" [entityType]="entityType.RULE_CHAIN"

16
ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts

@ -24,6 +24,7 @@ import { EntityType } from '@shared/models/entity-type.models';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
import { RuleChainService } from '@core/http/rule-chain.service'; import { RuleChainService } from '@core/http/rule-chain.service';
import { RuleNodeConfigComponent } from './rule-node-config.component'; import { RuleNodeConfigComponent } from './rule-node-config.component';
import { Router } from '@angular/router';
@Component({ @Component({
selector: 'tb-rule-node', selector: 'tb-rule-node',
@ -46,6 +47,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
@Input() @Input()
isReadOnly: boolean; isReadOnly: boolean;
@Input()
isAdd = false;
ruleNodeType = RuleNodeType; ruleNodeType = RuleNodeType;
entityType = EntityType; entityType = EntityType;
@ -55,7 +59,8 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
constructor(protected store: Store<AppState>, constructor(protected store: Store<AppState>,
private fb: FormBuilder, private fb: FormBuilder,
private ruleChainService: RuleChainService) { private ruleChainService: RuleChainService,
private router: Router) {
super(store); super(store);
this.ruleNodeFormGroup = this.fb.group({}); this.ruleNodeFormGroup = this.fb.group({});
} }
@ -133,4 +138,13 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
this.ruleNodeConfigComponent.validate(); this.ruleNodeConfigComponent.validate();
} }
} }
openRuleChain($event: Event) {
if ($event) {
$event.stopPropagation();
}
if (this.ruleNode.targetRuleChainId) {
this.router.navigateByUrl(`/ruleChains/${this.ruleNode.targetRuleChainId}`);
}
}
} }

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

@ -321,6 +321,8 @@ export class RuleChainPageComponent extends PageComponent
if (this.ruleChainCanvas) { if (this.ruleChainCanvas) {
this.ruleChainCanvas.adjustCanvasSize(true); this.ruleChainCanvas.adjustCanvasSize(true);
} }
this.isEditingRuleNode = false;
this.isEditingRuleNodeLink = false;
this.updateRuleNodesHighlight(); this.updateRuleNodesHighlight();
} }
@ -1423,6 +1425,7 @@ export class RuleChainPageComponent extends PageComponent
scroll: true scroll: true
}, },
side: 'right', side: 'right',
distance: 12,
trackOrigin: true trackOrigin: true
} }
); );

Loading…
Cancel
Save