fix 前端优化

This commit is contained in:
npc0-hue
2026-07-21 13:44:23 +08:00
parent 0cb91b5f88
commit b06623d0ce
11 changed files with 386 additions and 149 deletions
+10 -2
View File
@@ -139,6 +139,8 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
const createPending = operations.isPending("platform", "创建服务器");
const canManageServers = session.capabilities.includes("servers.manage");
const selectedCreatePlugin = plugins.find((plugin) => plugin.id === form.pluginId);
const createProfileOptions = selectedCreatePlugin?.runtimeProfiles?.lifecycleProfiles ?? [];
const createProfileUnavailable = Boolean(selectedCreatePlugin && createProfileOptions.length === 0);
const createBindingFields = runtimeBindingFields(selectedCreatePlugin, form.profileKey);
function updateForm(event: ChangeEvent<HTMLInputElement | HTMLSelectElement>) {
@@ -442,13 +444,19 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
<label>
<select name="profileKey" value={form.profileKey} onChange={updateForm} required>
{(selectedCreatePlugin?.runtimeProfiles?.lifecycleProfiles ?? []).map((profile) => (
{createProfileOptions.map((profile) => (
<option key={profile.key} value={profile.key}>
{profile.key} · {profile.mode}
</option>
))}
</select>
</label>
{createProfileUnavailable && (
<div className="operations-inline-warning" role="status">
<AlertTriangle size={14} />
<span> manifest </span>
</div>
)}
{createBindingFields.map((field) => (
<label key={field.key}>
{field.key}{field.required ? "(必填)" : ""}
@@ -465,7 +473,7 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
</div>
<div className="confirm-actions">
<button type="button" disabled={createPending} onClick={() => setShowCreate(false)}></button>
<button type="submit" className="confirm-primary" disabled={createPending || !form.profileKey} title="创建服务器">
<button type="submit" className="confirm-primary" disabled={createPending || !form.profileKey || createProfileUnavailable} title="创建服务器">
<Sparkles size={16} />
<span>{createPending ? "创建中…" : "创建并安装"}</span>
</button>