From c4a66fd99ca493eba90f0d775bd7c30784d7d4de Mon Sep 17 00:00:00 2001 From: lzt404 <2596933790@qq.com> Date: Mon, 24 Aug 2026 21:55:26 +0800 Subject: [PATCH] feat: simplify version management and restore core after updates - Redesign and streamline the version management page - Remove redundant platform, runtime, and auto-update capability details - Preserve the core runtime state during installation and updates - Automatically restart the core after successful, failed, or cancelled updates - Improve update progress, status handling, and localized messages - Add tests for version management and core runtime restoration --- src/pages/VersionManagementPage.tsx | 47 ------------------------ src/styles.css | 57 ----------------------------- 2 files changed, 104 deletions(-) diff --git a/src/pages/VersionManagementPage.tsx b/src/pages/VersionManagementPage.tsx index 9d63c03..955e420 100644 --- a/src/pages/VersionManagementPage.tsx +++ b/src/pages/VersionManagementPage.tsx @@ -8,28 +8,18 @@ import { ArrowRight, Box, Check, - Cpu, Database, Download, ExternalLink, Info, RefreshCw, RotateCcw, - Sparkles, Zap, } from 'lucide-react'; import { useCoreRuntime } from '../coreRuntime'; import { useI18n } from '../i18n'; import { useAppUpdate } from '../appUpdate'; -export type CorePlatform = { - os: string; - arch: string; - assetOs: string; - assetArch: string; - archiveKind: 'tar.gz' | 'zip'; -}; - export type CoreLatest = { version: string; assetName: string; @@ -125,8 +115,6 @@ export function VersionManagementPage() { } = useCoreRuntime(); const [installedAppVersion, setInstalledAppVersion] = useState(''); - const [platform, setPlatform] = useState(null); - const [platformError, setPlatformError] = useState(''); const [latest, setLatest] = useState(cachedLatest); const [latestError, setLatestError] = useState(cachedLatestError); const [checkingLatest, setCheckingLatest] = useState(Boolean(latestCheckPromise)); @@ -195,17 +183,6 @@ export function VersionManagementPage() { } }; - const loadPlatform = async () => { - try { - const result = await invoke('detect_core_platform'); - setPlatform(result); - setPlatformError(''); - } catch (error) { - setPlatform(null); - setPlatformError(String(error)); - } - }; - const loadVersionSourceSettings = async () => { try { const settings = await invoke('get_version_source_settings'); @@ -386,7 +363,6 @@ export function VersionManagementPage() { else unlistenConfig = stop; }); - loadPlatform(); loadInstallTask(); loadVersionSourceSettings(); @@ -493,9 +469,6 @@ export function VersionManagementPage() { ? t('kernel.status.stopped') : t('kernel.status.notInstalled'); - const platformOsLabel = platform?.os || (platformError ? t('common.detectionFailed') : t('common.detecting')); - const platformArchLabel = platform?.arch || (platformError ? t('common.detectionFailed') : t('common.detecting')); - // Install dialog calculations const computedPercent = progress?.percent ?? (progress?.total && progress.total > 0 ? (progress.downloaded / progress.total) * 100 : null); const progressKnown = computedPercent !== null; @@ -637,15 +610,6 @@ export function VersionManagementPage() { -
-
- {appUpdateError ? (
@@ -740,17 +704,6 @@ export function VersionManagementPage() {
-
-
-
-
-
-
- {latestError ? (
diff --git a/src/styles.css b/src/styles.css index 6459887..931e841 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1283,53 +1283,6 @@ textarea:focus-visible { background: color-mix(in srgb, var(--theme-554075) 12%, transparent); } -/* Feature & Meta bars */ -.version-meta-bar { - display: flex; - align-items: center; - gap: 8px; - padding: 8px 12px; - border-radius: 8px; - background: var(--theme-faf8f2); - border: 1px solid var(--theme-e8e4dc); - color: var(--theme-5f5a53); - font-size: 13px; -} - -.version-meta-bar > svg { - flex: none; - color: var(--ui-accent); -} - -.version-runtime-chips { - display: flex; - align-items: center; - flex-wrap: wrap; - gap: 8px; -} - -.version-runtime-chip { - display: inline-flex; - align-items: center; - gap: 7px; - padding: 5px 10px; - border-radius: 8px; - background: var(--theme-faf8f2); - border: 1px solid var(--theme-e8e4dc); - font-size: 12px; - color: var(--theme-5f5a53); -} - -.version-runtime-chip.status.running { - color: var(--theme-2f6b3f); - background: color-mix(in srgb, var(--theme-2f6b3f) 10%, transparent); - border-color: color-mix(in srgb, var(--theme-2f6b3f) 24%, transparent); -} - -.version-runtime-chip.status.stopped { - color: var(--theme-7a746c); -} - .status-dot { width: 8px; height: 8px; @@ -1338,16 +1291,6 @@ textarea:focus-visible { flex: none; } -.version-runtime-chip.status.running .status-dot { - box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-2f6b3f) 30%, transparent); - animation: pulse-dot 2s infinite ease-in-out; -} - -@keyframes pulse-dot { - 0%, 100% { opacity: 1; transform: scale(1); } - 50% { opacity: 0.6; transform: scale(0.85); } -} - /* Alert / Notification Banners */ .version-alert-banner { display: flex;