diff --git a/tenant-platform/src/api/system.ts b/tenant-platform/src/api/system.ts new file mode 100644 index 0000000..011b13f --- /dev/null +++ b/tenant-platform/src/api/system.ts @@ -0,0 +1,43 @@ +const BASE = import.meta.env.VITE_API_BASE_URL ?? '/api' + +export interface DeploymentStatus { + mode: 'PUBLIC' | 'PRIVATE' + tenantRegisterEnabled: boolean + services: Record +} + +export async function getDeploymentStatus(): Promise { + const res = await fetch(`${BASE}/private/deployment/status`) + const json = await res.json() + return json.data as DeploymentStatus +} + +export async function streamSystemUpdate( + onLine: (line: string) => void, + signal?: AbortSignal, +): Promise { + const token = localStorage.getItem('token') ?? '' + const res = await fetch(`${BASE}/system/update`, { + method: 'POST', + headers: { Authorization: `Bearer ${token}` }, + signal, + }) + if (!res.ok) { + const text = await res.text() + throw new Error(text || `HTTP ${res.status}`) + } + const reader = res.body!.getReader() + const decoder = new TextDecoder() + let buf = '' + while (true) { + const { done, value } = await reader.read() + if (done) break + buf += decoder.decode(value, { stream: true }) + const lines = buf.split('\n') + buf = lines.pop() ?? '' + for (const line of lines) { + onLine(line) + } + } + if (buf) onLine(buf) +} diff --git a/tenant-platform/src/views/security/SecurityCenterView.vue b/tenant-platform/src/views/security/SecurityCenterView.vue index bd13d59..90162bd 100644 --- a/tenant-platform/src/views/security/SecurityCenterView.vue +++ b/tenant-platform/src/views/security/SecurityCenterView.vue @@ -38,7 +38,8 @@ 重置当前账号密码 - + +

将当前账号及应用数据迁移至私有化部署环境。迁移密钥仅在生成时显示一次,请及时保存。 @@ -46,6 +47,20 @@ 生成迁移密钥 + + + +

+ 拉取最新镜像并逐一重启各服务容器,全程无需手动操作。tenant-service 重启时页面连接会短暂中断,更新后自动恢复。 +

+ 立即更新 +
+ @@ -64,6 +79,7 @@ + - +

点击发送验证码,系统将向您的注册邮箱发送一次性验证码,验证通过后生成迁移密钥。

@@ -108,7 +124,6 @@ - + @@ -141,21 +157,71 @@ 知道了 + + + +
+

将拉取最新镜像并重启所有运行中的服务容器。

+ + + + +
+ +
+
{{ updateLog.join('\n') }}
+
+ +
+ + 正在等待服务重启... +
+ +
+ +
+
+ +
+ + +