+
+
Retention policy
+
diff --git a/frontend/src/features/backups/ui/ShowBackupConfigComponent.tsx b/frontend/src/features/backups/ui/ShowBackupConfigComponent.tsx
index aaf7fc5..70d179d 100644
--- a/frontend/src/features/backups/ui/ShowBackupConfigComponent.tsx
+++ b/frontend/src/features/backups/ui/ShowBackupConfigComponent.tsx
@@ -6,7 +6,12 @@ import { useMemo } from 'react';
import { useEffect, useState } from 'react';
import { IS_CLOUD } from '../../../constants';
-import { type BackupConfig, BackupEncryption, backupConfigApi } from '../../../entity/backups';
+import {
+ type BackupConfig,
+ BackupEncryption,
+ RetentionPolicyType,
+ backupConfigApi,
+} from '../../../entity/backups';
import { BackupNotificationType } from '../../../entity/backups/model/BackupNotificationType';
import type { Database } from '../../../entity/databases';
import { Period } from '../../../entity/databases/model/Period';
@@ -60,10 +65,21 @@ const notificationLabels = {
[BackupNotificationType.BackupSuccess]: 'Backup success',
};
+const formatGfsRetention = (config: BackupConfig): string => {
+ const parts: string[] = [];
+
+ if (config.retentionGfsHours > 0) parts.push(`${config.retentionGfsHours} hourly`);
+ if (config.retentionGfsDays > 0) parts.push(`${config.retentionGfsDays} daily`);
+ if (config.retentionGfsWeeks > 0) parts.push(`${config.retentionGfsWeeks} weekly`);
+ if (config.retentionGfsMonths > 0) parts.push(`${config.retentionGfsMonths} monthly`);
+ if (config.retentionGfsYears > 0) parts.push(`${config.retentionGfsYears} yearly`);
+
+ return parts.length > 0 ? parts.join(', ') : 'Not configured';
+};
+
export const ShowBackupConfigComponent = ({ database }: Props) => {
const [backupConfig, setBackupConfig] = useState
();
- // Detect user's preferred time format (12-hour vs 24-hour)
const timeFormat = useMemo(() => {
const is12Hour = getIs12Hour();
return {
@@ -92,7 +108,6 @@ export const ShowBackupConfigComponent = ({ database }: Props) => {
const formattedTime = localTime ? localTime.format(timeFormat.format) : '';
- // Convert UTC weekday/day-of-month to local equivalents for display
const displayedWeekday: number | undefined =
backupInterval?.interval === IntervalType.WEEKLY &&
backupInterval.weekday &&
@@ -107,6 +122,8 @@ export const ShowBackupConfigComponent = ({ database }: Props) => {
? getLocalDayOfMonth(backupInterval.dayOfMonth, backupInterval.timeOfDay)
: backupInterval?.dayOfMonth;
+ const retentionPolicyType = backupConfig.retentionPolicyType ?? RetentionPolicyType.TimePeriod;
+
return (
@@ -193,8 +210,27 @@ export const ShowBackupConfigComponent = ({ database }: Props) => {
)}
-
Store period
-
{backupConfig.storePeriod ? periodLabels[backupConfig.storePeriod] : ''}
+
Retention policy
+
+ {retentionPolicyType === RetentionPolicyType.TimePeriod && (
+
+ {backupConfig.retentionTimePeriod
+ ? periodLabels[backupConfig.retentionTimePeriod]
+ : ''}
+
+ )}
+ {retentionPolicyType === RetentionPolicyType.Count && (
+ Keep last {backupConfig.retentionCount} backups
+ )}
+ {retentionPolicyType === RetentionPolicyType.GFS && (
+
+ {formatGfsRetention(backupConfig)}
+
+
+
+
+ )}
+