fix: recover failed Gaussian project builds

This commit is contained in:
DCCONSTRUCTIONS
2026-08-26 09:34:23 +03:00
parent cb1e1494af
commit 385082c8ca
10 changed files with 224 additions and 27 deletions
@@ -14,6 +14,7 @@ import { SimulationViewport } from "../../components/simulation/SimulationViewpo
import {
deleteSimulationProject,
fetchSimulationProjects,
retrySimulationProject,
type SimulationProject,
type SimulationProjectStatus,
} from "../../core/simulation/projects";
@@ -28,6 +29,7 @@ export function SimulationWorkspace() {
const [windowOpen, setWindowOpen] = useState(false);
const [editing, setEditing] = useState<SimulationProject | null>(null);
const [deleting, setDeleting] = useState<SimulationProject | null>(null);
const [retryingId, setRetryingId] = useState<string | null>(null);
const load = useCallback(async (signal?: AbortSignal) => {
try {
@@ -84,6 +86,21 @@ export function SimulationWorkspace() {
setDeleting(null);
};
const retry = async (project: SimulationProject) => {
setRetryingId(project.projectId);
setError(null);
try {
const queued = await retrySimulationProject(project.projectId);
setProjects((current) => current.map((item) => (
item.projectId === queued.projectId ? queued : item
)));
} catch (caught) {
setError(caught instanceof Error ? caught.message : "Не удалось повторить сборку.");
} finally {
setRetryingId(null);
}
};
if (selected) {
return (
<div className="simulation-workspace simulation-workspace--scene">
@@ -109,13 +126,28 @@ export function SimulationWorkspace() {
) : (
<GlassSurface className="simulation-workspace__processing" padding="lg">
{selected.status === "failed" ? <Icon name="alert" size={20} /> : <ActivityIndicator label="Сборка мира" />}
<div>
<div className="simulation-workspace__processing-copy">
<strong>{selected.status === "failed" ? "Сборка остановлена" : "Worker 006 собирает мир"}</strong>
<p>{selected.error ?? processingMessage(selected)}</p>
<p>{error ?? selected.error ?? processingMessage(selected)}</p>
</div>
<div className="simulation-workspace__processing-actions">
<StatusBadge tone={selected.status === "failed" ? "warning" : "accent"}>
{selected.provider.state ?? selected.status}
</StatusBadge>
{selected.status === "failed" ? (
<Button
size="compact"
variant="secondary"
disabled={retryingId === selected.projectId}
icon={retryingId === selected.projectId
? <ActivityIndicator size="compact" />
: <Icon name="refresh" size={14} />}
onClick={() => void retry(selected)}
>
Повторить сборку
</Button>
) : null}
</div>
<StatusBadge tone={selected.status === "failed" ? "warning" : "accent"}>
{selected.provider.state ?? selected.status}
</StatusBadge>
</GlassSurface>
)}
</div>