summaryrefslogtreecommitdiff
path: root/src/marlin.web/Views/VCS/Details.cshtml
blob: 44fa91ec386cf9c50faf1903c7a1d4d3222ea844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@using marlin.core
@using marlin.core.models
@model VersionControlSource

<div class="row">
    <div class="col">
        <h3>Details</h3>
        <hr/>
        <form method="post" asp-route-id="@Model.Id" asp-action="Edit">
            <dl>
                <dt>URL</dt>
                <dd><input type="text" name="@nameof(VersionControlSource.UpstreamUrl)" value="@Model.UpstreamUrl"/></dd>

                <dt>Filter</dt>
                <dd><input type="text" name="@nameof(VersionControlSource.BranchFilter)" value="@Model.BranchFilter"/></dd>

                <dt>Polling Interval</dt>
                <dd><input type="number" name="@nameof(VersionControlSource.MinPollingInterval)" value="@Model.MinPollingInterval"/></dd>
            </dl>

            <button type="submit">Save</button>
            <a asp-action="ListSecret" asp-route-sourceId="@Model.Id">Secrets</a>
            <a asp-action="List">Back</a>
        </form>
    </div>
</div>
<br/>

<h3>Branches</h3>
<hr/>
<table>
    <thead>
    <tr>
        <th>branch</th>
        <th>commit</th>
        <th>actions</th>
    </tr>
    </thead>
    <tbody>
    @foreach (var branch in Model.Branches.OrderByDescending(b => b.Name == Model.MainBranch))
    {
        <tr class="@(branch.Name == Model.MainBranch ? "highlighted" : "")">
            <td>
                @branch.Name
                @if (branch.Name == Model.MainBranch)
                {
                    <span>(primary)</span>
                }
            </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>
                }
                
                @if (branch.Name != Model.MainBranch)
                {
                    <form method="post" asp-action="SetMainBranch" asp-route-sourceId="@Model.Id" style="display:inline">
                        <input type="hidden" name="branchName" value="@branch.Name"/>
                        <button type="submit" class="btn btn-link p-0">make primary</button>
                    </form>
                }
            </td>
        </tr>
    }
    </tbody>
</table>