40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import type { TenantConnectionSummary } from "@/db/repository";
|
|
|
|
export type ConnectionCopy = {
|
|
label: string;
|
|
detail: string;
|
|
nextStep: string;
|
|
tone: "good" | "warn" | "danger" | "neutral" | "info";
|
|
};
|
|
|
|
const connectionCopy: Record<TenantConnectionSummary["state"], ConnectionCopy> = {
|
|
provisioning: {
|
|
label: "正在分配中继",
|
|
detail: "主机已认领;租户正在分配 home region 与共享 Relay 节点。",
|
|
nextStep: "保持 daemon 的服务地址与设备令牌不变,它会在同一地址自动重试。",
|
|
tone: "info",
|
|
},
|
|
ready: {
|
|
label: "中继已就绪",
|
|
detail: "当前 placement generation 已分配到健康的共享 Relay 节点。",
|
|
nextStep: "daemon 继续连接注册时使用的稳定服务地址;节点位置不会暴露给客户端。",
|
|
tone: "good",
|
|
},
|
|
suspended: {
|
|
label: "租户已暂停",
|
|
detail: "运行时或公测资格当前处于暂停状态,设备记录仍被保留。",
|
|
nextStep: "在恢复前不要删除本地主机配置。",
|
|
tone: "warn",
|
|
},
|
|
unavailable: {
|
|
label: "状态待核实",
|
|
detail: "控制面缺少完整 placement 或授权状态,因此不会允许建立连接。",
|
|
nextStep: "稍后重试;持续出现时联系公测维护者。",
|
|
tone: "warn",
|
|
},
|
|
};
|
|
|
|
export function getConnectionCopy(state: TenantConnectionSummary["state"]): ConnectionCopy {
|
|
return connectionCopy[state];
|
|
}
|