Skip to content

Commit

Permalink
feat: Simple pools display table
Browse files Browse the repository at this point in the history
  • Loading branch information
jrgns committed Jan 16, 2020
1 parent 17fcac6 commit 8ee4f95
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/proxes/controllers/status_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ def self.policy_class
ProxES::StatusPolicy
end

get '/pools/?' do
pools = client_with_context(user_id: current_user&.id).cat.thread_pool(format: 'json')

respond_to do |format|
format.html do
haml :'status/pools', locals: { title: 'Clustr Pools', pools: pools }
end
format.json do
json result
end
end
end

# This provides a URL that can be polled by a monitoring system. It will return
# 200 OK if all the checks pass, or 500 if any of the checks fail.
get '/check' do
Expand Down
18 changes: 18 additions & 0 deletions views/status/pools.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.row
.col-md-12
%table.table.table-striped.table-bordered.table-hover
%thead.thead-dark
%tr
%th Node
%th Pool
%th Active
%th Queued
%th Rejected
%tbody
- pools.each do |pool|
%tr{ class: pool['queue'] < pool['active'] * 12.5 ? '' : 'table-warning' }
%td= pool['node_name']
%td= pool['name']
%td= pool['active']
%td= pool['queue']
%td= pool['rejected']

0 comments on commit 8ee4f95

Please sign in to comment.