Remove pre-1.0 bridge governance scaffolding
This commit is contained in:
@@ -3,7 +3,6 @@ import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { platformApiClient } from "../api/client";
|
||||
import type { PluginLifecycleInstallationResponse, PluginLifecycleOperation, ServerInstanceResponse } from "../api/types";
|
||||
import { ConfirmDialog } from "./OperationControls";
|
||||
import { ErrorState, LoadingState, ResultBadge } from "./StateViews";
|
||||
|
||||
interface PluginLifecycleWorkbenchProps {
|
||||
@@ -22,7 +21,6 @@ export function PluginLifecycleWorkbench({ pluginId, pluginName, operations = li
|
||||
const [targetVersion, setTargetVersion] = useState("");
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState("");
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [result, setResult] = useState<{ status: "succeeded" | "failed" | "pending"; label: string } | null>(null);
|
||||
|
||||
@@ -60,16 +58,13 @@ export function PluginLifecycleWorkbench({ pluginId, pluginName, operations = li
|
||||
serverInstanceId: selectedServerId,
|
||||
operation,
|
||||
targetVersion: targetVersion.trim() || undefined,
|
||||
idempotencyKey: `web:plugin.lifecycle:${pluginId}:${selectedServerId}:${operation}:${Date.now()}`,
|
||||
confirmed: disruptiveOperations.includes(operation)
|
||||
idempotencyKey: `web:plugin.lifecycle:${pluginId}:${selectedServerId}:${operation}:${Date.now()}`
|
||||
});
|
||||
const evidence = [response.job?.id && `任务 ${response.job.id}`].filter(Boolean).join(" · ");
|
||||
setResult({ status: response.status === "queued" || response.status === "accepted" ? "succeeded" : response.status === "deferred" ? "pending" : "failed", label: `${lifecycleOperationLabel(operation)}:${response.status}${evidence ? ` · ${evidence}` : ""}` });
|
||||
setConfirming(false);
|
||||
await refresh();
|
||||
} catch (caught) {
|
||||
setResult({ status: "failed", label: caught instanceof Error ? caught.message : "插件生命周期操作失败" });
|
||||
setConfirming(false);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
@@ -95,7 +90,7 @@ export function PluginLifecycleWorkbench({ pluginId, pluginName, operations = li
|
||||
{operations.map((item) => <option key={item} value={item}>{lifecycleOperationLabel(item)}</option>)}
|
||||
</select>
|
||||
{(operation === "install" || operation === "upgrade") && <input aria-label="目标版本" placeholder="目标版本" value={targetVersion} disabled={busy} onChange={(event) => setTargetVersion(event.target.value)} />}
|
||||
<button type="button" className="primary-command" disabled={disabled || busy || !selectedServerId} onClick={() => setConfirming(true)}>{busy ? "提交中…" : "执行"}</button>
|
||||
<button type="button" className="primary-command" disabled={disabled || busy || !selectedServerId} onClick={() => void submit()}>{busy ? "提交中…" : "执行"}</button>
|
||||
</div>
|
||||
{installation ? (
|
||||
<div className="console-record plugin-lifecycle-state">
|
||||
@@ -109,14 +104,11 @@ export function PluginLifecycleWorkbench({ pluginId, pluginName, operations = li
|
||||
) : <p className="console-empty-note">该服务器尚无插件生命周期记录。</p>}
|
||||
</>
|
||||
)}
|
||||
<ConfirmDialog open={confirming} title={`确认${lifecycleOperationLabel(operation)}`} description={`插件 ${pluginName},服务器 ${selectedServerId || "--"}${targetVersion ? `,目标版本 ${targetVersion}` : ""}。`} confirmLabel={lifecycleOperationLabel(operation)} danger={disruptiveOperations.includes(operation)} busy={busy} onCancel={() => { if (!busy) setConfirming(false); }} onConfirm={() => void submit()} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const lifecycleOperations: PluginLifecycleOperation[] = ["install", "enable", "disable", "upgrade", "rollback", "retire", "dependency-check"];
|
||||
const disruptiveOperations: PluginLifecycleOperation[] = ["disable", "rollback", "retire"];
|
||||
|
||||
function lifecycleOperationLabel(operation: PluginLifecycleOperation) {
|
||||
return ({ install: "安装", enable: "启用", disable: "停用", upgrade: "升级", rollback: "回滚", retire: "退役", "dependency-check": "依赖检查" } as Record<PluginLifecycleOperation, string>)[operation];
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ const plugin: GamePluginResponse = {
|
||||
pages: [],
|
||||
tags: [],
|
||||
aiPurposes: [],
|
||||
productionLifecycle: { operations: ["install"], dependencyPolicy: "optional", approvalRequired: [] },
|
||||
productionLifecycle: { operations: ["install"], dependencyPolicy: "optional" },
|
||||
status: "installed",
|
||||
runtimeProfiles: {
|
||||
transportProfiles: [{ key: "rcon", kind: "rcon", targetKey: "rcon.password", capabilities: ["remote.run.rcon.command"] }],
|
||||
|
||||
Reference in New Issue
Block a user