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/Agents/Create.cshtml | 9 ++++ src/marlin.web/Views/Agents/Details.cshtml | 67 ++++++++++++++++++++++++++++++ src/marlin.web/Views/Agents/List.cshtml | 32 ++++++++++++++ src/marlin.web/Views/Jobs/Details.cshtml | 2 +- src/marlin.web/Views/Jobs/List.cshtml | 8 ++-- src/marlin.web/Views/Jobs/Spawn.cshtml | 37 +++++++++++------ src/marlin.web/Views/Shared/_Layout.cshtml | 3 ++ src/marlin.web/Views/VCS/Blobs.cshtml | 22 ++++++++++ src/marlin.web/Views/VCS/Details.cshtml | 12 ++++++ src/marlin.web/Views/VCS/List.cshtml | 2 +- src/marlin.web/Views/VCS/ListSecret.cshtml | 2 +- src/marlin.web/Views/VCS/Workflow.cshtml | 18 ++++++++ 12 files changed, 194 insertions(+), 20 deletions(-) create mode 100644 src/marlin.web/Views/Agents/Create.cshtml create mode 100644 src/marlin.web/Views/Agents/Details.cshtml create mode 100644 src/marlin.web/Views/Agents/List.cshtml create mode 100644 src/marlin.web/Views/VCS/Blobs.cshtml create mode 100644 src/marlin.web/Views/VCS/Workflow.cshtml (limited to 'src/marlin.web/Views') diff --git a/src/marlin.web/Views/Agents/Create.cshtml b/src/marlin.web/Views/Agents/Create.cshtml new file mode 100644 index 0000000..4f0f31a --- /dev/null +++ b/src/marlin.web/Views/Agents/Create.cshtml @@ -0,0 +1,9 @@ +@using marlin.core.models + +
+ Name:
+ Max Concurrent Jobs:
+ +
+ +Back diff --git a/src/marlin.web/Views/Agents/Details.cshtml b/src/marlin.web/Views/Agents/Details.cshtml new file mode 100644 index 0000000..3512a98 --- /dev/null +++ b/src/marlin.web/Views/Agents/Details.cshtml @@ -0,0 +1,67 @@ +@using marlin.core.models +@model Agent + +
+
+

Details

+
+
+
+
Name
+
+ +
+ +
Max Concurrent Jobs
+
+ +
+ +
Last Seen
+
+ @Model.LastSeen.ToString("G") +
+ + +
+
+
+ +
+

Setup

+
+
+
+
Agent ID
+
+ @Model.Id +
+ +
Auth Token
+
+ @Model.AuthToken +
+ + +
+
+
+
+ +

Capabilities

+
+ + + @foreach (var capability in Model.Capabilities.Items) + { + + + + + } + +
@capability.Key@capability.Value
+ +Active + jobs +Back diff --git a/src/marlin.web/Views/Agents/List.cshtml b/src/marlin.web/Views/Agents/List.cshtml new file mode 100644 index 0000000..cb0e0df --- /dev/null +++ b/src/marlin.web/Views/Agents/List.cshtml @@ -0,0 +1,32 @@ +@model ICollection + +New + + + + + + + + + + + @foreach (var agent in Model) + { + + + + + + } + +
nameseenstatus
@agent.Name@agent.LastSeen.ToString("G") + @if (agent.Jobs.Any()) + { + processing @agent.Jobs.Count jobs + } + else + { + idling + } +
\ No newline at end of file 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(); diff --git a/src/marlin.web/Views/Shared/_Layout.cshtml b/src/marlin.web/Views/Shared/_Layout.cshtml index e8be2af..8ece676 100644 --- a/src/marlin.web/Views/Shared/_Layout.cshtml +++ b/src/marlin.web/Views/Shared/_Layout.cshtml @@ -29,6 +29,9 @@ + diff --git a/src/marlin.web/Views/VCS/Blobs.cshtml b/src/marlin.web/Views/VCS/Blobs.cshtml new file mode 100644 index 0000000..ab35260 --- /dev/null +++ b/src/marlin.web/Views/VCS/Blobs.cshtml @@ -0,0 +1,22 @@ +@using System.Text +@model ICollection + +
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)
+ + + + + + + + @foreach (var source in Model) + { + + + + + } + +
pathsize
@source.Path@source.Content.Length bytes
+ +back diff --git a/src/marlin.web/Views/VCS/Details.cshtml b/src/marlin.web/Views/VCS/Details.cshtml index 45c1a8f..a9ef0ea 100644 --- a/src/marlin.web/Views/VCS/Details.cshtml +++ b/src/marlin.web/Views/VCS/Details.cshtml @@ -25,6 +25,7 @@ branch commit + status @@ -34,6 +35,17 @@ @(branch.Name == Model.Source.MainBranch ? "@" : "") @branch.Name @branch.Commit.Hash + + @if (branch.Commit.BlobsFetched) + { + blobs + } + + @if (branch.Commit.WorkflowScanned) + { + workflow + } + } diff --git a/src/marlin.web/Views/VCS/List.cshtml b/src/marlin.web/Views/VCS/List.cshtml index 4c248e4..f109c92 100644 --- a/src/marlin.web/Views/VCS/List.cshtml +++ b/src/marlin.web/Views/VCS/List.cshtml @@ -1,4 +1,4 @@ -@model ICollection +@model ICollection New diff --git a/src/marlin.web/Views/VCS/ListSecret.cshtml b/src/marlin.web/Views/VCS/ListSecret.cshtml index aa5f15c..25db7fe 100644 --- a/src/marlin.web/Views/VCS/ListSecret.cshtml +++ b/src/marlin.web/Views/VCS/ListSecret.cshtml @@ -1,4 +1,4 @@ -@model (marlin.core.models.VersionControlSource Source, List Secrets) +@model (VersionControlSource Source, List Secrets) New diff --git a/src/marlin.web/Views/VCS/Workflow.cshtml b/src/marlin.web/Views/VCS/Workflow.cshtml new file mode 100644 index 0000000..da32ab1 --- /dev/null +++ b/src/marlin.web/Views/VCS/Workflow.cshtml @@ -0,0 +1,18 @@ +@model WorkflowSnapshot + +

Workflow snapshot for @Model.Commit.Hash

+ +@foreach (var recipe in Model.Workflow.Recipes) +{ +
+

@recipe.Value.Name

+
    + @foreach (var step in recipe.Value.Steps) + { +
  1. @step.Value.Name
  2. + } +
+
+} + +back -- cgit v1.3.1