ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Add a Storage tab to admin settings
Juan Denis7c303f856c5c
diff --git a/frontend/src/components/settings/StorageTab.jsx b/frontend/src/components/settings/StorageTab.jsxnew file mode 100644index 00000000..3a97345a--- /dev/null+++ b/frontend/src/components/settings/StorageTab.jsx@@ -0,0 +1,352 @@+import { useCallback, useEffect, useState } from 'react';+import { HardDrive, RefreshCw } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import api from '@/services/api';+import { useToast } from '@/contexts/useToast.js';+import useSettingFocus from '@/hooks/useSettingFocus';+import { Button } from '@/components/ui/button';+import { Input } from '@/components/ui/input';+import { Label } from '@/components/ui/label';+import EmptyState from '@/components/EmptyState';+import DiskReclaimModal from '@/components/monitoring/DiskReclaimModal';+import formatBytes from '@/utils/formatBytes';+import { formatDateTime, formatPercent, formatRelative } from '@/utils/intl';++// The four day-count windows plus the rollback window: integers, 0 = off.+const NUMBER_KEYS = [+ 'telemetry.retention_days',+ 'jobs.retention_days',+ 'history.retention_days',+ 'audit_log_retention_days',+ 'storage.previous_slot_hours',+];+const LOG_SIZE_KEY = 'storage.docker_log_max_size';+// Docker json-file max-size: a number with an optional k/m/g unit.+const LOG_SIZE_PATTERN = /^\d+[kmg]?$/i;++function toForm(retention) {+ const form = {};+ for (const key of [...NUMBER_KEYS, LOG_SIZE_KEY]) {+ const value = retention?.[key];+ form[key] = value === null || value === undefined ? '' : String(value);+ }+ return form;+}++function diskTone(percent) {+ if (percent >= 90) return 'danger';+ if (percent >= 75) return 'warning';+ return 'ok';+}++/**+ * Where the panel host's disk goes (plan 85 §D1/§D2). Reads the storage+ * overview, hands cleanup to the existing curated reclaim flow, and edits the+ * retention settings that bound ServerKit's own share of the disk.+ */+export default function StorageTab() {+ const { t } = useTranslation();+ const toast = useToast();+ const register = useSettingFocus();+ const [overview, setOverview] = useState(null);+ const [loading, setLoading] = useState(true);+ const [error, setError] = useState(null);+ const [reclaimOpen, setReclaimOpen] = useState(false);+ const [form, setForm] = useState(toForm(null));+ const [saving, setSaving] = useState(false);++ const itemLabels = {+ docker_images: t('app.storageTab.itemDockerImages', 'App images'),+ docker_volumes: t('app.storageTab.itemDockerVolumes', 'App volumes'),+ docker_build_cache: t('app.storageTab.itemDockerBuildCache', 'Docker build cache'),+ panel_database: t('app.storageTab.itemPanelDatabase', 'Panel database'),+ backups: t('app.storageTab.itemBackups', 'Backups and upgrade snapshots'),+ panel_logs: t('app.storageTab.itemPanelLogs', 'Panel logs'),+ previous_install: t('app.storageTab.itemPreviousInstall', 'Previous version (rollback)'),+ };++ const retentionFields = {+ 'telemetry.retention_days': {+ label: t('app.storageTab.telemetryRetention', 'Telemetry retention (days)'),+ hint: t('app.storageTab.telemetryRetentionHint', 'Queue messages, system events and API usage logs.'),+ },+ 'jobs.retention_days': {+ label: t('app.storageTab.jobsRetention', 'Job retention (days)'),+ hint: t('app.storageTab.jobsRetentionHint', 'Succeeded and cancelled background jobs. Failed jobs are kept three times as long.'),+ },+ 'history.retention_days': {+ label: t('app.storageTab.historyRetention', 'History retention (days)'),+ hint: t('app.storageTab.historyRetentionHint', 'Error logs, notifications, deployment jobs, cron runs, webhook deliveries and sandbox runs.'),+ },+ audit_log_retention_days: {+ label: t('app.storageTab.auditRetention', 'Audit log retention (days)'),+ hint: t('app.storageTab.auditRetentionHint', 'Who did what in the panel.'),+ },+ 'storage.previous_slot_hours': {+ label: t('app.storageTab.previousSlotHours', 'Keep previous version (hours)'),+ hint: t('app.storageTab.previousSlotHoursHint', 'How long after a healthy update the previous install stays for instant rollback. 0 keeps it until the next update.'),+ },+ };++ const load = useCallback(async () => {+ setLoading(true);+ setError(null);+ try {+ const data = await api.getStorageOverview();+ setOverview(data);+ setForm(toForm(data?.retention));+ } catch (err) {+ setError(err.message || t('app.storageTab.couldNotLoad', 'Could not load the storage overview'));+ } finally {+ setLoading(false);+ }+ }, [t]);++ useEffect(() => { load(); }, [load]);++ const closeReclaim = () => {+ setReclaimOpen(false);+ load();+ };++ const setField = (key, value) => setForm((prev) => ({ ...prev, [key]: value }));++ const save = async () => {+ const payload = {};+ for (const key of NUMBER_KEYS) {+ const raw = form[key].trim();+ if (!/^\d+$/.test(raw)) {+ toast.error(t('app.storageTab.invalidNumber', '{{field}} must be a whole number, 0 or more', { field: retentionFields[key].label }));+ return;+ }+ payload[key] = Number(raw);+ }+ const logSize = form[LOG_SIZE_KEY].trim();+ if (!LOG_SIZE_PATTERN.test(logSize)) {+ toast.error(t('app.storageTab.invalidLogSize', 'Container log size must look like 50m, 200k or 1g'));+ return;+ }+ payload[LOG_SIZE_KEY] = logSize.toLowerCase();++ setSaving(true);+ try {+ await api.updateSystemSettings(payload);+ toast.success(t('app.storageTab.retentionSaved', 'Retention settings saved'));+ await load();+ } catch (err) {+ toast.error(err.message || t('app.storageTab.saveFailed', 'Could not save retention settings'));+ } finally {+ setSaving(false);+ }+ };++ if (loading && !overview) {+ return (+ <div className="settings-section">+ <EmptyState loading title={t('app.storageTab.measuring', 'Measuring disk usage…')} />+ </div>+ );+ }++ if (error && !overview) {+ return (+ <div className="settings-section">+ <EmptyState+ icon={HardDrive}+ title={t('app.storageTab.couldNotLoad', 'Could not load the storage overview')}+ description={error}+ action={(+ <Button variant="outline" onClick={load}>+ {t('common.actions.retry', 'Retry')}+ </Button>+ )}+ />+ </div>+ );+ }++ const disk = overview?.disk || {};+ const percent = typeof disk.percent === 'number' ? disk.percent : null;+ const items = [...(overview?.items || [])].sort((a, b) => (b.bytes || 0) - (a.bytes || 0));+ const previous = overview?.previous_install;++ let previousWhen;+ if (previous?.removable_now) {+ previousWhen = t('app.storageTab.previousRemovedNextCleanup', 'Removed at the next cleanup');+ } else if (previous?.removable_at) {+ const at = new Date(previous.removable_at * 1000);+ previousWhen = t('app.storageTab.previousRemovedAt', 'Removed automatically {{relative}} ({{date}})', {+ relative: formatRelative(at),+ date: formatDateTime(at),+ });+ } else if (previous) {+ previousWhen = t('app.storageTab.previousKeptUntilUpdate', 'Kept until the next update');+ }++ return (+ <div className="settings-section storage-tab">+ <div className="section-header">+ <h2>{t('app.storageTab.title', 'Storage')}</h2>+ <p>{t('app.storageTab.subtitle', 'Where this server\'s disk goes, and how long ServerKit keeps its own history.')}</p>+ </div>++ <div {...register('storage-disk', 'settings-card')}>+ <div className="settings-card__header">+ <div className="settings-card__header-left">+ <HardDrive size={18} />+ <div>+ <h3>{t('app.storageTab.diskUsage', 'Disk usage')}</h3>+ {disk.path && <p className="storage-tab__path">{disk.path}</p>}+ </div>+ </div>+ <div className="storage-tab__actions">+ <Button variant="ghost" size="sm" onClick={load} disabled={loading}>+ <RefreshCw size={14} />+ {t('common.actions.refresh', 'Refresh')}+ </Button>+ <Button size="sm" onClick={() => setReclaimOpen(true)}>+ <HardDrive size={14} />+ {t('app.storageTab.freeUpSpace', 'Free up space')}+ </Button>+ </div>+ </div>++ {percent === null ? (+ <p className="storage-tab__muted">{t('app.storageTab.diskUnavailable', 'Disk usage could not be measured on this host.')}</p>+ ) : (+ <>+ <div className="storage-disk__summary">+ <span className="storage-disk__percent">{formatPercent(percent, { decimals: 1 })}</span>+ <span className="storage-disk__detail">+ {t('app.storageTab.usedOfTotal', '{{used}} used of {{total}}', {+ used: formatBytes(disk.used),+ total: formatBytes(disk.total),+ })}+ </span>+ <span className="storage-disk__free">+ {t('app.storageTab.freeAmount', '{{free}} free', { free: formatBytes(disk.free) })}+ </span>+ </div>+ <progress+ className={`storage-disk__bar storage-disk__bar--${diskTone(percent)}`}+ max={100}+ value={percent}+ aria-label={t('app.storageTab.diskUsage', 'Disk usage')}+ />+ </>+ )}++ {overview?.profile === 'small' && (+ <p className="storage-tab__note">+ {t('app.storageTab.smallDiskNote', 'Small disk: shorter retention defaults are in use.')}+ </p>+ )}+ </div>++ <div {...register('storage-breakdown', 'settings-card')}>+ <h3>{t('app.storageTab.breakdown', 'What is using the disk')}</h3>+ <p>{t('app.storageTab.breakdownHint', 'Measured now. Reclaimable is what Docker reports it could free without touching running apps.')}</p>+ {items.length === 0 ? (+ <p className="storage-tab__muted">{t('app.storageTab.noItems', 'Nothing to report — Docker is not answering and no panel data was found.')}</p>+ ) : (+ <ul className="storage-breakdown">+ {items.map((item) => (+ <li key={item.key} className="storage-breakdown__row">+ <span className="storage-breakdown__label">{itemLabels[item.key] || item.label}</span>+ <span className="storage-breakdown__size">{formatBytes(item.bytes)}</span>+ <span className="storage-breakdown__reclaim">+ {item.reclaimable+ ? t('app.storageTab.reclaimable', '{{size}} reclaimable', { size: formatBytes(item.reclaimable) })+ : ''}+ </span>+ {disk.total ? (+ <progress+ className="storage-breakdown__bar"+ max={disk.total}+ value={item.bytes || 0}+ aria-hidden="true"+ />+ ) : null}+ </li>+ ))}+ </ul>+ )}+ </div>++ {previous && (+ <div {...register('storage-previous-install', 'settings-card')}>+ <h3>{t('app.storageTab.previousInstall', 'Previous version (rollback)')}</h3>+ <p>{t('app.storageTab.previousInstallHint', 'The install from before the last update, kept so a rollback is instant.')}</p>+ <div className="settings-row">+ <div className="settings-label">+ <span className="storage-tab__mono">{previous.path}</span>+ <span className="settings-hint">{previousWhen}</span>+ </div>+ <div className="settings-control">+ <span className="storage-breakdown__size">{formatBytes(previous.bytes)}</span>+ </div>+ </div>+ </div>+ )}++ <div {...register('storage-retention', 'settings-card')}>+ <h3>{t('app.storageTab.retention', 'Retention')}</h3>+ <p>{t('app.storageTab.retentionHint', 'How long ServerKit keeps its own records before pruning them. 0 disables pruning.')}</p>++ <div className="form-group">+ {NUMBER_KEYS.map((key) => {+ const id = `storage-${key.replace(/[._]/g, '-')}`;+ return (+ <div key={key} className="settings-row">+ <div className="settings-label">+ <Label htmlFor={id}>{retentionFields[key].label}</Label>+ <span className="settings-hint">{retentionFields[key].hint}</span>+ </div>+ <div className="settings-control">+ <Input+ id={id}+ type="number"+ min={0}+ step={1}+ className="storage-tab__input"+ value={form[key]}+ onChange={(e) => setField(key, e.target.value)}+ disabled={saving}+ />+ </div>+ </div>+ );+ })}+ <div className="settings-row">+ <div className="settings-label">+ <Label htmlFor="storage-docker-log-max-size">+ {t('app.storageTab.dockerLogMaxSize', 'Container log size cap')}+ </Label>+ <span className="settings-hint">+ {t('app.storageTab.dockerLogMaxSizeHint', 'Per container log file, three files kept (for example 50m). Applies to containers created after Docker restarts.')}+ </span>+ </div>+ <div className="settings-control">+ <Input+ id="storage-docker-log-max-size"+ type="text"+ className="storage-tab__input"+ value={form[LOG_SIZE_KEY]}+ onChange={(e) => setField(LOG_SIZE_KEY, e.target.value)}+ disabled={saving}+ />+ </div>+ </div>+ </div>++ <div className="settings-card__footer">+ <Button onClick={save} disabled={saving}>+ {saving ? t('common.editing.saving', 'Saving…') : t('common.actions.save', 'Save')}+ </Button>+ </div>+ </div>++ <DiskReclaimModal open={reclaimOpen} onClose={closeReclaim} />+ </div>+ );+}diff --git a/frontend/src/data/settingsIndex.js b/frontend/src/data/settingsIndex.jsindex adb2cd61..83004b3a 100644--- a/frontend/src/data/settingsIndex.js+++ b/frontend/src/data/settingsIndex.js@@ -118,6 +118,8 @@ export const SETTINGS_INDEX = [{ id: 'migrations-apply', labelKey: 'app.settingsIndex.applyDatabaseMigrations', label: 'Apply database migrations', descriptionKey: 'app.settingsIndex.applyPendingSchemaUpdatesToThe', description: 'Apply pending schema updates to the database', keywords: 'migration database schema update', tab: 'migrations', adminOnly: true },{ id: 'migrations-history', labelKey: 'app.settingsIndex.migrationHistory', label: 'Migration history', descriptionKey: 'app.settingsIndex.reviewPreviouslyAppliedDatabaseMigrations', description: 'Review previously applied database migrations', keywords: 'migration history database schema', tab: 'migrations', adminOnly: true },+ { id: 'storage-disk', labelKey: 'app.settingsIndex.storageDiskUsage', label: 'Disk usage and cleanup', descriptionKey: 'app.settingsIndex.seeWhatIsUsingThePanel', description: 'See what is using the panel host disk and free up space', keywords: 'storage disk space usage full reclaim cleanup free docker images volumes', tab: 'storage', adminOnly: true },+ { id: 'storage-retention', labelKey: 'app.settingsIndex.storageRetention', label: 'Data retention', descriptionKey: 'app.settingsIndex.chooseHowLongTelemetryJobsHistory', description: 'Choose how long telemetry, jobs, history and audit logs are kept', keywords: 'retention prune telemetry jobs history audit log docker log size rollback previous version', tab: 'storage', adminOnly: true },{ id: 'system-cpu', labelKey: 'app.settingsIndex.cpuMetrics', label: 'CPU metrics', descriptionKey: 'app.settingsIndex.viewCpuUsageCoresAndLoad', description: 'View CPU usage, cores, and load average', keywords: 'cpu usage cores load', tab: 'system', adminOnly: true },{ id: 'system-memory', labelKey: 'app.settingsIndex.memoryMetrics', label: 'Memory metrics', descriptionKey: 'app.settingsIndex.viewMemoryUsageAndAvailableRam', description: 'View memory usage and available RAM', keywords: 'memory ram usage', tab: 'system', adminOnly: true },{ id: 'system-disk', labelKey: 'app.settingsIndex.diskMetrics', label: 'Disk metrics', descriptionKey: 'app.settingsIndex.viewDiskUsageAndStorageCapacity', description: 'View disk usage and storage capacity', keywords: 'disk storage usage', tab: 'system', adminOnly: true },diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.jsonindex 5f9c9124..805d26a9 100644--- a/frontend/src/i18n/locales/en.json+++ b/frontend/src/i18n/locales/en.json@@ -5029,6 +5029,7 @@"settingsSection": "Settings section","sidebar": "Sidebar","siteSettings": "Site Settings",+ "storage": "Storage","styleGuide": "Style Guide","systemInfo": "System Info","users": "Users",@@ -5070,6 +5071,7 @@"chooseAPresetLayoutOrCustomize": "Choose a preset layout or customize sidebar items individually","chooseBetweenDarkLightOrSystem": "Choose between dark, light, or system default theme","chooseBetweenWildcardOrPerSite": "Choose between wildcard or per-site DNS records",+ "chooseHowLongTelemetryJobsHistory": "Choose how long telemetry, jobs, history and audit logs are kept","chooseHowToDisplayCustomBranding": "Choose how to display custom branding (logo + text, full-width, or text only)","chooseHowToReceiveNotificationsEmail": "Choose how to receive notifications (email, Discord, Slack, Telegram)","chooseTheLanguageModelToUse": "Choose the language model to use",@@ -5168,6 +5170,7 @@"reviewPreviouslyAppliedDatabaseMigrations": "Review previously applied database migrations","rotateTheSigningSecretUsedTo": "Rotate the signing secret used to verify an inbound webhook endpoint","saml20": "SAML 2.0",+ "seeWhatIsUsingThePanel": "See what is using the panel host disk and free up space","selectEventTypesThatTriggerNotifications": "Select event types that trigger notifications (system, security, backups, apps)","selectTheAiServiceProviderOpenai": "Select the AI service provider (OpenAI, Anthropic, Ollama, etc.)","selectThePrimaryAccentColorFor": "Select the primary accent color for the UI",@@ -5189,6 +5192,8 @@"sidebarViewProfiles": "Sidebar view profiles","ssoGeneralSettings": "SSO general settings","ssoOnlyMode": "SSO-only mode",+ "storageDiskUsage": "Disk usage and cleanup",+ "storageRetention": "Data retention","themeMode": "Theme mode","toggleIndividualSidebarItemsOnOr": "Toggle individual sidebar items on or off","toggleTheInPanelAiAssistant": "Toggle the in-panel AI assistant on or off",@@ -5653,6 +5658,52 @@"storageDestinations": {"snapshots": "Snapshots"},+ "storageTab": {+ "auditRetention": "Audit log retention (days)",+ "auditRetentionHint": "Who did what in the panel.",+ "breakdown": "What is using the disk",+ "breakdownHint": "Measured now. Reclaimable is what Docker reports it could free without touching running apps.",+ "couldNotLoad": "Could not load the storage overview",+ "diskUnavailable": "Disk usage could not be measured on this host.",+ "diskUsage": "Disk usage",+ "dockerLogMaxSize": "Container log size cap",+ "dockerLogMaxSizeHint": "Per container log file, three files kept (for example 50m). Applies to containers created after Docker restarts.",+ "freeAmount": "{{free}} free",+ "freeUpSpace": "Free up space",+ "historyRetention": "History retention (days)",+ "historyRetentionHint": "Error logs, notifications, deployment jobs, cron runs, webhook deliveries and sandbox runs.",+ "invalidLogSize": "Container log size must look like 50m, 200k or 1g",+ "invalidNumber": "{{field}} must be a whole number, 0 or more",+ "itemBackups": "Backups and upgrade snapshots",+ "itemDockerBuildCache": "Docker build cache",+ "itemDockerImages": "App images",+ "itemDockerVolumes": "App volumes",+ "itemPanelDatabase": "Panel database",+ "itemPanelLogs": "Panel logs",+ "itemPreviousInstall": "Previous version (rollback)",+ "jobsRetention": "Job retention (days)",+ "jobsRetentionHint": "Succeeded and cancelled background jobs. Failed jobs are kept three times as long.",+ "measuring": "Measuring disk usage…",+ "noItems": "Nothing to report — Docker is not answering and no panel data was found.",+ "previousInstall": "Previous version (rollback)",+ "previousInstallHint": "The install from before the last update, kept so a rollback is instant.",+ "previousKeptUntilUpdate": "Kept until the next update",+ "previousRemovedAt": "Removed automatically {{relative}} ({{date}})",+ "previousRemovedNextCleanup": "Removed at the next cleanup",+ "previousSlotHours": "Keep previous version (hours)",+ "previousSlotHoursHint": "How long after a healthy update the previous install stays for instant rollback. 0 keeps it until the next update.",+ "reclaimable": "{{size}} reclaimable",+ "retention": "Retention",+ "retentionHint": "How long ServerKit keeps its own records before pruning them. 0 disables pruning.",+ "retentionSaved": "Retention settings saved",+ "saveFailed": "Could not save retention settings",+ "smallDiskNote": "Small disk: shorter retention defaults are in use.",+ "subtitle": "Where this server's disk goes, and how long ServerKit keeps its own history.",+ "telemetryRetention": "Telemetry retention (days)",+ "telemetryRetentionHint": "Queue messages, system events and API usage logs.",+ "title": "Storage",+ "usedOfTotal": "{{used}} used of {{total}}"+ },"styleGuide": {"2Found": "2 found","aNewVersionIsAvailableFor": "A new version is available for update.",diff --git a/frontend/src/i18n/locales/es.json b/frontend/src/i18n/locales/es.jsonindex 2fd8408f..b9851fd9 100644--- a/frontend/src/i18n/locales/es.json+++ b/frontend/src/i18n/locales/es.json@@ -4820,7 +4820,8 @@"systemInfo": "Información del sistema","users": "Usuarios","webhooks": "Webhooks",- "whiteLabel": "Marca blanca"+ "whiteLabel": "Marca blanca",+ "storage": "Almacenamiento"},"settingsIndex": {"accentColor": "Color de acento",@@ -4996,7 +4997,11 @@"viewServerkitVersionAndCheckFor": "Ver la versión de ServerKit y buscar actualizaciones","webhookDeliveries": "Entregas de webhooks","webhookEndpoints": "Endpoints de webhooks",- "webhookSubscriptions": "Suscripciones de webhooks"+ "webhookSubscriptions": "Suscripciones de webhooks",+ "chooseHowLongTelemetryJobsHistory": "Elige cuánto tiempo se conservan la telemetría, los trabajos, el historial y los registros de auditoría",+ "seeWhatIsUsingThePanel": "Mira qué ocupa el disco del servidor del panel y libera espacio",+ "storageDiskUsage": "Uso del disco y limpieza",+ "storageRetention": "Retención de datos"},"settingsTab": {"adminEmail": "Correo del administrador",@@ -6638,6 +6643,52 @@"users": "Usuarios","workspaceBrandColor": "Color de marca del espacio de trabajo","workspaceCreated": "Espacio de trabajo creado"+ },+ "storageTab": {+ "auditRetention": "Retención del registro de auditoría (días)",+ "auditRetentionHint": "Quién hizo qué en el panel.",+ "breakdown": "Qué está ocupando el disco",+ "breakdownHint": "Medido ahora. Recuperable es lo que Docker indica que podría liberar sin tocar las aplicaciones en ejecución.",+ "couldNotLoad": "No se pudo cargar el resumen de almacenamiento",+ "diskUnavailable": "No se pudo medir el uso del disco en este servidor.",+ "diskUsage": "Uso del disco",+ "dockerLogMaxSize": "Límite de tamaño del registro de contenedores",+ "dockerLogMaxSizeHint": "Por archivo de registro de cada contenedor, se conservan tres archivos (por ejemplo 50m). Se aplica a los contenedores creados después de reiniciar Docker.",+ "freeAmount": "{{free}} libres",+ "freeUpSpace": "Liberar espacio",+ "historyRetention": "Retención del historial (días)",+ "historyRetentionHint": "Registros de errores, notificaciones, trabajos de despliegue, ejecuciones de cron, entregas de webhooks y ejecuciones del sandbox.",+ "invalidLogSize": "El tamaño del registro de contenedores debe tener la forma 50m, 200k o 1g",+ "invalidNumber": "{{field}} debe ser un número entero, 0 o mayor",+ "itemBackups": "Copias de seguridad e instantáneas de actualización",+ "itemDockerBuildCache": "Caché de compilación de Docker",+ "itemDockerImages": "Imágenes de aplicaciones",+ "itemDockerVolumes": "Volúmenes de aplicaciones",+ "itemPanelDatabase": "Base de datos del panel",+ "itemPanelLogs": "Registros del panel",+ "itemPreviousInstall": "Versión anterior (reversión)",+ "jobsRetention": "Retención de trabajos (días)",+ "jobsRetentionHint": "Trabajos en segundo plano completados y cancelados. Los trabajos fallidos se conservan el triple de tiempo.",+ "measuring": "Midiendo el uso del disco…",+ "noItems": "Nada que mostrar: Docker no responde y no se encontraron datos del panel.",+ "previousInstall": "Versión anterior (reversión)",+ "previousInstallHint": "La instalación previa a la última actualización, conservada para que revertir sea instantáneo.",+ "previousKeptUntilUpdate": "Se conserva hasta la próxima actualización",+ "previousRemovedAt": "Se eliminará automáticamente {{relative}} ({{date}})",+ "previousRemovedNextCleanup": "Se eliminará en la próxima limpieza",+ "previousSlotHours": "Conservar la versión anterior (horas)",+ "previousSlotHoursHint": "Cuánto tiempo tras una actualización correcta se conserva la instalación anterior para revertir al instante. 0 la conserva hasta la próxima actualización.",+ "reclaimable": "{{size}} recuperables",+ "retention": "Retención",+ "retentionHint": "Cuánto tiempo conserva ServerKit sus propios registros antes de depurarlos. 0 desactiva la depuración.",+ "retentionSaved": "Configuración de retención guardada",+ "saveFailed": "No se pudo guardar la configuración de retención",+ "smallDiskNote": "Disco pequeño: se usan valores de retención más cortos por defecto.",+ "subtitle": "En qué se usa el disco de este servidor y cuánto tiempo conserva ServerKit su propio historial.",+ "telemetryRetention": "Retención de telemetría (días)",+ "telemetryRetentionHint": "Mensajes de cola, eventos del sistema y registros de uso de la API.",+ "title": "Almacenamiento",+ "usedOfTotal": "{{used}} usados de {{total}}"}},"auth": {diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsxindex 2590ebaa..aff8f4eb 100644--- a/frontend/src/pages/Settings.jsx+++ b/frontend/src/pages/Settings.jsx@@ -23,20 +23,21 @@ import AISettingsTab from '../components/settings/AISettingsTab';import WebhooksTab from '../components/settings/WebhooksTab';import AboutTab from '../components/settings/AboutTab';import CloudTab from '../components/settings/CloudTab';+import StorageTab from '../components/settings/StorageTab';import PluginSlot from '../components/PluginSlot';-import { Activity, CloudCog, Code, Database, Layers, Link2, PaintBucket, Sparkles, Trash2, Webhook, Settings as SettingsIcon } from 'lucide-react';+import { Activity, CloudCog, Code, Database, HardDrive, Layers, Link2, PaintBucket, Sparkles, Trash2, Webhook, Settings as SettingsIcon } from 'lucide-react';import { Button } from '@/components/ui/button';import { SegControl } from '@/components/ds';import PageLayout from '../layouts/PageLayout';import { useNavigate, useParams } from 'react-router-dom';import { useTranslation } from 'react-i18next';-const VALID_TABS = ['profile', 'security', 'connections', 'cloud', 'appearance', 'sidebar', 'whitelabel', 'notifications', 'system', 'users', 'activity', 'site', 'sso', 'api', 'webhooks', 'ai', 'migrations', 'recyclebin', 'developer', 'about'];+const VALID_TABS = ['profile', 'security', 'connections', 'cloud', 'appearance', 'sidebar', 'whitelabel', 'notifications', 'system', 'users', 'activity', 'site', 'sso', 'api', 'webhooks', 'ai', 'migrations', 'recyclebin', 'storage', 'developer', 'about'];// Tabs that belong to the server-wide "Administration" group (admin-only); the// rest are personal "My Account" settings. Drives the two-way section switch so// personal prefs aren't interleaved with destructive system controls.-const ADMIN_TABS = ['users', 'activity', 'site', 'connections', 'cloud', 'sso', 'api', 'webhooks', 'ai', 'migrations', 'recyclebin', 'system', 'developer'];+const ADMIN_TABS = ['users', 'activity', 'site', 'connections', 'cloud', 'sso', 'api', 'webhooks', 'ai', 'migrations', 'recyclebin', 'storage', 'system', 'developer'];const Settings = () => {const { t } = useTranslation();@@ -285,6 +286,14 @@ const Settings = () => {<Database size={18} />{t('app.settings.migrations', 'Migrations')}</Button>+ <Button+ variant="ghost"+ className={`settings-nav-item ${activeTab === 'storage' ? 'active' : ''}`}+ onClick={() => setActiveTab('storage')}+ >+ <HardDrive size={18} />+ {t('app.settings.storage', 'Storage')}+ </Button><Buttonvariant="ghost"className={`settings-nav-item ${activeTab === 'system' ? 'active' : ''}`}@@ -346,6 +355,7 @@ const Settings = () => {{activeTab === 'webhooks' && isAdmin && <WebhooksTab />}{activeTab === 'ai' && isAdmin && <AISettingsTab />}{activeTab === 'migrations' && isAdmin && <MigrationHistoryTab />}+ {activeTab === 'storage' && isAdmin && <StorageTab />}{activeTab === 'system' && isAdmin && <SystemTab />}{activeTab === 'developer' && devMode && isAdmin && <IconReferenceTab />}{activeTab === 'about' && <AboutTab />}diff --git a/frontend/src/services/api/system.js b/frontend/src/services/api/system.jsindex 905f9f30..cdcffd7e 100644--- a/frontend/src/services/api/system.js+++ b/frontend/src/services/api/system.js@@ -98,6 +98,12 @@ export async function getSystemInfo() {return this.request('/system/info');}+// Where the panel host's disk goes, plus the retention settings that bound+// ServerKit's own share (admin, read-only).+export async function getStorageOverview() {+ return this.request('/system/storage');+}+export async function getServerTime() {return this.request('/system/time');}diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scssindex e676f0a2..5a8ddb0c 100644--- a/frontend/src/styles/main.scss+++ b/frontend/src/styles/main.scss@@ -121,6 +121,7 @@@import 'pages/_deploy-console';@import 'pages/_terminal';@import 'pages/_settings';+@import 'pages/_storage';@import 'pages/_notification-center';@import 'pages/_connections';@import 'pages/_file-manager';diff --git a/frontend/src/styles/pages/_storage.scss b/frontend/src/styles/pages/_storage.scssnew file mode 100644index 00000000..3796ba29--- /dev/null+++ b/frontend/src/styles/pages/_storage.scss@@ -0,0 +1,131 @@+// Settings → Storage (plan 85 §D1/§D2): where the panel host's disk goes,+// the rollback slot, and the retention windows that bound ServerKit's share.+// Card/row chrome comes from _settings.scss; only what is specific lives here.++.storage-tab {+ &__actions {+ display: flex;+ flex-wrap: wrap;+ gap: $space-2;+ }++ &__path,+ &__mono {+ font-family: $font-mono;+ word-break: break-all;+ }++ &__muted {+ margin: 0;+ color: $text-tertiary;+ font-size: $font-size-sm;+ }++ &__note {+ margin: $space-3 0 0;+ padding: $space-2 $space-3;+ border: 1px solid transparent;+ border-radius: $radius-md;+ @include status-variant($text-primary, $warning-bg, $warning-border);+ font-size: $font-size-sm;+ }++ &__input {+ inline-size: 120px;+ }+}++// Progress bars share one reset: a native <progress> carries its value, so+// the fill width never needs an inline style.+@mixin storage-progress($height, $fill) {+ display: block;+ inline-size: 100%;+ block-size: $height;+ overflow: hidden;+ border: 0;+ border-radius: $radius-full;+ background: $bg-hover;+ appearance: none;++ &::-webkit-progress-bar { background: $bg-hover; }+ &::-webkit-progress-value { background: $fill; }+ &::-moz-progress-bar { background: $fill; }+}++.storage-disk {+ &__summary {+ display: flex;+ flex-wrap: wrap;+ align-items: baseline;+ gap: $space-2 $space-4;+ margin-block-end: $space-3;+ }++ &__percent {+ color: $text-primary;+ font-size: $font-size-2xl;+ font-weight: $font-weight-semibold;+ font-variant-numeric: tabular-nums;+ }++ &__detail {+ color: $text-secondary;+ font-size: $font-size-sm;+ }++ &__free {+ margin-inline-start: auto;+ color: $text-secondary;+ font-size: $font-size-sm;+ }++ &__bar {+ @include storage-progress(8px, $success);++ &--warning { @include storage-progress(8px, $warning); }+ &--danger { @include storage-progress(8px, $danger); }+ }+}++.storage-breakdown {+ display: flex;+ flex-direction: column;+ gap: $space-3;+ margin: 0;+ padding: 0;+ list-style: none;++ &__row {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ gap: $space-1 $space-3;+ align-items: baseline;+ }++ &__label {+ min-width: 0;+ color: $text-primary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ }++ &__size {+ color: $text-primary;+ font-size: $font-size-sm;+ font-variant-numeric: tabular-nums;+ text-align: end;+ }++ &__reclaim {+ grid-column: 1 / -1;+ color: $text-tertiary;+ font-size: $font-size-xs;++ &:empty { display: none; }+ }++ &__bar {+ grid-column: 1 / -1;+ @include storage-progress(4px, $accent-primary);+ }+}