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/Details.cshtml | 2 +- src/marlin.web/Views/Jobs/List.cshtml | 8 +++---- src/marlin.web/Views/Jobs/Spawn.cshtml | 37 +++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 18 deletions(-) (limited to 'src/marlin.web/Views/Jobs') diff --git a/src/marlin.web/Views/Jobs/Details.cshtml b/src/marlin.web/Views/Jobs/Details.cshtml index e1fd184..ebba94d 100644 --- a/src/marlin.web/Views/Jobs/Details.cshtml +++ b/src/marlin.web/Views/Jobs/Details.cshtml @@ -1,4 +1,4 @@ -@model marlin.core.models.Job +@model Job @Model.Id diff --git a/src/marlin.web/Views/Jobs/List.cshtml b/src/marlin.web/Views/Jobs/List.cshtml index 6ae1d96..968a94f 100644 --- a/src/marlin.web/Views/Jobs/List.cshtml +++ b/src/marlin.web/Views/Jobs/List.cshtml @@ -1,11 +1,10 @@ -@model ICollection +@model ICollection Spawn new... - @@ -19,12 +18,11 @@ @foreach (var source in Model) { - - + - + 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
link id status recipe
open@source.Id@source.Id @source.Status @source.Recipe @source.Source.UpstreamUrl@source.Ref@source.Branch.Name @(source.Agent?.Name ?? "no agent assigned") @(source.CreatedReason)