refactoring

This commit is contained in:
mpetrov 2024-11-07 11:44:54 +02:00
parent 3c7dc0cc03
commit bc5d15553e
3 changed files with 12 additions and 9 deletions

View File

@ -99,7 +99,7 @@ export class DebugStrategyButtonComponent implements ControlValueAccessor {
{}, {},
{}, {}, true); {}, {}, true);
debugStrategyPopover.tbComponentRef.instance.popover = debugStrategyPopover; 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.debugStrategyFormControl.patchValue(strategy);
this.cdr.markForCheck(); this.cdr.markForCheck();
debugStrategyPopover.hide(); debugStrategyPopover.hide();

View File

@ -29,7 +29,7 @@ import { PageComponent } from '@shared/components/page.component';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
import { AppState } from '@core/core.state'; import { AppState } from '@core/core.state';
import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; 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 { EntityType } from '@shared/models/entity-type.models';
import { Subject } from 'rxjs'; import { Subject } from 'rxjs';
import { RuleNodeConfigComponent } from './rule-node-config.component'; import { RuleNodeConfigComponent } from './rule-node-config.component';
@ -92,7 +92,7 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
if (this.ruleNode) { if (this.ruleNode) {
this.ruleNodeFormGroup = this.fb.group({ this.ruleNodeFormGroup = this.fb.group({
name: [this.ruleNode.name, [Validators.required, Validators.pattern('(.|\\s)*\\S(.|\\s)*'), Validators.maxLength(255)]], 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, []], singletonMode: [this.ruleNode.singletonMode, []],
configuration: [this.ruleNode.configuration, [Validators.required]], configuration: [this.ruleNode.configuration, [Validators.required]],
additionalInfo: this.fb.group( additionalInfo: this.fb.group(
@ -171,7 +171,9 @@ export class RuleNodeDetailsComponent extends PageComponent implements OnInit, O
if ($event) { if ($event) {
$event.stopPropagation(); $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) { openRuleChain($event: Event) {

View File

@ -1272,17 +1272,18 @@ pre.tb-highlight {
border-radius: 20px; border-radius: 20px;
padding: 0 16px; padding: 0 16px;
&:not(.active) {
color: rgba(0, 0, 0, 0.76);
background: rgba(0, 0, 0, 0.06);
}
&.active:not(:disabled) { &.active:not(:disabled) {
border-color: $primary !important; border-color: $primary !important;
} }
&:disabled, &:not(.active) { &:disabled {
background: rgba(0, 0, 0, 0.06); background: rgba(0, 0, 0, 0.06);
} }
&:not(.active) {
color: rgba(0, 0, 0, 0.76);
}
} }
} }