diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-10-11 10:27:00 +0000 |
commit | 65aa53fc52ff15efe54df4147564828d535837f8 (patch) | |
tree | 31c51dad04fdcca80e6d3043c8bd49d2f1a51f83 /templates/repo/settings/webhook | |
parent | Initial commit. (diff) | |
download | forgejo-debian.tar.xz forgejo-debian.zip |
Adding upstream version 8.0.3.HEADupstream/8.0.3upstreamdebian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'templates/repo/settings/webhook')
-rw-r--r-- | templates/repo/settings/webhook/base.tmpl | 5 | ||||
-rw-r--r-- | templates/repo/settings/webhook/base_list.tmpl | 26 | ||||
-rw-r--r-- | templates/repo/settings/webhook/delete_modal.tmpl | 10 | ||||
-rw-r--r-- | templates/repo/settings/webhook/history.tmpl | 90 | ||||
-rw-r--r-- | templates/repo/settings/webhook/link_menu.tmpl | 12 | ||||
-rw-r--r-- | templates/repo/settings/webhook/list.tmpl | 4 | ||||
-rw-r--r-- | templates/repo/settings/webhook/new.tmpl | 7 |
7 files changed, 154 insertions, 0 deletions
diff --git a/templates/repo/settings/webhook/base.tmpl b/templates/repo/settings/webhook/base.tmpl new file mode 100644 index 00000000..d5247224 --- /dev/null +++ b/templates/repo/settings/webhook/base.tmpl @@ -0,0 +1,5 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings webhooks")}} + <div class="repo-setting-content"> + {{template "repo/settings/webhook/list" .}} + </div> +{{template "repo/settings/layout_footer" .}} diff --git a/templates/repo/settings/webhook/base_list.tmpl b/templates/repo/settings/webhook/base_list.tmpl new file mode 100644 index 00000000..36e75a7e --- /dev/null +++ b/templates/repo/settings/webhook/base_list.tmpl @@ -0,0 +1,26 @@ +<h4 class="ui top attached header"> + {{.Title}} + <div class="ui right"> + <div class="ui jump dropdown"> + <div class="ui primary tiny button">{{ctx.Locale.Tr "repo.settings.add_webhook"}}</div> + {{template "repo/settings/webhook/link_menu" .}} + </div> + </div> +</h4> +<div class="ui attached segment"> + <div class="ui list"> + <div class="item"> + {{.Description}} + </div> + {{range .Webhooks}} + <div class="item truncated-item-container"> + <span class="text {{if eq .LastStatus 1}}green{{else if eq .LastStatus 2}}red{{else}}grey{{end}} tw-mr-2">{{svg "octicon-dot-fill" 22}}</span> + <div class="text truncate tw-flex-1 tw-mr-2"> + <a title="{{.URL}}" href="{{$.BaseLink}}/{{.ID}}">{{.URL}}</a> + </div> + <a class="muted tw-p-2" href="{{$.BaseLink}}/{{.ID}}">{{svg "octicon-pencil"}}</a> + <a class="delete-button tw-p-2" data-url="{{$.Link}}/delete" data-id="{{.ID}}">{{svg "octicon-trash"}}</a> + </div> + {{end}} + </div> +</div> diff --git a/templates/repo/settings/webhook/delete_modal.tmpl b/templates/repo/settings/webhook/delete_modal.tmpl new file mode 100644 index 00000000..9955ed3a --- /dev/null +++ b/templates/repo/settings/webhook/delete_modal.tmpl @@ -0,0 +1,10 @@ +<div class="ui g-modal-confirm delete modal"> + <div class="header"> + {{svg "octicon-trash"}} + {{ctx.Locale.Tr "repo.settings.webhook_deletion"}} + </div> + <div class="content"> + <p>{{ctx.Locale.Tr "repo.settings.webhook_deletion_desc"}}</p> + </div> + {{template "base/modal_actions_confirm" .}} +</div> diff --git a/templates/repo/settings/webhook/history.tmpl b/templates/repo/settings/webhook/history.tmpl new file mode 100644 index 00000000..8ee1446a --- /dev/null +++ b/templates/repo/settings/webhook/history.tmpl @@ -0,0 +1,90 @@ +{{$isNew:=or .PageIsSettingsHooksNew .PageIsAdminDefaultHooksNew .PageIsAdminSystemHooksNew}} +{{if .PageIsSettingsHooksEdit}} + <h4 class="ui top attached header"> + {{ctx.Locale.Tr "repo.settings.recent_deliveries"}} + {{if .Permission.IsAdmin}} + <div class="ui right"> + <!-- 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 --> + <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}}"> + <button class="ui teal tiny button{{if not (or $isNew .Webhook.IsActive)}} disabled{{end}}" id="test-delivery" data-link="{{.Link}}/test" data-redirect="{{.Link}}"> + <span class="text">{{ctx.Locale.Tr "repo.settings.webhook.test_delivery"}}</span> + </button> + </span> + </div> + {{end}} + </h4> + <div class="ui attached segment"> + <div class="ui list"> + {{range .History}} + <div class="item"> + <div class="flex-text-block tw-justify-between"> + <div class="flex-text-inline"> + {{if .IsSucceed}} + <span class="text green">{{svg "octicon-check"}}</span> + {{else if not .IsDelivered}} + <span class="text orange">{{svg "octicon-stopwatch"}}</span> + {{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> + </div> + <span class="text grey"> + {{TimeSince .Delivered.AsTime ctx.Locale}} + </span> + </div> + <div class="info tw-hidden" id="info-{{.ID}}"> + <div class="ui top attached tabular menu"> + <a class="item active" data-tab="request-{{.ID}}">{{ctx.Locale.Tr "repo.settings.webhook.request"}}</a> + <a class="item" data-tab="response-{{.ID}}"> + {{ctx.Locale.Tr "repo.settings.webhook.response"}} + {{if .ResponseInfo}} + {{if .IsSucceed}} + <span class="ui green label">{{.ResponseInfo.Status}}</span> + {{else}} + <span class="ui red label">{{.ResponseInfo.Status}}</span> + {{end}} + {{else}} + <span class="ui label">-</span> + {{end}} + </a> + {{if or $.Permission.IsAdmin $.IsOrganizationOwner $.PageIsAdmin $.PageIsUserSettings}} + <div class="right menu"> + <form class="item" action="{{$.Link}}/replay/{{.UUID}}" method="post"> + {{$.CsrfTokenHtml}} + <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}}"> + <button class="ui tiny button{{if not $.Webhook.IsActive}} disabled{{end}}">{{svg "octicon-sync"}}</button> + </span> + </form> + </div> + {{end}} + </div> + <div class="ui bottom attached tab segment active" data-tab="request-{{.ID}}"> + {{if .RequestInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info"><strong>Request URL:</strong> {{.RequestInfo.URL}} +<strong>Request method:</strong> {{if .RequestInfo.HTTPMethod}}{{.RequestInfo.HTTPMethod}}{{else}}POST{{end}} +{{range $key, $val := .RequestInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.payload"}}</h5> + <pre class="webhook-info"><code class="json">{{or .RequestInfo.Body .PayloadContent}}</code></pre> + {{else}} + - + {{end}} + </div> + <div class="ui bottom attached tab segment" data-tab="response-{{.ID}}"> + {{if .ResponseInfo}} + <h5>{{ctx.Locale.Tr "repo.settings.webhook.headers"}}</h5> + <pre class="webhook-info">{{range $key, $val := .ResponseInfo.Headers}}<strong>{{$key}}:</strong> {{$val}} +{{end}}</pre> + <h5>{{ctx.Locale.Tr "repo.settings.webhook.body"}}</h5> + <pre class="webhook-info"><code>{{.ResponseInfo.Body}}</code></pre> + {{else}} + - + {{end}} + </div> + </div> + </div> + {{end}} + </div> + </div> +{{end}} diff --git a/templates/repo/settings/webhook/link_menu.tmpl b/templates/repo/settings/webhook/link_menu.tmpl new file mode 100644 index 00000000..2edc5af4 --- /dev/null +++ b/templates/repo/settings/webhook/link_menu.tmpl @@ -0,0 +1,12 @@ +{{$size := 20}} +{{if .Size}} + {{$size = .Size}} +{{end}} +<div class="menu"> + {{range .WebhookList}} + <a class="item" href="{{$.BaseLinkNew}}/{{.Type}}/new"> + {{.Icon $size}} + {{ctx.Locale.Tr (print "repo.settings.web_hook_name_" .Type)}} + </a> + {{end}} +</div> diff --git a/templates/repo/settings/webhook/list.tmpl b/templates/repo/settings/webhook/list.tmpl new file mode 100644 index 00000000..b24159fc --- /dev/null +++ b/templates/repo/settings/webhook/list.tmpl @@ -0,0 +1,4 @@ + +{{template "repo/settings/webhook/base_list" .}} + +{{template "repo/settings/webhook/delete_modal" .}} diff --git a/templates/repo/settings/webhook/new.tmpl b/templates/repo/settings/webhook/new.tmpl new file mode 100644 index 00000000..b04a4421 --- /dev/null +++ b/templates/repo/settings/webhook/new.tmpl @@ -0,0 +1,7 @@ +{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings new webhook")}} + <div class="repo-setting-content"> + {{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}} + {{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}} + {{template "webhook/new" (dict "ctxData" . "CustomHeaderTitle" $CustomHeaderTitle)}} + </div> +{{template "repo/settings/layout_footer" .}} |