mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
Merge pull request #203 from jhd3197/feat/ux-backup-storage-notice
feat(backups): calm storage-unavailable notice
This commit is contained in:
5 files changed
+73
-2
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import { HardDrive, ArrowRight } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import InfoTip from '../InfoTip';
|
||||
|
||||
// Persistent, non-dismissable: the backup directory is unusable until fixed.
|
||||
export default function BackupStorageNotice({ onStorage }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div className="backup-storage-notice" role="status">
|
||||
<HardDrive size={16} className="backup-storage-notice__icon" />
|
||||
<div className="backup-storage-notice__text">
|
||||
<strong>{t('app.backups.storageUnavailable', 'Backup storage unavailable')}</strong>
|
||||
<InfoTip>{t('app.backups.storageUnavailableHelp', 'ServerKit can\'t create or read its backup directory, so backups can\'t run or be listed. Check the directory\'s ownership and permissions on the server, or add a remote destination under Storage.')}</InfoTip>
|
||||
<span className="backup-storage-notice__sub">{t('app.backups.storageUnavailableSub', 'Backups can\'t run')}</span>
|
||||
</div>
|
||||
{onStorage && (
|
||||
<Button variant="ghost" size="sm" type="button" onClick={onStorage}>
|
||||
{t('app.backups.storage', 'Storage')} <ArrowRight size={14} />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ const LATEST_COLUMNS = [
|
||||
// The archive table lives on its own Snapshots section — this page answers
|
||||
// "is my data safe?", not "show me every file".
|
||||
export default function BackupsOverview({
|
||||
stats, storageConfig, costSummary, schedules = [], backups = [], onGo,
|
||||
stats, storageConfig, costSummary, schedules = [], backups = [], onGo, storageWarning = false,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const now = new Date();
|
||||
@@ -396,6 +396,9 @@ export default function BackupsOverview({
|
||||
{row.name}
|
||||
{row.primary && <span className="bk-dest__tag">{t('app.backups.primary', 'Primary')}</span>}
|
||||
<small>{row.sub}</small>
|
||||
{storageWarning && row.tone === 'local' && (
|
||||
<Pill kind="amber">{t('app.backups.unavailable', 'Unavailable')}</Pill>
|
||||
)}
|
||||
</span>
|
||||
<span className="bk-dest__size">
|
||||
{formatBytes(row.bytes, { defaultValue: '0 B' })}
|
||||
|
||||
@@ -735,15 +735,20 @@
|
||||
"serverkitIsFreeTheseAreYour": "ServerKit is free. These are your own storage costs. Local is your server disk (leave at 0 if you don't track it). S3/B2 are your cloud provider's $/GB/month.",
|
||||
"settingsSaved": "Settings saved",
|
||||
"siteService": "Site/Service",
|
||||
"storage": "Storage",
|
||||
"storageConfigurationSaved": "Storage settings saved",
|
||||
"storageCostRates": "Storage cost rates",
|
||||
"storageCostRatesSaved": "Storage cost rates saved",
|
||||
"storageCostsShort": "Your own storage costs.",
|
||||
"storageManagedByCloud": "This destination is managed by ServerKit Cloud. Change it under Backups in Cloud, or unassign it there to edit it here.",
|
||||
"storageProvider": "Storage provider",
|
||||
"storageUnavailable": "Backup storage unavailable",
|
||||
"storageUnavailableHelp": "ServerKit can't create or read its backup directory, so backups can't run or be listed. Check the directory's ownership and permissions on the server, or add a remote destination under Storage.",
|
||||
"storageUnavailableSub": "Backups can't run",
|
||||
"testConnection": "Test connection",
|
||||
"testing": "Testing…",
|
||||
"thisWillDeleteBackupsOlderThan": "This will delete backups older than {{retentiondays}} days. Continue?",
|
||||
"unavailable": "Unavailable",
|
||||
"uploadToRemoteStorage": "Upload {{name}} to remote storage",
|
||||
"uploadToRemoteStorageAfterBackup": "Upload to remote storage after backup",
|
||||
"warning": "Warning:",
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
useTableChrome, GridViewPicker, GridChips, GridFilterButton,
|
||||
GridToolsMenu, GridFilterDrawer,
|
||||
} from '@/components/ds/grid';
|
||||
import BackupStorageNotice from '../components/backups/BackupStorageNotice';
|
||||
import BackupsOverview from '../components/backups/BackupsOverview';
|
||||
import SchedulesTable from '../components/backups/SchedulesTable';
|
||||
import AddScheduleModal from '../components/backups/AddScheduleModal';
|
||||
@@ -149,6 +150,7 @@ const Backups = () => {
|
||||
const [apps, setApps] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState(null);
|
||||
const [storageWarning, setStorageWarning] = useState(false);
|
||||
const [rawTab, setActiveTab] = useTabParam('/backups', VALID_TABS);
|
||||
const activeTab = TAB_ALIASES[rawTab] || rawTab;
|
||||
const [search, setSearch] = useState('');
|
||||
@@ -217,7 +219,7 @@ const Backups = () => {
|
||||
]);
|
||||
|
||||
setBackups(backupsRes.backups || []);
|
||||
if (backupsRes.warning) setError(backupsRes.warning);
|
||||
setStorageWarning(Boolean(backupsRes.warning || statsRes?.warning));
|
||||
setStats(statsRes);
|
||||
setConfig(configRes);
|
||||
if (refreshSchedules) await reloadSchedules();
|
||||
@@ -737,6 +739,10 @@ const Backups = () => {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{storageWarning && (
|
||||
<BackupStorageNotice onStorage={activeTab === 'storage' ? undefined : () => setActiveTab('storage')} />
|
||||
)}
|
||||
|
||||
{/* Overview answers "is my data safe?" — the KPI band, the
|
||||
activity heatmap, the destinations and the recent feed. The
|
||||
archive table it used to sit on top of is now its own section. */}
|
||||
@@ -748,6 +754,7 @@ const Backups = () => {
|
||||
schedules={schedules}
|
||||
backups={backups}
|
||||
onGo={setActiveTab}
|
||||
storageWarning={storageWarning}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
@@ -1094,3 +1094,35 @@
|
||||
.bk-storage-fieldset:disabled {
|
||||
opacity: 0.65;
|
||||
}
|
||||
|
||||
// ---------- Storage-unavailable notice ----------
|
||||
// Calm single row: amber tint, not a red alert. Persistent, so no close button.
|
||||
.backup-storage-notice {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: $space-2 $space-3;
|
||||
padding: $space-2 $space-3;
|
||||
border: 1px solid $warning-border;
|
||||
border-radius: $radius-card;
|
||||
background: $warning-bg;
|
||||
|
||||
&__icon {
|
||||
flex-shrink: 0;
|
||||
color: $warning;
|
||||
}
|
||||
|
||||
&__text {
|
||||
display: flex;
|
||||
flex: 1 1 12rem;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 0 $space-2;
|
||||
min-inline-size: 0;
|
||||
font-size: $text-sm;
|
||||
|
||||
strong { font-weight: $font-weight-semibold; }
|
||||
}
|
||||
|
||||
&__sub { color: var(--text-faint); }
|
||||
}
|
||||
Reference in new issue
Block a user