From 2bc0ef122d43797b5a387abd429e0f899ccd10bb Mon Sep 17 00:00:00 2001 From: maziggy Date: Tue, 27 Jan 2026 17:15:26 +0100 Subject: [PATCH] Minor layout fixes --- .../src/components/GitHubBackupSettings.tsx | 68 ++++--- .../{index-B9U7ouPO.js => index-BkOQ27rS.js} | 182 +++++++++--------- static/index.html | 2 +- 3 files changed, 137 insertions(+), 115 deletions(-) rename static/assets/{index-B9U7ouPO.js => index-BkOQ27rS.js} (55%) diff --git a/frontend/src/components/GitHubBackupSettings.tsx b/frontend/src/components/GitHubBackupSettings.tsx index 9b70207fb..89053b88e 100644 --- a/frontend/src/components/GitHubBackupSettings.tsx +++ b/frontend/src/components/GitHubBackupSettings.tsx @@ -7,8 +7,6 @@ import { CheckCircle, XCircle, Loader2, - Eye, - EyeOff, ExternalLink, RefreshCw, Download, @@ -28,6 +26,8 @@ import type { GitHubBackupTriggerResponse, ScheduleType, CloudAuthStatus, + Printer, + PrinterStatus, } from '../api/client'; import { Card, CardContent, CardHeader } from './Card'; import { Button } from './Button'; @@ -102,7 +102,6 @@ export function GitHubBackupSettings() { const [repoUrl, setRepoUrl] = useState(''); const [accessToken, setAccessToken] = useState(''); const [branch, setBranch] = useState('main'); - const [showToken, setShowToken] = useState(false); const [scheduleEnabled, setScheduleEnabled] = useState(false); const [scheduleType, setScheduleType] = useState('daily'); const [backupKProfiles, setBackupKProfiles] = useState(true); @@ -144,6 +143,23 @@ export function GitHubBackupSettings() { queryFn: api.getCloudStatus, }); + // Fetch printers and their statuses for K-profile availability + const { data: printers } = useQuery({ + queryKey: ['printers'], + queryFn: api.getPrinters, + }); + + // Get printer statuses from cache (populated by WebSocket on other pages) + const printerStatuses = printers?.map(p => { + const status = queryClient.getQueryData(['printerStatus', p.id]); + return { printer: p, connected: status?.connected ?? false }; + }) ?? []; + + const totalPrinters = printerStatuses.length; + const connectedPrinters = printerStatuses.filter(p => p.connected).length; + const noPrintersConnected = totalPrinters > 0 && connectedPrinters === 0; + const somePrintersDisconnected = connectedPrinters > 0 && connectedPrinters < totalPrinters; + // Initialize form from config useEffect(() => { if (config) { @@ -276,7 +292,7 @@ export function GitHubBackupSettings() { }); const clearLogsMutation = useMutation<{ deleted: number; message: string }, Error>({ - mutationFn: () => api.clearGitHubBackupLogs(10), + mutationFn: () => api.clearGitHubBackupLogs(0), onSuccess: (result) => { queryClient.invalidateQueries({ queryKey: ['github-backup-logs'] }); showToast(`Cleared ${result.deleted} logs`); @@ -403,22 +419,13 @@ export function GitHubBackupSettings() { -
- { setAccessToken(e.target.value); setTestResult(null); }} - placeholder={config?.has_token ? 'Enter new token to update' : 'ghp_xxxxxxxxxxxx'} - className="w-full px-3 py-2 pr-10 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none" - /> - -
+ { setAccessToken(e.target.value); setTestResult(null); }} + placeholder={config?.has_token ? 'Enter new token to update' : 'ghp_xxxxxxxxxxxx'} + className="w-full px-3 py-2 bg-bambu-dark border border-bambu-dark-tertiary rounded-lg text-white focus:border-bambu-green focus:outline-none" + />

Fine-grained token with Contents read/write permission

@@ -462,15 +469,30 @@ export function GitHubBackupSettings() {
-