From df0737e55afeb5c01eb39909605970d1d3a73ffc Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Sun, 13 Sep 2026 13:22:20 +1000 Subject: refactor: cleanup; feat: connection to agent --- src/marlin.web/Views/Jobs/Spawn.cshtml | 37 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src/marlin.web/Views/Jobs/Spawn.cshtml') diff --git a/src/marlin.web/Views/Jobs/Spawn.cshtml b/src/marlin.web/Views/Jobs/Spawn.cshtml index 8f7ee43..848cae4 100644 --- a/src/marlin.web/Views/Jobs/Spawn.cshtml +++ b/src/marlin.web/Views/Jobs/Spawn.cshtml @@ -9,15 +9,21 @@ id = s.Id, label = s.UpstreamUrl, mainBranch = s.MainBranch, - branches = s.Branches.Select(b => new { name = b.Name, commit = b.Commit.Hash }) + branches = s.Branches.Select(b => new + { + id = b.Id, + name = b.Name, + commit = b.Commit.Hash, + recipes = b.Commit.WorkflowSnapshot?.Workflow.Recipes.Values.Select(r => new { id = r.Id, name = r.Name }) + ?? Enumerable.Empty() + }) })); }
VCS:
- Ref:
- Commit:
- Recipe:
+ Ref:
+ Recipe:
@@ -25,7 +31,7 @@ const sources = @Html.Raw(sourcesJson); const vcsSelect = document.getElementById('vcs'); const refSelect = document.getElementById('ref'); - const commitInput = document.getElementById('commit'); + const recipeSelect = document.getElementById('recipe'); for (const s of sources) { vcsSelect.add(new Option(s.label, s.id)); @@ -35,22 +41,29 @@ return sources.find(s => s.id === vcsSelect.value); } + function currentBranch() { + return currentSource()?.branches.find(b => b.id === refSelect.value); + } + function populateRefs() { refSelect.innerHTML = ''; for (const b of currentSource()?.branches ?? []) { - refSelect.add(new Option(b.name, b.name)); + refSelect.add(new Option(b.name, b.id)); } - refSelect.value = currentSource()?.mainBranch ?? ''; - populateCommit(); + const mainBranch = currentSource()?.branches.find(b => b.name === currentSource()?.mainBranch); + refSelect.value = mainBranch?.id ?? ''; + populateRecipes(); } - function populateCommit() { - const branch = currentSource()?.branches.find(b => b.name === refSelect.value); - commitInput.value = branch?.commit ?? ''; + function populateRecipes() { + recipeSelect.innerHTML = ''; + for (const r of currentBranch()?.recipes ?? []) { + recipeSelect.add(new Option(r.name, r.id)); + } } vcsSelect.addEventListener('change', populateRefs); - refSelect.addEventListener('change', populateCommit); + refSelect.addEventListener('change', populateRecipes); populateRefs(); -- cgit v1.3.1