feat(FN-3431): align llama.cpp compact layout and merge recovery coverage
- Adjust llama.cpp provider card markup and CSS to keep compact spacing aligned with list view and workflow styling updates - Add regression tests for compact llama.cpp card layout behavior in dashboard component tests - Expand merge error recovery tests in the engine to validate deduped auto-merge retry handling and related project-engine flow changes - Update architecture/task management docs and include changeset metadata for auto-merge recovery dedup work Fusion-Task-Id: FN-3431
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
.llama-cpp-provider-card {
|
||||
.llama-cpp-provider-card--full {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--space-sm);
|
||||
}
|
||||
|
||||
.llama-cpp-provider-card--compact .auth-provider-cli-actions {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.llama-cpp-status {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
@@ -13,7 +17,7 @@
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.llama-cpp-provider-card {
|
||||
.llama-cpp-provider-card--full {
|
||||
gap: var(--space-xs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,44 +55,60 @@ export function LlamaCppProviderCard({ authenticated, onToggled, compact = false
|
||||
const enabled = status?.enabled ?? authenticated;
|
||||
const serverAvailable = status?.server.available ?? false;
|
||||
|
||||
const content = (
|
||||
<>
|
||||
<div className="auth-provider-info">
|
||||
<ProviderIcon provider="llama-cpp" size={compact ? "sm" : "md"} />
|
||||
<strong>llama.cpp — via HTTP server</strong>
|
||||
</div>
|
||||
<small className={`llama-cpp-status${status?.ready ? " llama-cpp-status--ok" : ""}`}>
|
||||
{!status
|
||||
? "Probing llama.cpp server…"
|
||||
: status.server.available
|
||||
? `Server reachable at ${status.server.url}`
|
||||
: `Server unavailable: ${status.server.reason ?? "not reachable"}`}
|
||||
</small>
|
||||
<div className="auth-provider-cli-actions">
|
||||
<button type="button" className="btn btn-sm" onClick={() => void handleTest()} disabled={busy !== null}>
|
||||
{busy === "testing" ? <><Loader2 size={12} className="animate-spin" />Testing…</> : "Test"}
|
||||
const statusText = !status
|
||||
? "Probing llama.cpp server…"
|
||||
: status.server.available
|
||||
? `Server reachable at ${status.server.url}`
|
||||
: `Server unavailable: ${status.server.reason ?? "not reachable"}`;
|
||||
|
||||
const actions = (
|
||||
<div className="auth-provider-cli-actions">
|
||||
<button type="button" className="btn btn-sm" onClick={() => void handleTest()} disabled={busy !== null}>
|
||||
{busy === "testing" ? <><Loader2 size={12} className="animate-spin" />Testing…</> : "Test"}
|
||||
</button>
|
||||
{enabled ? (
|
||||
<button type="button" className="btn btn-sm" onClick={() => void handleToggle(false)} disabled={busy !== null}>
|
||||
{busy === "disabling" ? "Disabling…" : "Disable"}
|
||||
</button>
|
||||
{enabled ? (
|
||||
<button type="button" className="btn btn-sm" onClick={() => void handleToggle(false)} disabled={busy !== null}>
|
||||
{busy === "disabling" ? "Disabling…" : "Disable"}
|
||||
</button>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => void handleToggle(true)}
|
||||
disabled={busy !== null || !serverAvailable}
|
||||
>
|
||||
{busy === "enabling" ? "Enabling…" : "Enable"}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-sm"
|
||||
onClick={() => void handleToggle(true)}
|
||||
disabled={busy !== null || !serverAvailable}
|
||||
>
|
||||
{busy === "enabling" ? "Enabling…" : "Enable"}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
if (compact) {
|
||||
return <div className="auth-provider-card auth-provider-card--cli llama-cpp-provider-card" data-testid="llama-cpp-provider-card">{content}</div>;
|
||||
return (
|
||||
<div
|
||||
className={`auth-provider-card auth-provider-card--cli llama-cpp-provider-card llama-cpp-provider-card--compact${enabled ? " auth-provider-card--authenticated" : ""}`}
|
||||
data-testid="llama-cpp-provider-card"
|
||||
>
|
||||
<div className="auth-provider-header">
|
||||
<div className="auth-provider-info">
|
||||
<ProviderIcon provider="llama-cpp" size="sm" />
|
||||
<strong>llama.cpp — via HTTP server</strong>
|
||||
</div>
|
||||
{actions}
|
||||
</div>
|
||||
<small className={`auth-hint llama-cpp-status${status?.ready ? " llama-cpp-status--ok" : ""}`}>{statusText}</small>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <div className="onboarding-provider-card llama-cpp-provider-card" data-testid="llama-cpp-provider-card">{content}</div>;
|
||||
return (
|
||||
<div className="onboarding-provider-card llama-cpp-provider-card llama-cpp-provider-card--full" data-testid="llama-cpp-provider-card">
|
||||
<div className="auth-provider-info">
|
||||
<ProviderIcon provider="llama-cpp" size="md" />
|
||||
<strong>llama.cpp — via HTTP server</strong>
|
||||
</div>
|
||||
<small className={`llama-cpp-status${status?.ready ? " llama-cpp-status--ok" : ""}`}>{statusText}</small>
|
||||
{actions}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,16 @@ describe("LlamaCppProviderCard", () => {
|
||||
fireEvent.click(screen.getByRole("button", { name: "Enable" }));
|
||||
await waitFor(() => expect(setLlamaCppEnabled).toHaveBeenCalledWith(true));
|
||||
});
|
||||
|
||||
it("uses shared auth card layout in compact settings mode", async () => {
|
||||
render(<LlamaCppProviderCard authenticated={false} compact />);
|
||||
|
||||
const card = await screen.findByTestId("llama-cpp-provider-card");
|
||||
expect(card.className).toContain("auth-provider-card");
|
||||
|
||||
expect(card.querySelector(".auth-provider-header")).toBeTruthy();
|
||||
expect(card.querySelector(".auth-provider-info")).toBeTruthy();
|
||||
expect(card.querySelector(".auth-provider-cli-actions")).toBeTruthy();
|
||||
expect(card.querySelector(".auth-hint.llama-cpp-status")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user