refresh webhook status

This commit is contained in:
Pete Matsyburka
2025-07-05 10:27:35 +03:00
parent 988a5361a6
commit 4615e3e48f
10 changed files with 139 additions and 90 deletions
+2 -28
View File
@@ -89,33 +89,7 @@
</div>
<% if @webhook_events.present? %>
<div class="divide-y divide-base-300 rounded-lg">
<% @webhook_events.each do |event| %>
<div class="group relative hover:cursor-pointer hover:bg-base-200">
<a href="<%= settings_webhook_event_path(@webhook_url.id, event.uuid) %>" data-turbo-frame="drawer" class="top-0 bottom-0 left-0 right-0 absolute"></a>
<div class="min-h-12 flex flex-col md:flex-row md:items-center md:justify-between gap-2 px-3 py-2">
<div class="flex items-center gap-4">
<% if event.status == 'success' %>
<div class="btn btn-outline btn-xs btn-success bg-lime-50 gap-2">
<%= svg_icon('check', class: 'w-4 h-4 shrink-0 stroke-2') %>
</div>
<% elsif event.status == 'pending' %>
<div class="btn btn-outline btn-xs btn-info bg-blue-50 gap-2">
<%= svg_icon('clock', class: 'w-4 h-4 shrink-0 stroke-2') %>
</div>
<% elsif event.status == 'error' %>
<div class="btn btn-outline btn-xs btn-error bg-red-50 gap-2">
<%= svg_icon('x', class: 'w-4 h-4 shrink-0') %>
</div>
<% end %>
<div><%= event.event_type %></div>
</div>
<div class="flex items-center gap-3">
<%= button_to button_title(title: t('resend'), disabled_with: t('sending'), icon: svg_icon('rotate', class: 'w-4 h-4'), icon_disabled: svg_icon('loader', class: 'w-4 h-4 animate-spin')), resend_settings_webhook_event_path(@webhook_url.id, event.uuid), class: 'btn btn-neutral btn-xs h-2 text-white relative z-[1] hidden md:group-hover:inline-block', data: { turbo_frame: :drawer }, method: :post %>
<span><%= l(event.created_at, locale: current_account.locale, format: :short) %></span>
</div>
</div>
</div>
<% end %>
<%= render partial: 'webhook_events/event_row', collection: @webhook_events, as: :webhook_event, locals: { webhook_url: @webhook_url } %>
</div>
<% else %>
<div class="text-center py-4">
@@ -147,7 +121,7 @@
</div>
<% end %>
</div>
<% elsif submitter = current_account.submitters.where.not(completed_at: nil).order(:id).last %>
<% elsif (submitter = current_account.submitters.where.not(completed_at: nil).order(:id).last) && can?(:read, submitter) %>
<div class="space-y-4 mt-4">
<div class="collapse collapse-open bg-base-200 px-1">
<div class="p-4 text-xl font-medium">