mirror of
https://github.com/Corfirean/coa-server-manager.git
synced 2026-11-22 11:25:56 +00:00
Prepare Manager 0.9.8 with isolated validation and SQUID module controls
This commit is contained in:
1 parent
dc3fcab7e1
commit
23cbb108ad
34 files changed
+791
-52
No files matched your search
@@ -215,6 +215,7 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
</div>
|
||||
<p className="mt-1.5 line-clamp-2 text-sm text-muted">{m.description[locale] ?? m.description.en}</p>
|
||||
{m.compatibility === "unsupported" && <p className="mt-2 text-xs text-warn">{t("realm.unsupported")}</p>}
|
||||
{m.compatibility === "requires-squid" && <p className="mt-2 text-xs text-warn">{t("mod.requiresSquid")}</p>}
|
||||
{m.compatibility === "experimental" && <p className="mt-2 text-xs text-warn">{t("realm.experimental")}</p>}
|
||||
</div>
|
||||
{m.installed && m.switchable && (
|
||||
@@ -230,7 +231,7 @@ export function ModulesPage({ serverId, onChanged, onRegisterGuard }: { serverId
|
||||
<span className={cn("absolute top-0.5 h-5 w-5 rounded-full bg-white transition-all", m.enabled ? "left-[22px]" : "left-0.5")} />
|
||||
</button>
|
||||
)}
|
||||
{m.installed && !m.switchable && m.status !== "soon" && m.compatibility !== "unsupported" && <span className="mt-1.5 shrink-0 text-xs text-muted">{t("mod.alwaysOn")}</span>}
|
||||
{m.installed && !m.switchable && m.status !== "soon" && m.compatibility !== "unsupported" && m.compatibility !== "requires-squid" && <span className="mt-1.5 shrink-0 text-xs text-muted">{t("mod.alwaysOn")}</span>}
|
||||
{!m.installed && m.status !== "soon" && <span className="mt-1.5 shrink-0 text-xs text-muted">{t("mod.notHere")}</span>}
|
||||
</div>
|
||||
{toggling === m.id && <p role="status" className="flex items-center gap-2 text-sm text-gold"><Loader2 className="h-4 w-4 animate-spin" aria-hidden />{t("mod.switching")}</p>}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
import { useState } from "react";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { api, asUiError } from "@/lib/api";
|
||||
import { useT } from "@/i18n";
|
||||
|
||||
export function ServerLoggingSettings({ serverId }: { serverId: string }) {
|
||||
const t = useT();
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [saved, setSaved] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
async function apply(preset: "normal" | "errors" | "off") {
|
||||
setBusy(true); setSaved(false); setError("");
|
||||
try { await api.serverLoggingPreset(serverId, preset); setSaved(true); }
|
||||
catch (error) { setError(asUiError(error).technical); }
|
||||
finally { setBusy(false); }
|
||||
}
|
||||
return <Card className="mt-6 p-6">
|
||||
<h2 className="font-semibold">{t("serverLogs.title")}</h2>
|
||||
<p className="mt-2 text-sm text-muted">{t("serverLogs.description")}</p>
|
||||
<div className="mt-4 flex flex-wrap gap-2">
|
||||
{(["normal", "errors", "off"] as const).map(preset => <button key={preset} disabled={busy} onClick={() => apply(preset)} className="rounded-md border border-line px-3 py-2 text-sm hover:bg-white/5 disabled:opacity-50">{t(`serverLogs.${preset}`)}</button>)}
|
||||
</div>
|
||||
{saved && <p role="status" className="mt-3 text-sm text-ok">{t("serverLogs.saved")}</p>}
|
||||
{error && <p role="alert" className="mt-3 text-sm text-bad">{error}</p>}
|
||||
</Card>;
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import { AutoRestartSettings } from "./AutoRestartSettings";
|
||||
import { DiagnosticsCard } from "./DiagnosticsCard";
|
||||
import { RepairCard } from "./RepairCard";
|
||||
import { RemoveServerCard } from "./RemoveServerCard";
|
||||
import { ServerLoggingSettings } from "./ServerLoggingSettings";
|
||||
|
||||
const sections = [["updates", Download], ["startup", Power], ["client", FolderOpen], ["service", Wrench], ["interface", Languages]] as const;
|
||||
export function SettingsHome({ serverId, path, onForget }: { serverId: string; serverName?: string; path: string; onForget: () => Promise<void> }) {
|
||||
@@ -51,7 +52,7 @@ export function SettingsHome({ serverId, path, onForget }: { serverId: string; s
|
||||
</div>
|
||||
<div hidden={section !== "startup"} className="max-w-3xl"><RealmStartupSettings serverId={serverId} /><AutoRestartSettings serverId={serverId} /></div>
|
||||
<div hidden={section !== "client"} className="max-w-3xl"><ClientCard serverId={serverId} /><GameDataCard serverId={serverId} /></div>
|
||||
<div hidden={section !== "service"} className="max-w-3xl"><DiagnosticsCard serverId={serverId} /><RepairCard serverId={serverId} /><RemoveServerCard serverId={serverId} path={path} onForget={onForget} /></div>
|
||||
<div hidden={section !== "service"} className="max-w-3xl"><ServerLoggingSettings serverId={serverId} /><DiagnosticsCard serverId={serverId} /><RepairCard serverId={serverId} /><RemoveServerCard serverId={serverId} path={path} onForget={onForget} /></div>
|
||||
<div hidden={section !== "interface"} className="max-w-3xl"><Card className="mt-6 p-6"><h2 className="font-semibold">{t("settings.language")}</h2><p className="mt-1 text-sm text-muted">{t("settings.languageHint")}</p><LanguagePicker className="mt-4" /></Card><WindowSettings /><PublicServerSettings /></div>
|
||||
</div>;
|
||||
}
|
||||
Reference in new issue
Block a user