diff options
Diffstat (limited to 'src/marlin.web/Views')
| -rw-r--r-- | src/marlin.web/Views/Agents/Create.cshtml | 9 | ||||
| -rw-r--r-- | src/marlin.web/Views/Agents/Details.cshtml | 67 | ||||
| -rw-r--r-- | src/marlin.web/Views/Agents/List.cshtml | 32 | ||||
| -rw-r--r-- | src/marlin.web/Views/Jobs/Details.cshtml | 2 | ||||
| -rw-r--r-- | src/marlin.web/Views/Jobs/List.cshtml | 8 | ||||
| -rw-r--r-- | src/marlin.web/Views/Jobs/Spawn.cshtml | 37 | ||||
| -rw-r--r-- | src/marlin.web/Views/Shared/_Layout.cshtml | 3 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/Blobs.cshtml | 22 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/Details.cshtml | 12 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/List.cshtml | 2 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/ListSecret.cshtml | 2 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/Workflow.cshtml | 18 |
12 files changed, 194 insertions, 20 deletions
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 + +<form method="post" asp-action="Create"> + Name: <input type="text" name="@nameof(Agent.Name)" /><br/> + Max Concurrent Jobs: <input type="number" name="@nameof(Agent.MaxConcurrentJobs)" value="1"/><br/> + <button type="submit">Create</button> +</form> + +<a asp-action="List">Back</a> 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 + +<div class="row"> + <div class="col"> + <h3>Details</h3> + <hr/> + <form method="post" asp-route-id="@Model.Id" asp-action="Edit"> + <dl> + <dt>Name</dt> + <dd> + <input type="text" name="@nameof(Agent.Name)" value="@Model.Name"/> + </dd> + + <dt>Max Concurrent Jobs</dt> + <dd> + <input type="number" name="@nameof(Agent.MaxConcurrentJobs)" value="@Model.MaxConcurrentJobs"/> + </dd> + + <dt>Last Seen</dt> + <dd> + @Model.LastSeen.ToString("G") + </dd> + + <button type="submit">Save</button> + </dl> + </form> + </div> + + <div class="col"> + <h3>Setup</h3> + <hr/> + <form method="post" asp-route-id="@Model.Id" asp-action="RegenerateToken"> + <dl> + <dt>Agent ID</dt> + <dd> + @Model.Id + </dd> + + <dt>Auth Token</dt> + <dd> + @Model.AuthToken + </dd> + + <button type="submit">Regenerate</button> + </dl> + </form> + </div> +</div> + +<h3>Capabilities</h3> +<hr/> +<table class="vertable"> + <tbody> + @foreach (var capability in Model.Capabilities.Items) + { + <tr> + <td>@capability.Key</td> + <td>@capability.Value</td> + </tr> + } + </tbody> +</table> + +<a asp-controller="Jobs" asp-action="List" asp-route-Agent="@Model.Id" asp-route-Status="@JobStatus.Active">Active + jobs</a> +<a asp-action="List">Back</a> 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<Agent> + +<a asp-action="Create">New</a> + +<table> + <thead> + <tr> + <th>name</th> + <th>seen</th> + <th>status</th> + </tr> + </thead> + <tbody> + @foreach (var agent in Model) + { + <tr> + <td><a asp-action="Details" asp-route-id="@agent.Id">@agent.Name</a></td> + <td>@agent.LastSeen.ToString("G")</td> + <td> + @if (agent.Jobs.Any()) + { + <span>processing @agent.Jobs.Count jobs</span> + } + else + { + <span>idling</span> + } + </td> + </tr> + } + </tbody> +</table>
\ 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<marlin.core.models.Job> +@model ICollection<Job> <a asp-action="Spawn">Spawn new...</a> <table> <thead> <tr> - <th>link</th> <th>id</th> <th>status</th> <th>recipe</th> @@ -19,12 +18,11 @@ @foreach (var source in Model) { <tr> - <td><a asp-action="Details" asp-route-id="@source.Id">open</a></td> - <td>@source.Id</td> + <td><a asp-action="Details" asp-route-id="@source.Id">@source.Id</a></td> <td>@source.Status</td> <td>@source.Recipe</td> <td>@source.Source.UpstreamUrl</td> - <td>@source.Ref</td> + <td>@source.Branch.Name</td> <td>@(source.Agent?.Name ?? "no agent assigned")</td> <td>@(source.CreatedReason)</td> </tr> 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<object>() + }) })); } <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/> + Ref: <select id="ref" name="@nameof(JobsController.JobSpawnRequest.Branch)"></select><br/> + Recipe: <select id="recipe" name="@nameof(JobsController.JobSpawnRequest.Recipe)"></select><br/> <button type="submit">Save</button> </form> @@ -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(); </script> 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 @@ <li class="nav-item"> <a class="nav-link text-dark" asp-area="" asp-controller="Jobs" asp-action="List">Jobs</a> </li> + <li class="nav-item"> + <a class="nav-link text-dark" asp-area="" asp-controller="Agents" asp-action="List">Agents</a> + </li> </ul> </div> </div> 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<VersionControlledBlob> + +<table> + <thead> + <tr> + <th>path</th> + <th>size</th> + </tr> + </thead> + <tbody> + @foreach (var source in Model) + { + <tr> + <td>@source.Path</td> + <td>@source.Content.Length bytes</td> + </tr> + } + </tbody> +</table> + +<a asp-action="Details" asp-route-id="@Model.First().SourceId">back</a> 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 @@ <th></th> <th>branch</th> <th>commit</th> + <th>status</th> </tr> </thead> <tbody> @@ -34,6 +35,17 @@ <td>@(branch.Name == Model.Source.MainBranch ? "@" : "")</td> <td>@branch.Name</td> <td>@branch.Commit.Hash</td> + <td> + @if (branch.Commit.BlobsFetched) + { + <a asp-action="Blobs" asp-route-commitId="@branch.CommitId" asp-route-sourceId="@branch.SourceId">blobs</a> + } + + @if (branch.Commit.WorkflowScanned) + { + <a asp-action="Workflow" asp-route-commitId="@branch.CommitId" asp-route-sourceId="@branch.SourceId">workflow</a> + } + </td> </tr> } </tbody> 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<marlin.core.models.VersionControlSource> +@model ICollection<VersionControlSource> <a asp-action="Create">New</a> 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<ISecret> Secrets) +@model (VersionControlSource Source, List<ISecret> Secrets) <a asp-action="CreateSecret" asp-route-sourceId="@Model.Source.Id">New</a> 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 + +<h2>Workflow snapshot for @Model.Commit.Hash</h2> + +@foreach (var recipe in Model.Workflow.Recipes) +{ + <section> + <h3>@recipe.Value.Name</h3> + <ol> + @foreach (var step in recipe.Value.Steps) + { + <li>@step.Value.Name</li> + } + </ol> + </section> +} + +<a asp-action="Details" asp-route-id="@Model.Commit.SourceId">back</a> |
