code.gitea.io/gitea@v1.22.3/templates/repo/settings/webhook/history.tmpl (about)

     1  {{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}}
     2  {{if .PageIsSettingsHooksEdit}}
     3  	<h4 class="ui top attached header">
     4  		{{ctx.Locale.Tr "repo.settings.recent_deliveries"}}
     5  		{{if .Permission.IsAdmin}}
     6  			<div class="ui right">
     7  				<!-- 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 -->
     8  				<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}}">
     9  					<button class="ui tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}">
    10  						<span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span>
    11  					</button>
    12  			</span>
    13  			</div>
    14  		{{end}}
    15  	</h4>
    16  	<div class="ui attached segment">
    17  		<div class="ui list">
    18  			{{range .History}}
    19  				<div class="item">
    20  					<div class="flex-text-block tw-justify-between">
    21  						<div class="flex-text-inline">
    22  							{{if .IsSucceed}}
    23  								<span class="text green">{{svg "octicon-check"}}</span>
    24  							{{else if not .IsDelivered}}
    25  								<span class="text orange">{{svg "octicon-stopwatch"}}</span>
    26  							{{else}}
    27  								<span class="text red">{{svg "octicon-alert"}}</span>
    28  							{{end}}
    29  							<a class="ui primary sha label toggle button show-panel" data-panel="#info-{{.ID}}">{{.UUID}}</a>
    30  						</div>
    31  						<span class="text grey">
    32  							{{TimeSince .Delivered.AsTime ctx.Locale}}
    33  						</span>
    34  					</div>
    35  					<div class="info tw-hidden" id="info-{{.ID}}">
    36  						<div class="ui top attached tabular menu">
    37  							<a class="item active" data-tab="request-{{.ID}}">
    38  								{{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.settings.webhook.request")}}
    39  							</a>
    40  							<a class="item" data-tab="response-{{.ID}}">
    41  								{{template "shared/misc/tabtitle" (ctx.Locale.Tr "repo.settings.webhook.response")}}
    42  								{{if .ResponseInfo}}
    43  									{{if .IsSucceed}}
    44  										<span class="ui green label">{{.ResponseInfo.Status}}</span>
    45  									{{else}}
    46  										<span class="ui red label">{{.ResponseInfo.Status}}</span>
    47  									{{end}}
    48  								{{else}}
    49  									<span class="ui label">-</span>
    50  								{{end}}
    51  							</a>
    52  							{{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}}
    53  							<div class="right menu">
    54  								<form class="tw-py-2" action="{{$.Link}}/replay/{{.UUID}}" method="post">
    55  									{{$.CsrfTokenHtml}}
    56  									<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}}">
    57  										<button class="ui tiny button tw-mr-0{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button>
    58  									</span>
    59  								</form>
    60  							</div>
    61  							{{end}}
    62  						</div>
    63  						<div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}">
    64  							{{if .RequestInfo}}
    65  								<h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
    66  								<pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}}
    67  <strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}}
    68  {{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
    69  {{end}}</pre>
    70  								<h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5>
    71  								<pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre>
    72  							{{else}}
    73  								-
    74  							{{end}}
    75  						</div>
    76  						<div class="ui bottom attached tab segment" data-tab="response-{{.ID}}">
    77  							{{if .ResponseInfo}}
    78  								<h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5>
    79  								<pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}}
    80  {{end}}</pre>
    81  								<h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5>
    82  								<pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre>
    83  							{{else}}
    84  								-
    85  							{{end}}
    86  						</div>
    87  					</div>
    88  				</div>
    89  			{{end}}
    90  		</div>
    91  	</div>
    92  {{end}}