2023-09-25 09:33:00 +02:00
|
|
|
{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
|
2015-08-26 18:30:06 +02:00
|
|
|
{{if .PageIsSettingsHooksEdit}}
|
2015-12-07 23:30:52 +01:00
|
|
|
<h4 class="ui top attached header">
|
2023-09-25 10:56:50 +02:00
|
|
|
{{ctx.Locale.Tr "repo.settings.recent_deliveries"}}
|
2018-11-28 12:26:14 +01:00
|
|
|
{{if .Permission.IsAdmin}}
|
2015-12-07 23:30:52 +01:00
|
|
|
<div class="ui right">
|
2023-09-25 09:33:00 +02:00
|
|
|
<!-- the button is wrapped with a span because the tooltip doesn't show on hover if we put data-tooltip-content directly on the button -->
|
2023-09-25 10:56:50 +02:00
|
|
|
<span data-tooltip-content="{{if or $isNew .Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.test_delivery_desc_disabled"}}{{end}}">
|
2024-04-14 19:53:52 +02:00
|
|
|
<button class="ui tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
|
2024-03-21 17:31:15 +01:00
|
|
|
<span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
|
|
|
|
</button>
|
2023-09-25 09:33:00 +02:00
|
|
|
</span>
|
2015-08-27 17:06:14 +02:00
|
|
|
</div>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
|
|
|
</h4>
|
2017-04-07 16:50:40 +02:00
|
|
|
<div class="ui attached segment">
|
|
|
|
<div class="ui list">
|
2015-12-07 23:30:52 +01:00
|
|
|
{{range .History}}
|
|
|
|
<div class="item">
|
2024-03-22 14:45:10 +01:00
|
|
|
<div class="flex-text-block tw-justify-between">
|
2023-08-31 04:29:59 +02:00
|
|
|
<div class="flex-text-inline">
|
|
|
|
{{if .IsSucceed}}
|
|
|
|
<span class="text green">{{svg "octicon-check"}}</span>
|
2024-03-07 23:18:38 +01:00
|
|
|
{{else if not .IsDelivered}}
|
|
|
|
<span class="text orange">{{svg "octicon-stopwatch"}}</span>
|
2023-08-31 04:29:59 +02:00
|
|
|
{{else}}
|
|
|
|
<span class="text red">{{svg "octicon-alert"}}</span>
|
|
|
|
{{end}}
|
|
|
|
<a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
2023-08-31 04:29:59 +02:00
|
|
|
<span class="text grey">
|
2023-09-25 14:42:40 +02:00
|
|
|
{{TimeSince .Delivered.AsTime ctx.Locale}}
|
2023-08-31 04:29:59 +02:00
|
|
|
</span>
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
2024-03-24 19:23:38 +01:00
|
|
|
<div class="info tw-hidden" id="info-{{.ID}}">
|
2015-12-07 23:30:52 +01:00
|
|
|
<div class="ui top attached tabular menu">
|
2024-05-27 08:45:16 +02:00
|
|
|
<a class="item active" data-tab="request-{{.ID}}">
|
|
|
|
{{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.settings.webhook.request")}}
|
|
|
|
</a>
|
2015-12-07 23:30:52 +01:00
|
|
|
<a class="item" data-tab="response-{{.ID}}">
|
2024-05-27 08:45:16 +02:00
|
|
|
{{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.settings.webhook.response")}}
|
2015-12-07 23:30:52 +01:00
|
|
|
{{if .ResponseInfo}}
|
|
|
|
{{if .IsSucceed}}
|
|
|
|
<span class="ui green label">{{.ResponseInfo.Status}}</span>
|
|
|
|
{{else}}
|
|
|
|
<span class="ui red label">{{.ResponseInfo.Status}}</span>
|
|
|
|
{{end}}
|
|
|
|
{{else}}
|
2023-05-02 11:54:29 +02:00
|
|
|
<span class="ui label">-</span>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
|
|
|
</a>
|
2023-03-10 15:28:32 +01:00
|
|
|
{{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}}
|
2022-01-05 22:00:20 +01:00
|
|
|
<div class="right menu">
|
2024-05-27 08:45:16 +02:00
|
|
|
<form class="tw-py-2" action="{{$.Link}}/replay/{{.UUID}}" method="post">
|
2022-01-05 22:00:20 +01:00
|
|
|
{{$.CsrfTokenHtml}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<span data-tooltip-content="{{if $.Webhook.IsActive}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description"}}{{else}}{{ctx.Locale.Tr "repo.settings.webhook.replay.description_disabled"}}{{end}}">
|
2024-05-27 08:45:16 +02:00
|
|
|
<button class="ui tiny button tw-mr-0{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button>
|
2023-09-25 09:33:00 +02:00
|
|
|
</span>
|
2022-01-05 22:00:20 +01:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{{end}}
|
2015-12-07 23:30:52 +01:00
|
|
|
</div>
|
|
|
|
<div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}">
|
|
|
|
{{if .RequestInfo}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
|
2021-06-27 21:21:09 +02:00
|
|
|
<pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}}
|
|
|
|
<strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}}
|
2022-08-31 17:58:54 +02:00
|
|
|
{{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
|
2015-08-27 17:06:14 +02:00
|
|
|
{{end}}</pre>
|
2023-09-25 10:56:50 +02:00
|
|
|
<h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5>
|
2024-03-07 23:18:38 +01:00
|
|
|
<pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{else}}
|
2023-05-02 11:54:29 +02:00
|
|
|
-
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
<div class="ui bottom attached tab segment" data-tab="response-{{.ID}}">
|
|
|
|
{{if .ResponseInfo}}
|
2023-09-25 10:56:50 +02:00
|
|
|
<h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
|
2022-08-31 17:58:54 +02:00
|
|
|
<pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
|
2015-08-27 17:06:14 +02:00
|
|
|
{{end}}</pre>
|
2023-09-25 10:56:50 +02:00
|
|
|
<h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5>
|
2020-11-04 08:14:07 +01:00
|
|
|
<pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{else}}
|
2023-05-02 11:54:29 +02:00
|
|
|
-
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
|
|
|
</div>
|
|
|
|
</div>
|
2015-08-27 17:06:14 +02:00
|
|
|
</div>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|
2015-08-27 17:06:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2015-12-07 23:30:52 +01:00
|
|
|
{{end}}
|