mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-20 07:13:05 +00:00
fix(git-sources): return 200 for stacks without a Git source (#1294)
The dashboard probes GET /api/stacks/<name>/git-source for every stack to
decide whether to show a Git badge. For a stack with no Git source attached
the endpoint answered 404, so a fleet of unlinked stacks painted a red 404
per stack in the browser console.
Return 200 { linked: false } when the stack exists but has no Git source,
and reserve 404 for the genuine "stack does not exist" case (mirroring the
existence guard the PUT handler already uses). The two consumers that read
this endpoint now treat the { linked: false } sentinel as unlinked rather
than as a configured source.
This commit is contained in:
@@ -265,7 +265,13 @@ export default function StackAnatomyPanel({
|
||||
if (cancelled) return;
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
setGitSource({ repo_url: data.repo_url, branch: data.branch, compose_path: data.compose_path });
|
||||
// An unlinked stack answers 200 { linked: false }; only render the
|
||||
// badge when an actual source is attached.
|
||||
if (data && data.linked === false) {
|
||||
setGitSource(null);
|
||||
} else {
|
||||
setGitSource({ repo_url: data.repo_url, branch: data.branch, compose_path: data.compose_path });
|
||||
}
|
||||
} else {
|
||||
setGitSource(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user