diff --git a/ui-ngx/src/app/core/auth/auth.models.ts b/ui-ngx/src/app/core/auth/auth.models.ts index cfc3fed4ba..e4d05e7d21 100644 --- a/ui-ngx/src/app/core/auth/auth.models.ts +++ b/ui-ngx/src/app/core/auth/auth.models.ts @@ -28,6 +28,7 @@ export interface SysParamsState { userSettings: UserSettings; maxResourceSize: number; maxRuleNodeDebugDurationMinutes: number; + ruleChainDebugPerTenantLimitsConfiguration?: string; } export interface SysParams extends SysParamsState { diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/debug-duration-left.pipe.ts b/ui-ngx/src/app/modules/home/pages/rulechain/debug-duration-left.pipe.ts index 17176bd4af..7086bb504d 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/debug-duration-left.pipe.ts +++ b/ui-ngx/src/app/modules/home/pages/rulechain/debug-duration-left.pipe.ts @@ -16,6 +16,8 @@ import { Pipe, PipeTransform } from '@angular/core'; import { MINUTE } from '@shared/models/time/time.models'; +import { TranslateService } from '@ngx-translate/core'; +import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe'; @Pipe({ name: 'debugDurationLeft', @@ -23,9 +25,12 @@ import { MINUTE } from '@shared/models/time/time.models'; standalone: true, }) export class DebugDurationLeftPipe implements PipeTransform { + + constructor(private translate: TranslateService, private millisecondsToTimeString: MillisecondsToTimeStringPipe) { + } transform(lastUpdateTs: number, maxRuleNodeDebugDurationMinutes: number): string { - const minutes = Math.max(0, Math.floor(this.getDebugTime(lastUpdateTs, maxRuleNodeDebugDurationMinutes) / MINUTE)); - return `${minutes} min left`; + const time = this.millisecondsToTimeString.transform(this.getDebugTime(lastUpdateTs, maxRuleNodeDebugDurationMinutes), true, true); + return `${time} ` + this.translate.instant('common.left'); } getDebugTime(lastUpdateTs: number, maxRuleNodeDebugDurationMinutes: number): number { diff --git a/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.html b/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.html index 800f54ae3e..ea94a99c74 100644 --- a/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.html +++ b/ui-ngx/src/app/modules/home/pages/rulechain/debug-strategy-button.component.html @@ -16,7 +16,7 @@ --> diff --git a/ui-ngx/src/app/shared/models/rule-node.models.ts b/ui-ngx/src/app/shared/models/rule-node.models.ts index 56f76b33fe..c68ecc3d1e 100644 --- a/ui-ngx/src/app/shared/models/rule-node.models.ts +++ b/ui-ngx/src/app/shared/models/rule-node.models.ts @@ -358,7 +358,7 @@ export enum DebugStrategy { DISABLED = 'DISABLED', ALL_EVENTS = 'ALL_EVENTS', ONLY_FAILURE_EVENTS = 'ONLY_FAILURE_EVENTS', - ALL_WITH_FAILURES = 'ALL_WITH_FAILURES', + ALL_THEN_ONLY_FAILURE_EVENTS = 'ALL_THEN_ONLY_FAILURE_EVENTS', } export interface FcRuleEdge extends FcEdge { diff --git a/ui-ngx/src/app/shared/pipe/milliseconds-to-time-string.pipe.ts b/ui-ngx/src/app/shared/pipe/milliseconds-to-time-string.pipe.ts index c767be3dc5..d7c5902898 100644 --- a/ui-ngx/src/app/shared/pipe/milliseconds-to-time-string.pipe.ts +++ b/ui-ngx/src/app/shared/pipe/milliseconds-to-time-string.pipe.ts @@ -24,53 +24,42 @@ export class MillisecondsToTimeStringPipe implements PipeTransform { constructor(private translate: TranslateService) { } + transform(millseconds: number, shortFormat = false, onlyFirstDigit = false): string { + const { days, hours, minutes, seconds } = this.extractTimeUnits(millseconds); + return this.formatTimeString(days, hours, minutes, seconds, shortFormat, onlyFirstDigit); + } - transform(millseconds: number, shortFormat = false): string { - let seconds = Math.floor(millseconds / 1000); + private extractTimeUnits(milliseconds: number): { days: number; hours: number; minutes: number; seconds: number } { + const seconds = Math.floor(milliseconds / 1000); const days = Math.floor(seconds / 86400); - let hours = Math.floor((seconds % 86400) / 3600); - let minutes = Math.floor(((seconds % 86400) % 3600) / 60); - seconds = seconds % 60; + const hours = Math.floor((seconds % 86400) / 3600); + const minutes = Math.floor(((seconds % 86400) % 3600) / 60); + return { days, hours, minutes, seconds: seconds % 60 }; + } + + private formatTimeString( + days: number, + hours: number, + minutes: number, + seconds: number, + shortFormat: boolean, + onlyFirstDigit: boolean + ): string { + const timeUnits = [ + { value: days, key: 'days', shortKey: 'short.days' }, + { value: hours, key: 'hours', shortKey: 'short.hours' }, + { value: minutes, key: 'minutes', shortKey: 'short.minutes' }, + { value: seconds, key: 'seconds', shortKey: 'short.seconds' } + ]; + let timeString = ''; - if (shortFormat) { - if (days > 0) { - timeString += this.translate.instant('timewindow.short.days', {days}); - } - if (hours > 0) { - timeString += this.translate.instant('timewindow.short.hours', {hours}); - } - if (minutes > 0) { - timeString += this.translate.instant('timewindow.short.minutes', {minutes}); - } - if (seconds > 0) { - timeString += this.translate.instant('timewindow.short.seconds', {seconds}); - } - if (!timeString.length) { - timeString += this.translate.instant('timewindow.short.seconds', {seconds: 0}); - } - } else { - if (days > 0) { - timeString += this.translate.instant('timewindow.days', {days}); - } - if (hours > 0) { - if (timeString.length === 0 && hours === 1) { - hours = 0; - } - timeString += this.translate.instant('timewindow.hours', {hours}); - } - if (minutes > 0) { - if (timeString.length === 0 && minutes === 1) { - minutes = 0; - } - timeString += this.translate.instant('timewindow.minutes', {minutes}); - } - if (seconds > 0) { - if (timeString.length === 0 && seconds === 1) { - seconds = 0; - } - timeString += this.translate.instant('timewindow.seconds', {seconds}); + for (const { value, key, shortKey } of timeUnits) { + if (value > 0) { + timeString += this.translate.instant(shortFormat ? `timewindow.${shortKey}` : `timewindow.${key}`, { [key]: value }); + if (onlyFirstDigit) return timeString; } } - return timeString; + + return timeString.length > 0 ? timeString : this.translate.instant('timewindow.short.seconds', { seconds: 0 }); } } diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 6185257663..161a5194bc 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1004,6 +1004,7 @@ "all": "All", "hint": { "main": "All node debug messages rate limited with:", + "main-limited": "All node debug messages will be rate-limited, with a maximum of {{msg}} messages allowed per {{sec}} seconds.", "on-failure": "Save all failure debug events without time limit.", "all-messages": "Save all debug events during time limit." } @@ -1038,11 +1039,13 @@ "enter-password": "Enter password", "enter-search": "Enter search", "created-time": "Created time", + "disabled": "Disabled", "loading": "Loading...", "proceed": "Proceed", "open-details-page": "Open details page", "not-found": "Not found", - "documentation": "Documentation" + "documentation": "Documentation", + "left": "left" }, "content-type": { "json": "Json", @@ -2084,7 +2087,6 @@ "column": "Column", "row": "Row" }, - "disabled": "Disabled", "edge": { "edge": "Edge", "edge-instances": "Edge instances",