mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-01 20:55:16 +09:00
fix(ui): finish loading placeholders for Monitoring, queue detail and setup
- Monitoring: first-load placeholder follows the loaded overview footprint (monitors card, KPI band, two 2-column rows) so content replaces it in place - QueueDetail: keep the page header while loading, shaped table skeleton, error with Retry on a failed load instead of redirecting or showing empty - SetupStepCapacity: cards skeleton replaces the bare spinner; drop .wizard-loading and the unused queue loading-card CSS - Servers/Backups: publish the top-bar filter/tools chrome during loading so the header keeps its shape
This commit is contained in:
1 parent
8168ec6b1c
commit
a143557eca
7 files changed
+61
-56
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { useState } from 'react';
|
||||
import InfoTip from '@/components/InfoTip';
|
||||
import EmptyState from '../EmptyState';
|
||||
import { useResourceTier } from '../../contexts/useResourceTier.js';
|
||||
import { Check, X, AlertTriangle, Loader, Cpu, MemoryStick, HardDrive } from 'lucide-react';
|
||||
import { Check, X, AlertTriangle, Cpu, MemoryStick, HardDrive } from 'lucide-react';
|
||||
import api from '../../services/api';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Button as SharedButton } from '@/components/ui/button';
|
||||
@@ -33,9 +34,7 @@ const SetupStepCapacity = ({ useCases, onComplete }) => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="wizard-step">
|
||||
<div className="wizard-loading">
|
||||
<Loader size={24} className="spin" />
|
||||
</div>
|
||||
<EmptyState loading loadingVariant="cards" loadingRows={3} title={t('common.state.loading', 'Loading')} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -743,6 +743,7 @@ const Backups = () => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner backups-page">
|
||||
{topbarChrome}
|
||||
<EmptyState loading loadingVariant="table" size="lg" title={t('app.backups.loadingBackupData', 'Loading backup data…')} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,7 +3,8 @@ import { Link } from 'react-router-dom';
|
||||
import useTabParam from '../hooks/useTabParam';
|
||||
import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import { Skeleton } from '../components/Skeleton';
|
||||
import { KpiBand } from '@/components/ds';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import DoctorPanel from '../components/monitoring/DoctorPanel';
|
||||
import MonitoringOverview from '../components/monitoring/MonitoringOverview';
|
||||
@@ -63,6 +64,9 @@ const RULE_ICONS = {
|
||||
load_average: GaugeIcon,
|
||||
};
|
||||
|
||||
// Loaded-card footprints (px) the first-load placeholder reserves.
|
||||
const MON_SKELETON = { monitors: 110, kpi: 118, panel: 270 };
|
||||
|
||||
const SPEEDTEST_POLL_INTERVAL_MS = 3000;
|
||||
const SPEEDTEST_POLL_TIMEOUT_MS = 90000;
|
||||
|
||||
@@ -301,7 +305,25 @@ const Monitoring = () => {
|
||||
if (loading || (activeTab === 'overview' && !monitorsSummary.loaded)) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner monitoring-page">
|
||||
<EmptyState loading loadingVariant="chart" size="lg" title={t('app.monitoring.loadingMonitoringData', 'Loading monitoring data')} />
|
||||
{/* Same footprint as the loaded overview, so content replaces it in place. */}
|
||||
<div
|
||||
className="mon-overview"
|
||||
role="status"
|
||||
aria-busy="true"
|
||||
aria-label={t('app.monitoring.loadingMonitoringData', 'Loading monitoring data')}
|
||||
>
|
||||
<Skeleton variant="block" height={MON_SKELETON.monitors} radius={12} />
|
||||
<Skeleton variant="line" width={90} height={10} />
|
||||
<KpiBand max={4}>
|
||||
{[0, 1, 2, 3].map((i) => <Skeleton key={i} variant="block" height={MON_SKELETON.kpi} radius={12} />)}
|
||||
</KpiBand>
|
||||
{[0, 1].map((row) => (
|
||||
<div className="mon-grid2" key={row}>
|
||||
<Skeleton variant="block" height={MON_SKELETON.panel} radius={12} />
|
||||
<Skeleton variant="block" height={MON_SKELETON.panel} radius={12} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import api from '../services/api';
|
||||
import { useToast } from '../contexts/useToast.js';
|
||||
import { useConfirm } from '../hooks/useConfirm';
|
||||
import EmptyState from '../components/EmptyState';
|
||||
import ErrorState from '../components/ErrorState';
|
||||
import Modal from '@/components/Modal';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tip } from '@/components/ui/tooltip';
|
||||
@@ -112,6 +113,8 @@ const QueueDetail = () => {
|
||||
const { confirm } = useConfirm();
|
||||
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [loadError, setLoadError] = useState(null);
|
||||
const [messagesError, setMessagesError] = useState(null);
|
||||
const [queue, setQueue] = useState(null);
|
||||
const [group, setGroup] = useState(null);
|
||||
const [messages, setMessages] = useState([]);
|
||||
@@ -136,6 +139,7 @@ const QueueDetail = () => {
|
||||
|
||||
const loadMeta = useCallback(async () => {
|
||||
try {
|
||||
setLoadError(null);
|
||||
const [queueRes, groupRes] = await Promise.all([
|
||||
api.getQueue(groupSlug, queueSlug),
|
||||
api.getQueueGroup(groupSlug).catch(() => null),
|
||||
@@ -143,12 +147,12 @@ const QueueDetail = () => {
|
||||
setQueue(queueRes.queue || null);
|
||||
setGroup(groupRes?.group || null);
|
||||
} catch (err) {
|
||||
toastError(toast, t('app.queueDetail.couldntLoadQueue', "Couldn't load the queue."), err);
|
||||
navigate('/queue');
|
||||
// Stay on the page with a Retry rather than bouncing away from a transient failure.
|
||||
setLoadError(err.message || t('app.queueDetail.couldntLoadQueue', "Couldn't load the queue."));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [groupSlug, queueSlug, navigate, t, toast]);
|
||||
}, [groupSlug, queueSlug, t]);
|
||||
|
||||
const loadMessages = useCallback(async (status) => {
|
||||
try {
|
||||
@@ -157,7 +161,9 @@ const QueueDetail = () => {
|
||||
limit: 100,
|
||||
});
|
||||
setMessages(res.messages || []);
|
||||
setMessagesError(null);
|
||||
} catch (err) {
|
||||
setMessagesError(err.message || t('app.queueDetail.couldntLoadMessages', "Couldn't load messages."));
|
||||
toastError(toast, t('app.queueDetail.couldntLoadMessages', "Couldn't load messages."), err);
|
||||
}
|
||||
}, [groupSlug, queueSlug, t, toast]);
|
||||
@@ -329,12 +335,21 @@ const QueueDetail = () => {
|
||||
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="queue-page queue-page--loading">
|
||||
<div className="queue-loading-card">
|
||||
<Inbox size={24} />
|
||||
<span>{t('app.queueDetail.loadingQueue', 'Loading queue…')}</span>
|
||||
</div>
|
||||
</div>
|
||||
<PageLayout className="queue-page" icon={<Inbox size={18} />} title={queueSlug}>
|
||||
<EmptyState loading loadingVariant="table" size="lg" title={t('app.queueDetail.loadingQueue', 'Loading queue…')} />
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
if (loadError && !queue) {
|
||||
return (
|
||||
<PageLayout className="queue-page" icon={<Inbox size={18} />} title={queueSlug}>
|
||||
<ErrorState
|
||||
title={t('app.queueDetail.couldntLoadQueue', "Couldn't load the queue.")}
|
||||
message={loadError}
|
||||
onRetry={() => { setLoading(true); loadMeta(); loadMessages(statusFilter); }}
|
||||
/>
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -432,7 +447,14 @@ const QueueDetail = () => {
|
||||
|
||||
<SortChipBar columns={columns} sorts={sorts} onChange={setSorts} />
|
||||
|
||||
{messages.length === 0 ? (
|
||||
{messages.length === 0 && messagesError ? (
|
||||
<ErrorState
|
||||
compact
|
||||
title={t('app.queueDetail.couldntLoadMessages', "Couldn't load messages.")}
|
||||
message={messagesError}
|
||||
onRetry={() => loadMessages(statusFilter)}
|
||||
/>
|
||||
) : messages.length === 0 ? (
|
||||
<EmptyState
|
||||
icon={Inbox}
|
||||
title={t('app.queueDetail.noMessages', 'No messages')}
|
||||
|
||||
@@ -434,6 +434,7 @@ const Servers = () => {
|
||||
if (loading) {
|
||||
return (
|
||||
<div className="sk-tabgroup__inner servers-page">
|
||||
{topbarChrome}
|
||||
<EmptyState loading loadingVariant="table" title={t('app.servers.scanningFleet', 'Scanning fleet…')} />
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -3,37 +3,6 @@
|
||||
min-height: 100%;
|
||||
}
|
||||
|
||||
.queue-page--loading {
|
||||
min-height: 58vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.queue-loading-card {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: $space-3;
|
||||
padding: $space-5 $space-6;
|
||||
border: 1px solid $border-subtle;
|
||||
border-radius: $radius-overlay;
|
||||
background:
|
||||
linear-gradient(135deg, $accent-glow, transparent 55%),
|
||||
$bg-card;
|
||||
color: $text-secondary;
|
||||
box-shadow: none;
|
||||
|
||||
svg {
|
||||
color: $accent-primary;
|
||||
animation: queue-pulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes queue-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
.queue-ops-workspace {
|
||||
display: grid;
|
||||
grid-template-columns: 260px minmax(0, 1fr);
|
||||
|
||||
@@ -819,14 +819,5 @@
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------
|
||||
// Loading state
|
||||
// --------------------------------------------
|
||||
.wizard-loading {
|
||||
@include flex-center();
|
||||
padding: $space-10;
|
||||
color: $text-secondary;
|
||||
}
|
||||
|
||||
// Semantic layouts and controls; declarations preserved from the legacy compatibility layer.
|
||||
.setup-back-action { margin-bottom: 1rem; }
|
||||
Reference in new issue
Block a user