mirror of
https://github.com/whyour/qinglong.git
synced 2026-12-01 09:45:36 +08:00
feat: stage online upgrades before verified restarts
Download updates asynchronously with persistent progress and validate matching source and build artifacts before an explicit restart. Keep upgrade workers alive across service restarts, verify the new runtime, and recover the browser with a one-time success notice. Publish immutable archive sizes and checksums for accurate download progress. Align the update dialog, hide unavailable actions during transfers, and show the sidebar notice only for active, ready or failed jobs. Constrain long account names with ellipsis while preserving avatar and collapse controls.
This commit is contained in:
1 parent
a1104ef47c
commit
286088a32c
22 files changed
+2698
-471
No files matched your search
+29
-2
@@ -19,6 +19,8 @@ import './index.less';
|
||||
import { init } from '../utils/init';
|
||||
import WebSocketManager from '../utils/websocket';
|
||||
import { observePageLoadTiming } from '../utils/navigationTiming';
|
||||
import UpgradeNotice from '@/components/UpgradeNotice';
|
||||
import { completionKey, reloadKey, upgradeStore } from '@/hooks/useUpgrade';
|
||||
|
||||
export interface SharedContext {
|
||||
headerStyle: React.CSSProperties;
|
||||
@@ -54,6 +56,9 @@ export default function () {
|
||||
);
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const [initLoading, setInitLoading] = useState<boolean>(true);
|
||||
const observeUpgrade =
|
||||
Boolean(user.username) &&
|
||||
!['/login', '/initialization'].includes(location.pathname);
|
||||
const {
|
||||
enable: enableDarkMode,
|
||||
disable: disableDarkMode,
|
||||
@@ -162,6 +167,18 @@ export default function () {
|
||||
getHealthStatus();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
// A reload during restart may initially land on the health error page.
|
||||
// Keep recovering the accepted job even before the sidebar can mount.
|
||||
if (
|
||||
observeUpgrade ||
|
||||
sessionStorage.getItem(reloadKey) ||
|
||||
sessionStorage.getItem(completionKey)
|
||||
) {
|
||||
return upgradeStore.subscribe(() => {});
|
||||
}
|
||||
}, [observeUpgrade]);
|
||||
|
||||
useEffect(() => {
|
||||
reloadSystemConfig();
|
||||
}, []);
|
||||
@@ -321,6 +338,12 @@ export default function () {
|
||||
</>
|
||||
}
|
||||
title={false}
|
||||
menuFooterRender={(props) => (
|
||||
<UpgradeNotice
|
||||
collapsed={Boolean(props?.collapsed)}
|
||||
systemInfo={systemInfo}
|
||||
/>
|
||||
)}
|
||||
menuItemRender={(menuItemProps: any, defaultDom: any) => {
|
||||
if (
|
||||
menuItemProps.isUrl ||
|
||||
@@ -351,7 +374,9 @@ export default function () {
|
||||
user.avatar ? `${config.apiPrefix}static/${user.avatar}` : ''
|
||||
}
|
||||
/>
|
||||
<span style={{ marginLeft: 5 }}>{user.username}</span>
|
||||
<span className="side-menu-username" title={user.username}>
|
||||
{user.username}
|
||||
</span>
|
||||
</span>
|
||||
</Dropdown>
|
||||
)
|
||||
@@ -377,7 +402,9 @@ export default function () {
|
||||
: ''
|
||||
}
|
||||
/>
|
||||
<span style={{ marginLeft: 5 }}>{user.username}</span>
|
||||
<span className="side-menu-username" title={user.username}>
|
||||
{user.username}
|
||||
</span>
|
||||
</span>
|
||||
</Dropdown>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user