diff --git a/ui-ngx/src/app/core/auth/auth.models.ts b/ui-ngx/src/app/core/auth/auth.models.ts index 1944c693ac..e5cc1424ab 100644 --- a/ui-ngx/src/app/core/auth/auth.models.ts +++ b/ui-ngx/src/app/core/auth/auth.models.ts @@ -31,6 +31,7 @@ export interface SysParamsState { maxDataPointsPerRollingArg: number; maxArgumentsPerCF: number; ruleChainDebugPerTenantLimitsConfiguration?: string; + calculatedFieldDebugPerTenantLimitsConfiguration?: string; } export interface SysParams extends SysParamsState { diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index c5b256ea89..07f8f0293c 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -27,10 +27,9 @@ import { PageLink } from '@shared/models/page/page-link'; import { Observable, of } from 'rxjs'; import { PageData } from '@shared/models/page/page-data'; import { EntityId } from '@shared/models/id/entity-id'; -import { MINUTE } from '@shared/models/time/time.models'; import { Store } from '@ngrx/store'; import { AppState } from '@core/core.state'; -import { getCurrentAuthState, getCurrentAuthUser } from '@core/auth/auth.selectors'; +import { getCurrentAuthUser } from '@core/auth/auth.selectors'; import { DestroyRef, Renderer2 } from '@angular/core'; import { EntityDebugSettings } from '@shared/models/entity.models'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; @@ -47,7 +46,8 @@ import { getCalculatedFieldArgumentsHighlights, } from '@shared/models/calculated-field.models'; import { - CalculatedFieldDebugDialogComponent, CalculatedFieldDebugDialogData, + CalculatedFieldDebugDialogComponent, + CalculatedFieldDebugDialogData, CalculatedFieldDialogComponent, CalculatedFieldDialogData, CalculatedFieldScriptTestDialogComponent, @@ -60,9 +60,6 @@ import { DatePipe } from '@angular/common'; export class CalculatedFieldsTableConfig extends EntityTableConfig { - readonly calculatedFieldsDebugPerTenantLimitsConfiguration = - getCurrentAuthState(this.store)['calculatedFieldsDebugPerTenantLimitsConfiguration']; - readonly maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; readonly tenantId = getCurrentAuthUser(this.store).tenantId; additionalDebugActionConfig = { title: this.translate.instant('calculated-fields.see-debug-events'), @@ -189,9 +186,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.onDebugConfigChanged(id.id, settings) @@ -215,7 +210,6 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts index 169d6dff50..52051aa6f7 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/dialog/calculated-field-dialog.component.ts @@ -48,7 +48,6 @@ export interface CalculatedFieldDialogData { value?: CalculatedField; buttonTitle: string; entityId: EntityId; - debugLimitsConfiguration: string; tenantId: string; entityName?: string; additionalDebugActionConfig: AdditionalDebugActionConfig<(calculatedField: CalculatedField) => void>; diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts index 90beed2f7e..7cb0ac7f58 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-button.component.ts @@ -36,6 +36,7 @@ import { Store } from '@ngrx/store'; import { ControlValueAccessor, FormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms'; import { EntityDebugSettingsService } from '@home/components/entity/debug/entity-debug-settings.service'; import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entity-debug-settings.model'; +import { EntityType } from '@shared/models/entity-type.models'; @Component({ selector: 'tb-entity-debug-settings-button', @@ -58,9 +59,8 @@ import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entit }) export class EntityDebugSettingsButtonComponent implements ControlValueAccessor { - @Input() debugLimitsConfiguration: string; - @Input() entityLabel: string; @Input() additionalActionConfig: AdditionalDebugActionConfig; + @Input({required: true}) entityType: EntityType; debugSettingsFormGroup = this.fb.group({ failuresEnabled: [false], @@ -123,8 +123,7 @@ export class EntityDebugSettingsButtonComponent implements ControlValueAccessor debugSettings: this.debugSettingsFormGroup.value, debugConfig: { maxDebugModeDuration: this.maxDebugModeDuration, - debugLimitsConfiguration: this.debugLimitsConfiguration, - entityLabel: this.entityLabel, + entityType: this.entityType, additionalActionConfig: this.additionalActionConfig, }, onSettingsAppliedFn: settings => { diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html index 5863a295d6..337a452757 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.html @@ -17,10 +17,10 @@ -->
debug-settings.label
- @if (debugLimitsConfiguration) { + @if (maxMessagesCount) {
- {{ 'debug-settings.hint.main-limited' | translate: { entity: entityLabel ?? ('debug-settings.entity' | translate), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }} + {{ 'debug-settings.hint.main-limited' | translate: { entity: (entityLabel | translate | lowercase), msg: maxMessagesCount, time: (maxTimeFrameDuration | milliSecondsToTimeString: true : true) } }}
} diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts index 1f95a93084..e19407a687 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings-panel.component.ts @@ -28,13 +28,15 @@ import { TbPopoverComponent } from '@shared/components/popover.component'; import { FormBuilder } from '@angular/forms'; import { CommonModule } from '@angular/common'; import { SharedModule } from '@shared/shared.module'; -import { SECOND } from '@shared/models/time/time.models'; +import { MINUTE, SECOND } from '@shared/models/time/time.models'; import { DurationLeftPipe } from '@shared/pipe/duration-left.pipe'; import { of, shareReplay, timer } from 'rxjs'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { EntityDebugSettings } from '@shared/models/entity.models'; import { distinctUntilChanged, map, startWith, switchMap, takeWhile } from 'rxjs/operators'; import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entity-debug-settings.model'; +import { EntityType, entityTypeTranslations } from '@shared/models/entity-type.models'; +import { getCurrentAuthState } from '@core/auth/auth.selectors'; @Component({ selector: 'tb-entity-debug-settings-panel', @@ -51,10 +53,9 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements @Input({ transform: booleanAttribute }) failuresEnabled = false; @Input({ transform: booleanAttribute }) allEnabled = false; - @Input() entityLabel: string; + @Input() entityType: EntityType; @Input() allEnabledUntil = 0; - @Input() maxDebugModeDuration: number; - @Input() debugLimitsConfiguration: string; + @Input() maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; @Input() additionalActionConfig: AdditionalDebugActionConfig; onFailuresControl = this.fb.control(false); @@ -63,6 +64,7 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements maxMessagesCount: string; maxTimeFrameDuration: number; initialAllEnabled: boolean; + entityLabel: string; isDebugAllActive$ = this.debugAllControl.valueChanges.pipe( startWith(this.debugAllControl.value), @@ -101,11 +103,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements } ngOnInit(): void { - this.maxMessagesCount = this.debugLimitsConfiguration?.split(':')[0]; - this.maxTimeFrameDuration = parseInt(this.debugLimitsConfiguration?.split(':')[1]) * SECOND; + const debugLimitsConfiguration = this.getByEntityTypeDebugLimit(this.entityType); + this.maxMessagesCount = debugLimitsConfiguration?.split(':')[0]; + this.maxTimeFrameDuration = parseInt(debugLimitsConfiguration?.split(':')[1]) * SECOND; this.onFailuresControl.patchValue(this.failuresEnabled); this.debugAllControl.patchValue(this.allEnabled); this.initialAllEnabled = this.allEnabled || this.allEnabledUntil > new Date().getTime(); + this.entityLabel = entityTypeTranslations.has(this.entityType) ? entityTypeTranslations.get(this.entityType).type : 'debug-settings.entity'; } onCancel(): void { @@ -135,4 +139,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements this.allEnabledUntil = 0; this.cd.markForCheck(); } + + private getByEntityTypeDebugLimit(entityType: EntityType): string { + switch (entityType) { + case EntityType.RULE_NODE: + return getCurrentAuthState(this.store).ruleChainDebugPerTenantLimitsConfiguration; + case EntityType.CALCULATED_FIELD: + return getCurrentAuthState(this.store).calculatedFieldDebugPerTenantLimitsConfiguration; + } + } } diff --git a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts index 6560580502..0af9da52f2 100644 --- a/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts +++ b/ui-ngx/src/app/modules/home/components/entity/debug/entity-debug-settings.model.ts @@ -15,6 +15,7 @@ /// import { EntityDebugSettings } from '@shared/models/entity.models'; +import { EntityType } from '@shared/models/entity-type.models'; export interface AdditionalDebugActionConfig void> { action: Action; @@ -24,10 +25,9 @@ export interface AdditionalDebugActionConfig vo export interface EntityDebugSettingPanelConfig { debugSettings: EntityDebugSettings; debugConfig: { - maxDebugModeDuration: number; - debugLimitsConfiguration: string; - entityLabel?: string; + maxDebugModeDuration?: number; additionalActionConfig?: AdditionalDebugActionConfig; + entityType: EntityType; } onSettingsAppliedFn: (settings: EntityDebugSettings) => void; } diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html index 1923d3ef91..b55dcdaa73 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/rule-node-details.component.html @@ -22,7 +22,7 @@
-
+
rulenode.name @@ -38,8 +38,7 @@