Commit 164200769d663d3cfcc42593ec1bb685882b2d5a

Authored by Vladyslav_Prykhodko
1 parent 0d52e9fc

Add button open Rule Chain

... ... @@ -34,6 +34,7 @@
34 34 [ruleNode]="ruleNode"
35 35 [ruleChainId]="ruleChainId"
36 36 [isEdit]="true"
  37 + [isAdd]="true"
37 38 [isReadOnly]="false">
38 39 </tb-rule-node>
39 40 </fieldset>
... ...
... ... @@ -15,6 +15,12 @@
15 15 limitations under the License.
16 16
17 17 -->
  18 +<div class="tb-details-buttons" *ngIf="!isAdd && ruleNode.component.type === ruleNodeType.RULE_CHAIN">
  19 + <button mat-raised-button color="primary"
  20 + (click)="openRuleChain($event)">
  21 + {{'rulechain.open-rulechain' | translate }}
  22 + </button>
  23 +</div>
18 24 <div class="mat-padding" fxLayout="column">
19 25 <form [formGroup]="ruleNodeFormGroup">
20 26 <fieldset [disabled]="(isLoading$ | async) || !isEdit || isReadOnly">
... ... @@ -44,14 +50,6 @@
44 50 </div>
45 51 </section>
46 52 <section *ngIf="ruleNode.component.type === ruleNodeType.RULE_CHAIN">
47   - <div class="tb-details-buttons" fxLayout.xs="column">
48   - <button mat-raised-button color="primary"
49   - [disabled]="(isLoading$ | async)"
50   - (click)="onEntityAction($event, 'disableAccount')"
51   - [fxShow]="!isEdit && isUserCredentialsEnabled()">
52   - {{'user.disable-account' | translate }}
53   - </button>
54   - </div>
55 53 <tb-entity-autocomplete required
56 54 [excludeEntityIds]="[ruleChainId]"
57 55 [entityType]="entityType.RULE_CHAIN"
... ...
... ... @@ -24,6 +24,7 @@ import { EntityType } from '@shared/models/entity-type.models';
24 24 import { Subscription } from 'rxjs';
25 25 import { RuleChainService } from '@core/http/rule-chain.service';
26 26 import { RuleNodeConfigComponent } from './rule-node-config.component';
  27 +import { Router } from '@angular/router';
27 28
28 29 @Component({
29 30 selector: 'tb-rule-node',
... ... @@ -46,6 +47,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
46 47 @Input()
47 48 isReadOnly: boolean;
48 49
  50 + @Input()
  51 + isAdd = false;
  52 +
49 53 ruleNodeType = RuleNodeType;
50 54 entityType = EntityType;
51 55
... ... @@ -55,7 +59,8 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
55 59
56 60 constructor(protected store: Store<AppState>,
57 61 private fb: FormBuilder,
58   - private ruleChainService: RuleChainService) {
  62 + private ruleChainService: RuleChainService,
  63 + private router: Router) {
59 64 super(store);
60 65 this.ruleNodeFormGroup = this.fb.group({});
61 66 }
... ... @@ -133,4 +138,13 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
133 138 this.ruleNodeConfigComponent.validate();
134 139 }
135 140 }
  141 +
  142 + openRuleChain($event: Event) {
  143 + if ($event) {
  144 + $event.stopPropagation();
  145 + }
  146 + if (this.ruleNode.targetRuleChainId) {
  147 + this.router.navigateByUrl(`/ruleChains/${this.ruleNode.targetRuleChainId}`);
  148 + }
  149 + }
136 150 }
... ...
... ... @@ -321,6 +321,8 @@ export class RuleChainPageComponent extends PageComponent
321 321 if (this.ruleChainCanvas) {
322 322 this.ruleChainCanvas.adjustCanvasSize(true);
323 323 }
  324 + this.isEditingRuleNode = false;
  325 + this.isEditingRuleNodeLink = false;
324 326 this.updateRuleNodesHighlight();
325 327 }
326 328
... ... @@ -1423,6 +1425,7 @@ export class RuleChainPageComponent extends PageComponent
1423 1425 scroll: true
1424 1426 },
1425 1427 side: 'right',
  1428 + distance: 12,
1426 1429 trackOrigin: true
1427 1430 }
1428 1431 );
... ...