From bc5d15553e6104e1523a10a2cbecb4f2c6a8240c Mon Sep 17 00:00:00 2001 From: mpetrov Date: Thu, 7 Nov 2024 11:44:54 +0200 Subject: [PATCH] refactoring --- .../rulechain/debug-strategy-button.component.ts | 2 +- .../pages/rulechain/rule-node-details.component.ts | 8 +++++--- ui-ngx/src/styles.scss | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.ts index 9a158d6a85..64194d8c93 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.ts @@ -99,7 +99,7 @@ export class DebugStrategyButtonComponent implements ControlValueAccessor { {}, {}, {}, true); debugStrategyPopover.tbComponentRef.instance.popover = debugStrategyPopover; - debugStrategyPopover.tbComponentRef.instance.onStrategyApplied.subscribe((strategy: DebugStrategy) => { + debugStrategyPopover.tbComponentRef.instance.onStrategyApplied.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((strategy: DebugStrategy) => { this.debugStrategyFormControl.patchValue(strategy); this.cdr.markForCheck(); debugStrategyPopover.hide(); diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts index ead0acb880..02fa18bd83 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.ts @@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; -import { DebugStrategy, FcRuleNode, RuleNodeType } from '@shared/models/rule-node.models'; +import { FcRuleNode, RuleNodeType } from '@shared/models/rule-node.models'; import { EntityType } from '@shared/models/entity-type.models'; import { Subject } from 'rxjs'; import { RuleNodeConfigComponent } from './rule-node-config.component'; @@ -92,7 +92,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O if (this.ruleNode) { this.ruleNodeFormGroup = this.fb.group({ name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*'), Validators.maxLength(255)]], - debugStrategy: [this.ruleNode.debugStrategy ?? DebugStrategy.DISABLED], + debugStrategy: [this.ruleNode.debugStrategy], singletonMode: [this.ruleNode.singletonMode, []], configuration: [this.ruleNode.configuration, [Validators.required]], additionalInfo: this.fb.group( @@ -171,7 +171,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O if ($event) { $event.stopPropagation(); } - this.ruleNodeFormGroup.get('singletonMode').patchValue(!this.ruleNodeFormGroup.get('singletonMode').value); + const singleModeControl = this.ruleNodeFormGroup.get('singletonMode'); + singleModeControl.patchValue(!singleModeControl.value); + singleModeControl.markAsDirty(); } openRuleChain($event: Event) { diff --git a/ui-ngx/src/styles.scss b/ui-ngx/src/styles.scss index c3240d7d26..50172eaa43 100644 --- a/ui-ngx/src/styles.scss +++ b/ui-ngx/src/styles.scss @@ -1272,17 +1272,18 @@ pre.tb-highlight { border-radius: 20px; padding: 0 16px; + &:not(.active) { + color: rgba(0, 0, 0, 0.76); + background: rgba(0, 0, 0, 0.06); + } + &.active:not(:disabled) { border-color: $primary !important; } - &:disabled, &:not(.active) { + &:disabled { background: rgba(0, 0, 0, 0.06); } - - &:not(.active) { - color: rgba(0, 0, 0, 0.76); - } } }