|
|
|
@ -14,7 +14,7 @@ |
|
|
|
/// limitations under the License.
|
|
|
|
///
|
|
|
|
|
|
|
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChange, SimpleChanges, ViewChild } from '@angular/core'; |
|
|
|
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'; |
|
|
|
import { PageComponent } from '@shared/components/page.component'; |
|
|
|
import { Store } from '@ngrx/store'; |
|
|
|
import { AppState } from '@core/core.state'; |
|
|
|
@ -22,11 +22,11 @@ import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms |
|
|
|
import { FcRuleNode, RuleNodeType } from '@shared/models/rule-node.models'; |
|
|
|
import { EntityType } from '@shared/models/entity-type.models'; |
|
|
|
import { Subscription } from 'rxjs'; |
|
|
|
import { RuleChainService } from '@core/http/rule-chain.service'; |
|
|
|
import { RuleNodeConfigComponent } from './rule-node-config.component'; |
|
|
|
import { Router } from '@angular/router'; |
|
|
|
import { RuleChainType } from '@app/shared/models/rule-chain.models'; |
|
|
|
import { ComponentClusteringMode } from '@shared/models/component-descriptor.models'; |
|
|
|
import { coerceBoolean } from '@shared/decorators/coercion'; |
|
|
|
|
|
|
|
@Component({ |
|
|
|
selector: 'tb-rule-node', |
|
|
|
@ -47,12 +47,11 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O |
|
|
|
ruleChainType: RuleChainType; |
|
|
|
|
|
|
|
@Input() |
|
|
|
isEdit: boolean; |
|
|
|
|
|
|
|
@Input() |
|
|
|
isReadOnly: boolean; |
|
|
|
@coerceBoolean() |
|
|
|
disabled = false; |
|
|
|
|
|
|
|
@Input() |
|
|
|
@coerceBoolean() |
|
|
|
isAdd = false; |
|
|
|
|
|
|
|
@Output() |
|
|
|
@ -70,7 +69,6 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O |
|
|
|
|
|
|
|
constructor(protected store: Store<AppState>, |
|
|
|
private fb: UntypedFormBuilder, |
|
|
|
private ruleChainService: RuleChainService, |
|
|
|
private router: Router) { |
|
|
|
super(store); |
|
|
|
this.ruleNodeFormGroup = this.fb.group({}); |
|
|
|
@ -99,6 +97,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O |
|
|
|
} else { |
|
|
|
this.ruleNodeFormGroup = this.fb.group({}); |
|
|
|
} |
|
|
|
if (this.disabled) { |
|
|
|
this.ruleNodeFormGroup.disable({emitEvent: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private updateRuleNode() { |
|
|
|
@ -108,6 +109,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O |
|
|
|
} |
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
|
if (this.disabled) { |
|
|
|
this.ruleNodeFormGroup.disable({emitEvent: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ngOnChanges(changes: SimpleChanges): void { |
|
|
|
@ -119,17 +123,6 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.disableControl(changes.isEdit, changes.isReadOnly); |
|
|
|
} |
|
|
|
|
|
|
|
private disableControl(isEdit: SimpleChange, isReadOnly: SimpleChange) { |
|
|
|
if (isEdit.currentValue !== isEdit.previousValue || isReadOnly.currentValue !== isReadOnly.previousValue) { |
|
|
|
if (!isEdit.currentValue || isReadOnly.currentValue) { |
|
|
|
this.ruleNodeFormGroup.disable({emitEvent: false}); |
|
|
|
} else { |
|
|
|
this.ruleNodeFormGroup.enable({emitEvent: false}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
validate() { |
|
|
|
|