@@ -0,0 +1,100 @@ |
| 1 | +{{ define "page" -}} |
| 2 | +<div class="shithub-settings-page"> |
| 3 | + {{ template "repo-settings-nav" . }} |
| 4 | + <div class="shithub-settings-content"> |
| 5 | + <h1>Edit webhook</h1> |
| 6 | + <p><a href="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks">← All webhooks</a></p> |
| 7 | + |
| 8 | + <section class="shithub-settings-section"> |
| 9 | + <h2>Configuration</h2> |
| 10 | + <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks/{{ .Webhook.ID }}"> |
| 11 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 12 | + <label> |
| 13 | + <span>Payload URL</span> |
| 14 | + <input type="text" name="url" required maxlength="2048" value="{{ .Webhook.Url }}"> |
| 15 | + </label> |
| 16 | + <label> |
| 17 | + <span>Content type</span> |
| 18 | + <select name="content_type"> |
| 19 | + <option value="json" {{ if eq (printf "%s" .Webhook.ContentType) "json" }}selected{{ end }}>application/json</option> |
| 20 | + <option value="form" {{ if eq (printf "%s" .Webhook.ContentType) "form" }}selected{{ end }}>application/x-www-form-urlencoded</option> |
| 21 | + </select> |
| 22 | + </label> |
| 23 | + <label> |
| 24 | + <span>New secret (leave blank to keep current)</span> |
| 25 | + <input type="text" name="new_secret" maxlength="200"> |
| 26 | + </label> |
| 27 | + <label> |
| 28 | + <span>Events (comma-separated; blank = all)</span> |
| 29 | + <input type="text" name="events" value="{{ .EventsCSV }}"> |
| 30 | + </label> |
| 31 | + <fieldset class="shithub-settings-fieldset"> |
| 32 | + <legend>Options</legend> |
| 33 | + <label class="shithub-settings-checkbox"> |
| 34 | + <input type="checkbox" name="active" {{ if .Webhook.Active }}checked{{ end }}> |
| 35 | + <span>Active</span> |
| 36 | + </label> |
| 37 | + <label class="shithub-settings-checkbox"> |
| 38 | + <input type="checkbox" name="ssl_verification" {{ if .Webhook.SslVerification }}checked{{ end }}> |
| 39 | + <span>Verify SSL</span> |
| 40 | + </label> |
| 41 | + </fieldset> |
| 42 | + <button type="submit" class="shithub-button shithub-button-primary">Save</button> |
| 43 | + </form> |
| 44 | + </section> |
| 45 | + |
| 46 | + <section class="shithub-settings-section"> |
| 47 | + <h2>Test + lifecycle</h2> |
| 48 | + <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks/{{ .Webhook.ID }}/ping" style="display:inline"> |
| 49 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 50 | + <button type="submit" class="shithub-button">Send ping</button> |
| 51 | + </form> |
| 52 | + <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks/{{ .Webhook.ID }}/toggle" style="display:inline"> |
| 53 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 54 | + <button type="submit" class="shithub-button">{{ if .Webhook.Active }}Disable{{ else }}Enable{{ end }}</button> |
| 55 | + </form> |
| 56 | + <form method="POST" action="/{{ .Owner }}/{{ .Repo.Name }}/settings/webhooks/{{ .Webhook.ID }}/delete" style="display:inline"> |
| 57 | + <input type="hidden" name="csrf_token" value="{{ .CSRFToken }}"> |
| 58 | + <button type="submit" class="shithub-button shithub-button-danger" onclick="return confirm('Delete this webhook?')">Delete</button> |
| 59 | + </form> |
| 60 | + {{ if .Webhook.DisabledAt.Valid }} |
| 61 | + <p class="shithub-hint">Auto-disabled {{ relativeTime .Webhook.DisabledAt.Time }}: {{ .Webhook.DisabledReason.String }}</p> |
| 62 | + {{ end }} |
| 63 | + </section> |
| 64 | + |
| 65 | + <section class="shithub-settings-section"> |
| 66 | + <h2>Recent deliveries</h2> |
| 67 | + {{ if .Deliveries }} |
| 68 | + <table class="shithub-branches-table"> |
| 69 | + <thead> |
| 70 | + <tr><th></th><th>Event</th><th>Status</th><th>Started</th><th></th></tr> |
| 71 | + </thead> |
| 72 | + <tbody> |
| 73 | + {{ range .Deliveries }} |
| 74 | + <tr> |
| 75 | + <td> |
| 76 | + {{ if eq (printf "%s" .Status) "succeeded" }}✓ |
| 77 | + {{ else if eq (printf "%s" .Status) "failed_permanent" }}✗ |
| 78 | + {{ else if eq (printf "%s" .Status) "failed_retry" }}… |
| 79 | + {{ else }}·{{ end }} |
| 80 | + </td> |
| 81 | + <td><code>{{ .EventKind }}</code></td> |
| 82 | + <td> |
| 83 | + {{ if .ResponseStatus.Valid }}HTTP {{ .ResponseStatus.Int32 }}{{ else }}{{ .Status }}{{ end }} |
| 84 | + {{ if .RedeliverOf.Valid }}<span class="shithub-fg-muted">(redelivery)</span>{{ end }} |
| 85 | + </td> |
| 86 | + <td>{{ relativeTime .StartedAt.Time }}</td> |
| 87 | + <td> |
| 88 | + <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/settings/webhooks/{{ $.Webhook.ID }}/deliveries/{{ .ID }}">View</a> |
| 89 | + </td> |
| 90 | + </tr> |
| 91 | + {{ end }} |
| 92 | + </tbody> |
| 93 | + </table> |
| 94 | + {{ else }} |
| 95 | + <p class="shithub-empty-note">No deliveries yet.</p> |
| 96 | + {{ end }} |
| 97 | + </section> |
| 98 | + </div> |
| 99 | +</div> |
| 100 | +{{- end }} |