summaryrefslogtreecommitdiff
path: root/src/marlin.web/Views/Jobs
diff options
context:
space:
mode:
authorMelodi <62381002+Melodi17@users.noreply.github.com>2026-09-06 09:02:31 +1000
committerMelodi <62381002+Melodi17@users.noreply.github.com>2026-09-06 09:02:31 +1000
commita9bc03fb01b5d1ac41bf5592f384d22df5425aa4 (patch)
tree16ae13e19d2a3cd7488202c30790d09557559d70 /src/marlin.web/Views/Jobs
parentc00992ffad24212c4398736efd6d707d4cb0cc0d (diff)
feat: vcs and secret management support
Diffstat (limited to 'src/marlin.web/Views/Jobs')
-rw-r--r--src/marlin.web/Views/Jobs/Details.cshtml5
-rw-r--r--src/marlin.web/Views/Jobs/List.cshtml4
-rw-r--r--src/marlin.web/Views/Jobs/Spawn.cshtml56
3 files changed, 65 insertions, 0 deletions
diff --git a/src/marlin.web/Views/Jobs/Details.cshtml b/src/marlin.web/Views/Jobs/Details.cshtml
new file mode 100644
index 0000000..e1fd184
--- /dev/null
+++ b/src/marlin.web/Views/Jobs/Details.cshtml
@@ -0,0 +1,5 @@
+@model marlin.core.models.Job
+
+@Model.Id
+
+<a asp-action="List">Back</a> \ No newline at end of file
diff --git a/src/marlin.web/Views/Jobs/List.cshtml b/src/marlin.web/Views/Jobs/List.cshtml
index 2c10e46..6ae1d96 100644
--- a/src/marlin.web/Views/Jobs/List.cshtml
+++ b/src/marlin.web/Views/Jobs/List.cshtml
@@ -1,5 +1,7 @@
@model ICollection<marlin.core.models.Job>
+<a asp-action="Spawn">Spawn new...</a>
+
<table>
<thead>
<tr>
@@ -10,6 +12,7 @@
<th>vcs</th>
<th>branch</th>
<th>agent</th>
+ <th>created</th>
</tr>
</thead>
<tbody>
@@ -23,6 +26,7 @@
<td>@source.Source.UpstreamUrl</td>
<td>@source.Ref</td>
<td>@(source.Agent?.Name ?? "no agent assigned")</td>
+ <td>@(source.CreatedReason)</td>
</tr>
}
</tbody>
diff --git a/src/marlin.web/Views/Jobs/Spawn.cshtml b/src/marlin.web/Views/Jobs/Spawn.cshtml
new file mode 100644
index 0000000..8f7ee43
--- /dev/null
+++ b/src/marlin.web/Views/Jobs/Spawn.cshtml
@@ -0,0 +1,56 @@
+@using System.Linq
+@using System.Text.Json
+@using marlin.web.Controllers
+@model marlin.web.Controllers.JobsController.JobSpawnDetails
+
+@{
+ var sourcesJson = JsonSerializer.Serialize(Model.Sources.Select(s => new
+ {
+ id = s.Id,
+ label = s.UpstreamUrl,
+ mainBranch = s.MainBranch,
+ branches = s.Branches.Select(b => new { name = b.Name, commit = b.Commit.Hash })
+ }));
+}
+
+<form method="post" asp-action="Spawn">
+ VCS: <select id="vcs" name="@nameof(JobsController.JobSpawnRequest.Vcs)"></select><br/>
+ Ref: <select id="ref" name="@nameof(JobsController.JobSpawnRequest.Ref)"></select><br/>
+ Commit: <input type="text" id="commit" name="@nameof(JobsController.JobSpawnRequest.Commit)" readonly/><br/>
+ Recipe: <input type="text" name="@nameof(JobsController.JobSpawnRequest.Recipe)" value="@Model.Recipe"/><br/>
+ <button type="submit">Save</button>
+</form>
+
+<script>
+ const sources = @Html.Raw(sourcesJson);
+ const vcsSelect = document.getElementById('vcs');
+ const refSelect = document.getElementById('ref');
+ const commitInput = document.getElementById('commit');
+
+ for (const s of sources) {
+ vcsSelect.add(new Option(s.label, s.id));
+ }
+
+ function currentSource() {
+ return sources.find(s => s.id === vcsSelect.value);
+ }
+
+ function populateRefs() {
+ refSelect.innerHTML = '';
+ for (const b of currentSource()?.branches ?? []) {
+ refSelect.add(new Option(b.name, b.name));
+ }
+ refSelect.value = currentSource()?.mainBranch ?? '';
+ populateCommit();
+ }
+
+ function populateCommit() {
+ const branch = currentSource()?.branches.find(b => b.name === refSelect.value);
+ commitInput.value = branch?.commit ?? '';
+ }
+
+ vcsSelect.addEventListener('change', populateRefs);
+ refSelect.addEventListener('change', populateCommit);
+
+ populateRefs();
+</script>