Commit 56df1f0a authored by Tom Quirk's avatar Tom Quirk

Create partial for webhook deliveries table

The deliveries table is the same for admin
and project-level webhooks.

This commit creates a partial for this table,
and uses this partial at the admin and project
level to reduce duplication.
parent 453eb934
......@@ -36,6 +36,15 @@ module HooksHelper
admin_hook_path(hook)
end
end
def hook_log_path(hook, hook_log)
case hook
when ProjectHook
hook_log.present.details_path
when SystemHook
admin_hook_hook_log_path(hook, hook_log)
end
end
end
HooksHelper.prepend_mod_with('HooksHelper')
......@@ -4,34 +4,4 @@
= _('Recent Deliveries')
%p= _('When an event in GitLab triggers a webhook, you can use the request details to figure out if something went wrong.')
.col-lg-9
- if hook_logs.present?
%table.table
%thead
%tr
%th= _('Status')
%th= _('Trigger')
%th= _('URL')
%th= _('Elapsed time')
%th= _('Request time')
%th
- hook_logs.each do |hook_log|
%tr
%td
= render partial: 'shared/hook_logs/status_label', locals: { hook_log: hook_log }
%td.d-none.d-sm-block
%span.badge.badge-gray.deploy-project-label
= hook_log.trigger.singularize.titleize
%td
= truncate(hook_log.url, length: 50)
%td.light
#{number_with_precision(hook_log.execution_duration, precision: 2)} sec
%td.light
= time_ago_with_tooltip(hook_log.created_at)
%td
= link_to _('View details'), admin_hook_hook_log_path(hook, hook_log)
= paginate hook_logs, theme: 'gitlab'
- else
.settings-message.text-center
= _("You don't have any webhooks deliveries")
= render partial: 'shared/hook_logs/recent_deliveries_table', locals: { hook: hook, hook_logs: hook_logs }
.row.gl-mt-7.gl-mb-3
.row.gl-mt-3.gl-mb-3
.col-lg-3
%h4.gl-mt-0
Recent Deliveries
%p When an event in GitLab triggers a webhook, you can use the request details to figure out if something went wrong.
= _('Recent Deliveries')
%p= _('When an event in GitLab triggers a webhook, you can use the request details to figure out if something went wrong.')
.col-lg-9
- if hook_logs.present?
%table.table
%thead
%tr
%th Status
%th Trigger
%th URL
%th Elapsed time
%th Request time
%th
- hook_logs.each do |hook_log|
%tr
%td
= render partial: 'shared/hook_logs/status_label', locals: { hook_log: hook_log }
%td.d-none.d-sm-block
%span.badge.badge-gray.deploy-project-label
= hook_log.trigger.singularize.titleize
%td
= truncate(hook_log.url, length: 50)
%td.light
#{number_with_precision(hook_log.execution_duration, precision: 2)} sec
%td.light
= time_ago_with_tooltip(hook_log.created_at)
%td
= link_to 'View details', hook_log.present.details_path
= paginate hook_logs, theme: 'gitlab'
- else
.settings-message.text-center
You don't have any webhooks deliveries
= render partial: 'shared/hook_logs/recent_deliveries_table', locals: { hook: hook, hook_logs: hook_logs }
......@@ -5,8 +5,8 @@
.row.gl-mt-3.gl-mb-3
.col-lg-3
%h4.gl-mt-0
Request details
= _("Request details")
.col-lg-9
= link_to 'Resend Request', @hook_log.present.retry_path, method: :post, class: "btn gl-button btn-default float-right gl-ml-3"
= link_to _('Resend Request'), @hook_log.present.retry_path, method: :post, class: "btn gl-button btn-default float-right gl-ml-3"
= render partial: 'shared/hook_logs/content', locals: { hook_log: @hook_log }
- if hook_logs.present?
%table.table
%thead
%tr
%th= _('Status')
%th.d-none.d-sm-table-cell= _('Trigger')
%th= _('URL')
%th= _('Elapsed time')
%th= _('Request time')
%th
- hook_logs.each do |hook_log|
%tr
%td
= render partial: 'shared/hook_logs/status_label', locals: { hook_log: hook_log }
%td.d-none.d-sm-table-cell
%span.badge.badge-gray.deploy-project-label
= hook_log.trigger.singularize.titleize
%td
= truncate(hook_log.url, length: 50)
%td
#{number_with_precision(hook_log.execution_duration, precision: 2)} sec
%td
= time_ago_with_tooltip(hook_log.created_at)
%td
= link_to _('View details'), hook_log_path(hook, hook_log)
= paginate hook_logs, theme: 'gitlab'
- else
.settings-message.text-center
= _("You don't have any webhooks deliveries")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment