Fix log config inputs not allowing for zero (#579)

This commit is contained in:
Flaminel
2026-04-22 16:15:56 +03:00
committed by GitHub
parent 8770a8b18e
commit 41ca55d615
2 changed files with 16 additions and 10 deletions

View File

@@ -109,15 +109,15 @@
<div class="form-divider"></div>
<div class="form-row">
<app-number-input label="Rolling Size" [(value)]="logRollingSizeMB" [min]="1" [max]="100" suffix="MB"
<app-number-input label="Rolling Size" [(value)]="logRollingSizeMB" [min]="0" [max]="100" suffix="MB"
hint="Maximum size of each log file in megabytes (0 = disabled)"
[error]="logRollingSizeError()"
helpKey="general:log.rollingSizeMB" />
<app-number-input label="Retained Files" [(value)]="logRetainedFileCount" [min]="1" [max]="50"
<app-number-input label="Retained Files" [(value)]="logRetainedFileCount" [min]="0" [max]="50"
hint="Number of old log files to retain (0 = unlimited)"
[error]="logRetainedFileCountError()"
helpKey="general:log.retainedFileCount" />
<app-number-input label="Time Limit" [(value)]="logTimeLimitHours" [min]="1" [max]="1440" suffix="hours"
<app-number-input label="Time Limit" [(value)]="logTimeLimitHours" [min]="0" [max]="1440" suffix="hours"
hint="Maximum age of old log files in hours (0 = unlimited)"
[error]="logTimeLimitError()"
helpKey="general:log.timeLimitHours" />
@@ -130,11 +130,11 @@
helpKey="general:log.archiveEnabled" />
@if (logArchiveEnabled()) {
<div class="form-row">
<app-number-input label="Archive Retained Count" [(value)]="logArchiveRetainedCount" [min]="1" [max]="100"
<app-number-input label="Archive Retained Count" [(value)]="logArchiveRetainedCount" [min]="0" [max]="100"
hint="Number of archive files to retain (0 = unlimited)"
[error]="logArchiveRetainedError()"
helpKey="general:log.archiveRetainedCount" />
<app-number-input label="Archive Time Limit" [(value)]="logArchiveTimeLimitHours" [min]="1" [max]="1440" suffix="hours"
<app-number-input label="Archive Time Limit" [(value)]="logArchiveTimeLimitHours" [min]="0" [max]="1440" suffix="hours"
hint="Maximum age of archive files in hours (0 = unlimited)"
[error]="logArchiveTimeLimitError()"
helpKey="general:log.archiveTimeLimitHours" />

View File

@@ -101,7 +101,7 @@ export class GeneralSettingsComponent implements OnInit, HasPendingChanges {
readonly logRollingSizeError = computed(() => {
const v = this.logRollingSizeMB();
if (v == null) return 'This field is required';
if (v < 1) return 'Minimum value is 1';
if (v < 0) return 'Minimum value is 0';
if (v > 100) return 'Maximum value is 100 MB';
return undefined;
});
@@ -117,25 +117,31 @@ export class GeneralSettingsComponent implements OnInit, HasPendingChanges {
readonly logTimeLimitError = computed(() => {
const v = this.logTimeLimitHours();
if (v == null) return 'This field is required';
if (v < 1) return 'Minimum value is 1';
if (v < 0) return 'Minimum value is 0';
if (v > 1440) return 'Maximum value is 1440 hours (60 days)';
return undefined;
});
readonly logArchiveRetentionBothZeroError = computed(() =>
this.logArchiveEnabled() && this.logArchiveRetainedCount() === 0 && this.logArchiveTimeLimitHours() === 0
? 'Retained count and time limit cannot both be 0 when archiving is enabled'
: undefined
);
readonly logArchiveRetainedError = computed(() => {
const v = this.logArchiveRetainedCount();
if (v == null) return 'This field is required';
if (v < 0) return 'Minimum value is 0';
if (v > 100) return 'Maximum value is 100';
return undefined;
return this.logArchiveRetentionBothZeroError();
});
readonly logArchiveTimeLimitError = computed(() => {
const v = this.logArchiveTimeLimitHours();
if (v == null) return 'This field is required';
if (v < 1) return 'Minimum value is 1';
if (v < 0) return 'Minimum value is 0';
if (v > 1440) return 'Maximum value is 1440 hours (60 days)';
return undefined;
return this.logArchiveRetentionBothZeroError();
});
readonly strikeInactivityWindowHoursError = computed(() => {