UI: Debug Settings fixes refactoring
This commit is contained in:
parent
09bc214bd3
commit
327455305d
@ -24,8 +24,8 @@
|
|||||||
(click)="openDebugStrategyPanel($event, matButton)">
|
(click)="openDebugStrategyPanel($event, matButton)">
|
||||||
<mat-icon [color]="debugSettingsFormGroup.disabled ? 'inherit' : 'primary'">bug_report</mat-icon>
|
<mat-icon [color]="debugSettingsFormGroup.disabled ? 'inherit' : 'primary'">bug_report</mat-icon>
|
||||||
@if (isDebugAllActive$ | async) {
|
@if (isDebugAllActive$ | async) {
|
||||||
{{ !allEnabled() ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true).trim() }}
|
{{ !allEnabled() ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true) }}
|
||||||
} @else {
|
} @else {
|
||||||
{{ failuresEnabled ? ('debug-config.failures' | translate) : ('common.disabled' | translate) }}
|
{{ failuresEnabled ? 'debug-config.failures' : 'common.disabled' | translate }}
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
<div class="hint-container">
|
<div class="hint-container">
|
||||||
<div class="tb-form-hint tb-primary-fill tb-flex center">
|
<div class="tb-form-hint tb-primary-fill tb-flex center">
|
||||||
@if (debugLimitsConfiguration) {
|
@if (debugLimitsConfiguration) {
|
||||||
{{ 'debug-config.hint.main-limited' | translate: { msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true).trim() } }}
|
{{ 'debug-config.hint.main-limited' | translate: { msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }}
|
||||||
} @else {
|
} @else {
|
||||||
{{ 'debug-config.hint.main' | translate }}
|
{{ 'debug-config.hint.main' | translate }}
|
||||||
}
|
}
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<div class="align-center flex justify-between">
|
<div class="align-center flex justify-between">
|
||||||
<mat-slide-toggle class="mat-slide" [formControl]="debugAllControl">
|
<mat-slide-toggle class="mat-slide" [formControl]="debugAllControl">
|
||||||
<div tb-hint-tooltip-icon="{{ 'debug-config.hint.all-messages' | translate }}">
|
<div tb-hint-tooltip-icon="{{ 'debug-config.hint.all-messages' | translate }}">
|
||||||
{{ 'debug-config.all-messages' | translate: { time: (isDebugAllActive$ | async) && !allEnabled ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true).trim() } }}
|
{{ 'debug-config.all-messages' | translate: { time: (isDebugAllActive$ | async) && !allEnabled ? (allEnabledUntil | durationLeft) : (maxDebugModeDuration | milliSecondsToTimeString: true : true) } }}
|
||||||
</div>
|
</div>
|
||||||
</mat-slide-toggle>
|
</mat-slide-toggle>
|
||||||
<button mat-icon-button *ngIf="(isDebugAllActive$ | async) && !allEnabled"
|
<button mat-icon-button *ngIf="(isDebugAllActive$ | async) && !allEnabled"
|
||||||
|
|||||||
@ -1417,7 +1417,7 @@ export class RuleChainPageComponent extends PageComponent
|
|||||||
}
|
}
|
||||||
|
|
||||||
isDebugSettingsEnabled(): boolean {
|
isDebugSettingsEnabled(): boolean {
|
||||||
const res = this.ruleChainModel.nodes.find(({ debugSettings }) => debugSettings && this.isDebugSettingsActive(debugSettings));
|
const res = this.ruleChainModel.nodes.find((node) => node?.debugSettings && this.isDebugSettingsActive(node.debugSettings));
|
||||||
return typeof res !== 'undefined';
|
return typeof res !== 'undefined';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1425,7 +1425,7 @@ export class RuleChainPageComponent extends PageComponent
|
|||||||
let changed = false;
|
let changed = false;
|
||||||
this.ruleChainModel.nodes.forEach((node) => {
|
this.ruleChainModel.nodes.forEach((node) => {
|
||||||
if (node.component.type !== RuleNodeType.INPUT) {
|
if (node.component.type !== RuleNodeType.INPUT) {
|
||||||
const nodeHasActiveDebugSettings = node.debugSettings && this.isDebugSettingsActive(node.debugSettings);
|
const nodeHasActiveDebugSettings = node?.debugSettings && this.isDebugSettingsActive(node.debugSettings);
|
||||||
changed = changed || nodeHasActiveDebugSettings;
|
changed = changed || nodeHasActiveDebugSettings;
|
||||||
if (nodeHasActiveDebugSettings) {
|
if (nodeHasActiveDebugSettings) {
|
||||||
node.debugSettings = { allEnabled: false, failuresEnabled: false, allEnabledUntil: 0 };
|
node.debugSettings = { allEnabled: false, failuresEnabled: false, allEnabledUntil: 0 };
|
||||||
@ -1437,8 +1437,8 @@ export class RuleChainPageComponent extends PageComponent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private isDebugSettingsActive({ allEnabled = false, failuresEnabled = false, allEnabledUntil = 0 }: DebugSettings): boolean {
|
private isDebugSettingsActive(debugSettings: DebugSettings): boolean {
|
||||||
return allEnabled || failuresEnabled || allEnabledUntil > new Date().getTime();
|
return debugSettings.allEnabled || debugSettings.failuresEnabled || debugSettings.allEnabledUntil > new Date().getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
validate() {
|
validate() {
|
||||||
|
|||||||
@ -62,7 +62,7 @@ export class MillisecondsToTimeStringPipe implements PipeTransform {
|
|||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
timeString += this.translate.instant(shortFormat ? `timewindow.${shortKey}` : `timewindow.${key}`, { [key]: value });
|
timeString += this.translate.instant(shortFormat ? `timewindow.${shortKey}` : `timewindow.${key}`, { [key]: value });
|
||||||
if (onlyFirstDigit) {
|
if (onlyFirstDigit) {
|
||||||
return timeString;
|
return timeString.trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4504,7 +4504,6 @@
|
|||||||
"output": "Output",
|
"output": "Output",
|
||||||
"test": "Test",
|
"test": "Test",
|
||||||
"help": "Help",
|
"help": "Help",
|
||||||
"reset-debug-settings": "Reset debug settings in all nodes",
|
|
||||||
"test-with-this-message": "{{test}} with this message"
|
"test-with-this-message": "{{test}} with this message"
|
||||||
},
|
},
|
||||||
"role": {
|
"role": {
|
||||||
|
|||||||
@ -1978,7 +1978,8 @@
|
|||||||
"metadata-required": "Записи метаданих не можуть бути порожніми.",
|
"metadata-required": "Записи метаданих не можуть бути порожніми.",
|
||||||
"output": "Вихід",
|
"output": "Вихід",
|
||||||
"test": "Тест",
|
"test": "Тест",
|
||||||
"help": "Допомога"
|
"help": "Допомога",
|
||||||
|
"reset-debug-settings": "Вимкнути налаштування налагодження у всіх правилах"
|
||||||
},
|
},
|
||||||
"scheduler": {
|
"scheduler": {
|
||||||
"scheduler": "Планувальник",
|
"scheduler": "Планувальник",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user