| 1 | {{ define "page" -}} |
| 2 | <div class="shithub-settings-page"> |
| 3 | {{ template "repo-settings-nav" . }} |
| 4 | <div class="shithub-settings-content"> |
| 5 | <h1>{{ .Heading }}</h1> |
| 6 | {{ with .Notice }}<p class="shithub-flash shithub-flash-notice" role="status">{{ . }}</p>{{ end }} |
| 7 | {{ with .Error }}<p class="shithub-flash shithub-flash-error" role="alert">{{ . }}</p>{{ end }} |
| 8 | |
| 9 | <section class="shithub-settings-section"> |
| 10 | <h2>{{ if .IsSecrets }}Repository secrets{{ else }}Repository variables{{ end }}</h2> |
| 11 | {{ if and .IsSecrets .SecretDisabled }} |
| 12 | <p>Actions secret writes require the at-rest secret key. Set Auth.TOTPKeyB64 in config and restart.</p> |
| 13 | {{ else }} |
| 14 | <form method="POST" action="{{ .FormAction }}" novalidate> |
| 15 | <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 16 | <label> |
| 17 | <span>Name</span> |
| 18 | <input type="text" name="name" maxlength="100" pattern="[A-Za-z_][A-Za-z0-9_]*" autocomplete="off" required> |
| 19 | </label> |
| 20 | <label> |
| 21 | <span>{{ if .IsSecrets }}Secret{{ else }}Value{{ end }}</span> |
| 22 | {{ if .IsSecrets }} |
| 23 | <input type="password" name="value" autocomplete="off" required> |
| 24 | {{ else }} |
| 25 | <textarea name="value" maxlength="4096" rows="3"></textarea> |
| 26 | {{ end }} |
| 27 | </label> |
| 28 | <button type="submit" class="shithub-button shithub-button-primary">Save {{ if .IsSecrets }}secret{{ else }}variable{{ end }}</button> |
| 29 | </form> |
| 30 | {{ end }} |
| 31 | </section> |
| 32 | |
| 33 | <section class="shithub-settings-section"> |
| 34 | <h2>Existing {{ if .IsSecrets }}secrets{{ else }}variables{{ end }}</h2> |
| 35 | {{ if .IsSecrets }} |
| 36 | {{ if .Secrets }} |
| 37 | <table class="shithub-branches-table"> |
| 38 | <thead><tr><th>Name</th><th></th></tr></thead> |
| 39 | <tbody> |
| 40 | {{ range .Secrets }} |
| 41 | <tr> |
| 42 | <td><code>{{ .Name }}</code></td> |
| 43 | <td> |
| 44 | <form method="POST" action="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/secrets/actions/{{ .Name }}/delete" style="display:inline"> |
| 45 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 46 | <button type="submit" class="shithub-button shithub-button-danger">Delete</button> |
| 47 | </form> |
| 48 | </td> |
| 49 | </tr> |
| 50 | {{ end }} |
| 51 | </tbody> |
| 52 | </table> |
| 53 | {{ else }} |
| 54 | <p>No secrets have been added.</p> |
| 55 | {{ end }} |
| 56 | {{ else }} |
| 57 | {{ if .Variables }} |
| 58 | <table class="shithub-branches-table"> |
| 59 | <thead><tr><th>Name</th><th>Value</th><th></th></tr></thead> |
| 60 | <tbody> |
| 61 | {{ range .Variables }} |
| 62 | <tr> |
| 63 | <td><code>{{ .Name }}</code></td> |
| 64 | <td><code>{{ .Value }}</code></td> |
| 65 | <td> |
| 66 | <form method="POST" action="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/variables/actions/{{ .Name }}/delete" style="display:inline"> |
| 67 | <input type="hidden" name="csrf_token" value="{{ $.CSRFToken }}"> |
| 68 | <button type="submit" class="shithub-button shithub-button-danger">Delete</button> |
| 69 | </form> |
| 70 | </td> |
| 71 | </tr> |
| 72 | {{ end }} |
| 73 | </tbody> |
| 74 | </table> |
| 75 | {{ else }} |
| 76 | <p>No variables have been added.</p> |
| 77 | {{ end }} |
| 78 | {{ end }} |
| 79 | </section> |
| 80 | </div> |
| 81 | </div> |
| 82 | {{- end }} |