feat: add panel self-upgrade workflow (#492)

This commit is contained in:
sagit
2026-05-06 17:58:01 +08:00
committed by GitHub
parent 6c93d829c6
commit 5ebd4c2a91
11 changed files with 1410 additions and 10 deletions
+21
View File
@@ -42,6 +42,9 @@ import type {
MonitorAccessApiData,
TunnelQualityApiItem,
StorageSummaryApiData,
SystemUpgradeCheckApiData,
SystemUpgradeRunApiData,
SystemUpgradeVersionApiData,
} from "./types";
import axios from "axios";
@@ -258,6 +261,24 @@ export const updateConfig = (name: string, value: string) =>
export const getStorageSummary = () =>
Network.get<StorageSummaryApiData>("/system/storage");
export const getSystemUpgradeVersion = () =>
Network.post<SystemUpgradeVersionApiData>("/system/version");
export const checkSystemUpgrade = (channel: ReleaseChannel = "stable") =>
Network.post<SystemUpgradeCheckApiData>("/system/check-updates", {
channel,
});
export const runSystemUpgrade = (
version?: string,
channel: ReleaseChannel = "stable",
) =>
Network.post<SystemUpgradeRunApiData>(
"/system/upgrade",
{ version: version || "", channel },
{ timeout: 60 * 1000 },
);
export const activateLicense = (licenseKey: string) =>
Network.post("/license/activate", { license_key: licenseKey });
+38
View File
@@ -200,6 +200,14 @@ export interface NodeReleaseApiItem {
channel: "stable" | "dev";
}
export interface SystemUpgradeReleaseApiItem {
version: string;
name: string;
publishedAt: string;
prerelease: boolean;
channel: "stable" | "dev";
}
export interface UserPackageInfoApiData {
userInfo: {
flow: number;
@@ -484,6 +492,36 @@ export interface StorageSummaryApiData {
databaseSizeText: string;
}
export interface SystemUpgradeCapabilityApiData {
capable: boolean;
reasons: string[];
deployDir: string;
backendContainer: string;
}
export interface SystemUpgradeVersionApiData {
currentVersion: string;
latestVersion: string;
hasUpdate: boolean;
channel: "stable" | "dev";
reason?: string;
capability: SystemUpgradeCapabilityApiData;
}
export interface SystemUpgradeCheckApiData
extends SystemUpgradeVersionApiData {
releases: SystemUpgradeReleaseApiItem[];
}
export interface SystemUpgradeRunApiData {
version: string;
channel: "stable" | "dev";
composeAsset: string;
helperContainer: string;
backendImageId: string;
message: string;
}
export interface MonitorNodeApiItem {
id: number;
inx: number;