diff options
Diffstat (limited to 'src/marlin.web/Views/VCS')
| -rw-r--r-- | src/marlin.web/Views/VCS/Create.cshtml | 8 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/CreateSecret.cshtml | 12 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/Details.cshtml | 44 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/List.cshtml | 2 | ||||
| -rw-r--r-- | src/marlin.web/Views/VCS/ListSecret.cshtml | 45 |
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> |
