|
|
@ -28,13 +28,15 @@ import { TbPopoverComponent } from '@shared/components/popover.component'; |
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
import { FormBuilder } from '@angular/forms'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { CommonModule } from '@angular/common'; |
|
|
import { SharedModule } from '@shared/shared.module'; |
|
|
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 { DurationLeftPipe } from '@shared/pipe/duration-left.pipe'; |
|
|
import { of, shareReplay, timer } from 'rxjs'; |
|
|
import { of, shareReplay, timer } from 'rxjs'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; |
|
|
import { EntityDebugSettings } from '@shared/models/entity.models'; |
|
|
import { EntityDebugSettings } from '@shared/models/entity.models'; |
|
|
import { distinctUntilChanged, map, startWith, switchMap, takeWhile } from 'rxjs/operators'; |
|
|
import { distinctUntilChanged, map, startWith, switchMap, takeWhile } from 'rxjs/operators'; |
|
|
import { AdditionalDebugActionConfig } from '@home/components/entity/debug/entity-debug-settings.model'; |
|
|
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({ |
|
|
@Component({ |
|
|
selector: 'tb-entity-debug-settings-panel', |
|
|
selector: 'tb-entity-debug-settings-panel', |
|
|
@ -51,10 +53,9 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements |
|
|
|
|
|
|
|
|
@Input({ transform: booleanAttribute }) failuresEnabled = false; |
|
|
@Input({ transform: booleanAttribute }) failuresEnabled = false; |
|
|
@Input({ transform: booleanAttribute }) allEnabled = false; |
|
|
@Input({ transform: booleanAttribute }) allEnabled = false; |
|
|
@Input() entityLabel: string; |
|
|
@Input() entityType: EntityType; |
|
|
@Input() allEnabledUntil = 0; |
|
|
@Input() allEnabledUntil = 0; |
|
|
@Input() maxDebugModeDuration: number; |
|
|
@Input() maxDebugModeDuration = getCurrentAuthState(this.store).maxDebugModeDurationMinutes * MINUTE; |
|
|
@Input() debugLimitsConfiguration: string; |
|
|
|
|
|
@Input() additionalActionConfig: AdditionalDebugActionConfig; |
|
|
@Input() additionalActionConfig: AdditionalDebugActionConfig; |
|
|
|
|
|
|
|
|
onFailuresControl = this.fb.control(false); |
|
|
onFailuresControl = this.fb.control(false); |
|
|
@ -63,6 +64,7 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements |
|
|
maxMessagesCount: string; |
|
|
maxMessagesCount: string; |
|
|
maxTimeFrameDuration: number; |
|
|
maxTimeFrameDuration: number; |
|
|
initialAllEnabled: boolean; |
|
|
initialAllEnabled: boolean; |
|
|
|
|
|
entityLabel: string; |
|
|
|
|
|
|
|
|
isDebugAllActive$ = this.debugAllControl.valueChanges.pipe( |
|
|
isDebugAllActive$ = this.debugAllControl.valueChanges.pipe( |
|
|
startWith(this.debugAllControl.value), |
|
|
startWith(this.debugAllControl.value), |
|
|
@ -101,11 +103,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
ngOnInit(): void { |
|
|
ngOnInit(): void { |
|
|
this.maxMessagesCount = this.debugLimitsConfiguration?.split(':')[0]; |
|
|
const debugLimitsConfiguration = this.getByEntityTypeDebugLimit(this.entityType); |
|
|
this.maxTimeFrameDuration = parseInt(this.debugLimitsConfiguration?.split(':')[1]) * SECOND; |
|
|
this.maxMessagesCount = debugLimitsConfiguration?.split(':')[0]; |
|
|
|
|
|
this.maxTimeFrameDuration = parseInt(debugLimitsConfiguration?.split(':')[1]) * SECOND; |
|
|
this.onFailuresControl.patchValue(this.failuresEnabled); |
|
|
this.onFailuresControl.patchValue(this.failuresEnabled); |
|
|
this.debugAllControl.patchValue(this.allEnabled); |
|
|
this.debugAllControl.patchValue(this.allEnabled); |
|
|
this.initialAllEnabled = this.allEnabled || this.allEnabledUntil > new Date().getTime(); |
|
|
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 { |
|
|
onCancel(): void { |
|
|
@ -135,4 +139,13 @@ export class EntityDebugSettingsPanelComponent extends PageComponent implements |
|
|
this.allEnabledUntil = 0; |
|
|
this.allEnabledUntil = 0; |
|
|
this.cd.markForCheck(); |
|
|
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; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|