summaryrefslogtreecommitdiff
path: root/src/marlin.web/Views/VCS
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/VCS
parentc00992ffad24212c4398736efd6d707d4cb0cc0d (diff)
feat: vcs and secret management support
Diffstat (limited to 'src/marlin.web/Views/VCS')
-rw-r--r--src/marlin.web/Views/VCS/Create.cshtml8
-rw-r--r--src/marlin.web/Views/VCS/CreateSecret.cshtml12
-rw-r--r--src/marlin.web/Views/VCS/Details.cshtml44
-rw-r--r--src/marlin.web/Views/VCS/List.cshtml2
-rw-r--r--src/marlin.web/Views/VCS/ListSecret.cshtml45
5 files changed, 99 insertions, 12 deletions
diff --git a/src/marlin.web/Views/VCS/Create.cshtml b/src/marlin.web/Views/VCS/Create.cshtml
index adaa913..e04592d 100644
--- a/src/marlin.web/Views/VCS/Create.cshtml
+++ b/src/marlin.web/Views/VCS/Create.cshtml
@@ -2,10 +2,10 @@
@using marlin.core.models
<form method="post" asp-action="Create">
- URL: <input type="text" name="@nameof(VersionControlSource.UpstreamUrl)" />
- Filter: <input type="text" name="@nameof(VersionControlSource.BranchFilter)" />
- Main Branch: <input type="text" name="@nameof(VersionControlSource.MainBranch)" />
- Polling Interval: <input type="number" name="@nameof(VersionControlSource.MinPollingInterval)" />
+ URL: <input type="text" name="@nameof(VersionControlSource.UpstreamUrl)" /><br/>
+ Filter: <input type="text" name="@nameof(VersionControlSource.BranchFilter)" /><br/>
+ Main Branch: <input type="text" name="@nameof(VersionControlSource.MainBranch)" /><br/>
+ Polling Interval: <input type="number" name="@nameof(VersionControlSource.MinPollingInterval)" /><br/>
<button type="submit">Create</button>
</form>
diff --git a/src/marlin.web/Views/VCS/CreateSecret.cshtml b/src/marlin.web/Views/VCS/CreateSecret.cshtml
new file mode 100644
index 0000000..6453056
--- /dev/null
+++ b/src/marlin.web/Views/VCS/CreateSecret.cshtml
@@ -0,0 +1,12 @@
+@using marlin.core.models
+@model VersionControlSource
+
+<form method="post" asp-action="CreateSecret" asp-route-sourceId="@Model.Id">
+ Label: <input type="text" name="Label"/><br/>
+ Kind: <input type="text" name="Kind"/><br/>
+ May Reveal: <input type="checkbox" name="MayReveal" value="true"/><br/>
+ Content (JSON): <textarea name="ContentJson">{}</textarea><br/>
+ <button type="submit">Create</button>
+</form>
+
+<a asp-action="ListSecret" asp-route-sourceId="@Model.Id">Back</a>
diff --git a/src/marlin.web/Views/VCS/Details.cshtml b/src/marlin.web/Views/VCS/Details.cshtml
index 8d25472..45c1a8f 100644
--- a/src/marlin.web/Views/VCS/Details.cshtml
+++ b/src/marlin.web/Views/VCS/Details.cshtml
@@ -1,13 +1,43 @@
@using marlin.core
@using marlin.core.models
-@model marlin.core.models.VersionControlSource
+@using marlin.web.Controllers
+@model (VersionControlSource Source, List<VCSController.SecretOption> SecretOptions)
-<form method="post" asp-route-id="@Model.Id" asp-action="Edit">
- URL: <input type="text" name="@nameof(VersionControlSource.UpstreamUrl)" value="@Model.UpstreamUrl"/>
- Filter: <input type="text" name="@nameof(VersionControlSource.BranchFilter)" value="@Model.BranchFilter"/>
- Main Branch: <input type="text" name="@nameof(VersionControlSource.MainBranch)" value="@Model.MainBranch"/>
- Polling Interval: <input type="number" name="@nameof(VersionControlSource.MinPollingInterval)" value="@Model.MinPollingInterval"/>
+<form method="post" asp-route-id="@Model.Source.Id" asp-action="Edit">
+ URL: <input type="text" name="@nameof(VersionControlSource.UpstreamUrl)" value="@Model.Source.UpstreamUrl"/><br/>
+ Filter: <input type="text" name="@nameof(VersionControlSource.BranchFilter)" value="@Model.Source.BranchFilter"/><br/>
+ Main Branch: <input type="text" name="@nameof(VersionControlSource.MainBranch)" value="@Model.Source.MainBranch"/><br/>
+ Polling Interval: <input type="number" name="@nameof(VersionControlSource.MinPollingInterval)" value="@Model.Source.MinPollingInterval"/><br/>
+ Access Secret:
+ <select name="@nameof(VersionControlSource.AccessSecretId)">
+ <option value="">(none)</option>
+ @foreach (var secret in Model.SecretOptions)
+ {
+ <option value="@secret.Id" selected="@(secret.Id == Model.Source.AccessSecretId)">@secret.Label</option>
+ }
+ </select><br/>
<button type="submit">Save</button>
</form>
-<a asp-action="List">Back</a> \ No newline at end of file
+<table>
+ <thead>
+ <tr>
+ <th></th>
+ <th>branch</th>
+ <th>commit</th>
+ </tr>
+ </thead>
+ <tbody>
+ @foreach (var branch in Model.Source.Branches)
+ {
+ <tr>
+ <td>@(branch.Name == Model.Source.MainBranch ? "@" : "")</td>
+ <td>@branch.Name</td>
+ <td>@branch.Commit.Hash</td>
+ </tr>
+ }
+ </tbody>
+</table>
+
+<a asp-action="ListSecret" asp-route-sourceId="@Model.Source.Id">Secrets</a>
+<a asp-action="List">Back</a>
diff --git a/src/marlin.web/Views/VCS/List.cshtml b/src/marlin.web/Views/VCS/List.cshtml
index 90c3f48..4c248e4 100644
--- a/src/marlin.web/Views/VCS/List.cshtml
+++ b/src/marlin.web/Views/VCS/List.cshtml
@@ -1,4 +1,4 @@
-@model IReadOnlyList<marlin.core.models.VersionControlSource>
+@model ICollection<marlin.core.models.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
new file mode 100644
index 0000000..aa5f15c
--- /dev/null
+++ b/src/marlin.web/Views/VCS/ListSecret.cshtml
@@ -0,0 +1,45 @@
+@model (marlin.core.models.VersionControlSource Source, List<ISecret> Secrets)
+
+<a asp-action="CreateSecret" asp-route-sourceId="@Model.Source.Id">New</a>
+
+<table>
+ <thead>
+ <tr>
+ <th>id</th>
+ <th>label</th>
+ <th>kind</th>
+ <th>value</th>
+ <th>actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ @foreach (var secret in Model.Secrets)
+ {
+ <tr>
+ <td>@secret.Id</td>
+ <td>@secret.Label</td>
+ <td>@secret.Kind</td>
+ <td>
+ @if (secret.MayReveal)
+ {
+ @foreach (var pair in secret.Content)
+ {
+ <span>@pair.Key = @pair.Value</span>
+ }
+ }
+ else
+ {
+ <span>secret cannot be revealed</span>
+ }
+ </td>
+ <td>
+ <form asp-action="DeleteSecret" method="post" asp-route-sourceId="@Model.Source.Id" asp-route-id="@secret.Id">
+ <button type="submit">delete</button>
+ </form>
+ </td>
+ </tr>
+ }
+ </tbody>
+</table>
+
+<a asp-action="Details", asp-route-id="@Model.Source.Id">back</a>