Show webhooks list in internal (#3997)
This commit is contained in:
parent
59e7c104f2
commit
8d4991f906
5 changed files with 46 additions and 9 deletions
9
app/controllers/internal/webhook_endpoints_controller.rb
Normal file
9
app/controllers/internal/webhook_endpoints_controller.rb
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
class Internal::WebhookEndpointsController < Internal::ApplicationController
|
||||
layout "internal"
|
||||
|
||||
def index
|
||||
@endpoints = Webhook::Endpoint.includes(:user).
|
||||
page(params[:page]).per(50).
|
||||
order("created_at desc")
|
||||
end
|
||||
end
|
||||
11
app/views/internal/shared/_navbar.html.erb
Normal file
11
app/views/internal/shared/_navbar.html.erb
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<% menu_items = %w[comments articles users tags welcome broadcasts reports pages tools chat_channels growth mods].each_with_object({}) { |v, h| h[v] = v } %>
|
||||
<% menu_items[:listings] = "classified_listings" %>
|
||||
<% menu_items[:pod] = "podcasts" %>
|
||||
<% menu_items[:hooks] = "webhook_endpoints" %>
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav" style="font-size: 0.97em;">
|
||||
<% menu_items.each do |name, controller| %>
|
||||
<li class="<%= "active" if controller_name == controller %>"><a href="/internal/<%= controller %>"><%= name %></a></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
24
app/views/internal/webhook_endpoints/index.html.erb
Normal file
24
app/views/internal/webhook_endpoints/index.html.erb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<h1>Webhook Endpoints</h1>
|
||||
|
||||
<%= paginate @endpoints %>
|
||||
<br>
|
||||
<div class="wrapper" style="font-weight: 600; border-bottom: 2px solid black;">
|
||||
<div>Target URL</div>
|
||||
<div>ID</div>
|
||||
<div>Events</div>
|
||||
<div>Source</div>
|
||||
<div>User</div>
|
||||
<div>Created at</div>
|
||||
</div>
|
||||
|
||||
<% @endpoints.each do |endpoint| %>
|
||||
<div class="wrapper" style="border-bottom: 1px solid grey; padding: 10px;">
|
||||
<div class="grid-item"><%= endpoint.target_url %></a></div>
|
||||
<div class="grid-item"><%= endpoint.id %></div>
|
||||
<div class="grid-item"><%= endpoint.events.join(", ") %></a></div>
|
||||
<div class="grid-item"><%= endpoint.source %></div>
|
||||
<div class="grid-item"><%= link_to endpoint.user.username, endpoint.user.path %></div>
|
||||
<div class="grid-item"><%= endpoint.created_at.strftime("%H:%M %d %b %Y") %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= paginate @endpoints %>
|
||||
|
|
@ -148,15 +148,7 @@
|
|||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div id="navbar" class="collapse navbar-collapse">
|
||||
<ul class="nav navbar-nav" style="font-size: 0.97em;">
|
||||
<% controller_names = %w[comments articles users tags welcome broadcasts reports pages classified_listings tools chat_channels growth mods] %>
|
||||
<% controller_names.each do |name| %>
|
||||
<li class="<%= "active" if controller_name == name %>"><a href="/internal/<%= name %>"><%= name %></a></li>
|
||||
<% end %>
|
||||
<li class="<%= "active" if controller_name == "podcasts" %>"><a href="/internal/podcasts">pod</a></li>
|
||||
</ul>
|
||||
</div><!--/.nav-collapse -->
|
||||
<%= render "internal/shared/navbar" %>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ Rails.application.routes.draw do
|
|||
post "bust_cache"
|
||||
end
|
||||
end
|
||||
resources :webhook_endpoints, only: :index
|
||||
end
|
||||
|
||||
namespace :api, defaults: { format: "json" } do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue