diff --git a/app/controllers/clients_controller.rb b/app/controllers/clients_controller.rb
index 6c20cd0..c9211c9 100644
--- a/app/controllers/clients_controller.rb
+++ b/app/controllers/clients_controller.rb
@@ -1,50 +1,55 @@
class ClientsController < ApplicationController
before_action :require_logged_in
- before_action :set_client, only: [:show, :jobs, :logs, :stats]
+ before_action :set_client, only: [:show, :jobs, :logs, :stats, :users]
before_action :fetch_logs, only: [:logs]
# GET /clients
# POST /clients
def index
@client_ids = Client.for_user(current_user.id).pluck(:ClientId)
@clients = Client.where(ClientId: @client_ids).includes(:jobs)
@hosts = current_user.hosts.not_baculized
fetch_jobs_info
get_charts
end
# GET /clients/1
def show
end
# GET /clients/1/jobs
def jobs
@jobs = @client.recent_jobs.page(params[:page])
end
# GET /clients/1/logs
def logs; end
# GET /clients/1/stats
# POST /clients/1/stats
def stats
get_charts
end
+ # GET /clients/1/users
+ def users
+ @users = @client.host.users
+ end
+
private
def set_client
@client = Client.for_user(current_user.id).find(params[:id])
@client_ids = [@client.id]
end
def fetch_jobs_info
@stats = JobStats.new(@client_ids)
end
def get_charts
days_ago = params.fetch(:days_back, 7).to_i rescue 7
@job_status = ChartGenerator.job_statuses(@client_ids, days_ago)
@job_stats = ChartGenerator.job_stats(@client_ids, days_ago - 1)
end
end
diff --git a/app/views/clients/_header.html.erb b/app/views/clients/_header.html.erb
index dd13fd9..43c7a5c 100644
--- a/app/views/clients/_header.html.erb
+++ b/app/views/clients/_header.html.erb
@@ -1,14 +1,15 @@
<%= notice %>
<% if @client.host %>
<%= link_to 'Manage Client', host_path(@client.host), class: "btn btn-primary", role: "button" %>
<% end %>
<%= breadcrumb_with Client: client_path(@client), Jobs: jobs_client_path(@client),
- Stats: stats_client_path(@client), Logs: logs_client_path(@client) %>
+ Stats: stats_client_path(@client), Logs: logs_client_path(@client),
+ Users: users_client_path(@client) %>
<%= @client.name %>
<%= host_status_label(@client.host) %>
diff --git a/app/views/clients/_user.html.erb b/app/views/clients/_user.html.erb
new file mode 100644
index 0000000..9f0bf44
--- /dev/null
+++ b/app/views/clients/_user.html.erb
@@ -0,0 +1,4 @@
+
+ <%= user.username %> |
+ <%= user.email %> |
+
diff --git a/app/views/clients/_users.html.erb b/app/views/clients/_users.html.erb
new file mode 100644
index 0000000..35b090a
--- /dev/null
+++ b/app/views/clients/_users.html.erb
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Username |
+ Email |
+
+
+
+ <%= render partial: 'user', collection: @users %>
+
+
+
+
diff --git a/app/views/clients/users.html.erb b/app/views/clients/users.html.erb
new file mode 100644
index 0000000..602d601
--- /dev/null
+++ b/app/views/clients/users.html.erb
@@ -0,0 +1,13 @@
+<%= render partial: 'header' %>
+
+
+
+
Collaborators for <%= @client.host.name %>
+
+
+
+
+ <%= render partial: 'users' %>
+
+
+<%= link_to 'Back to clients', clients_path %>
diff --git a/config/routes.rb b/config/routes.rb
index 1988513..44af95e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,68 +1,69 @@
Rails.application.routes.draw do
root 'application#index'
post 'login' => 'application#login'
match 'vima', to: 'application#vima', :via => [:get, :post]
get 'logout' => 'application#logout'
resources :clients, only: [:index, :show] do
member do
get :jobs
get :logs
get :stats
post :stats
+ get :users
end
collection do
post :index
end
end
resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
post :submit_config
get :restore
post :run_restore
delete :revoke
end
resources :jobs, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
patch :toggle_enable
post :backup_now
end
end
resources :filesets, only: [:show, :new, :create, :destroy]
resources :schedules, only: [:show, :new, :edit, :create, :update, :destroy]
end
namespace :admin do
match '/', to: 'base#index', via: [:get, :post]
resources :settings, only: [:index, :new, :create, :edit, :update] do
member do
delete :reset
end
end
resources :clients, only: [:index, :show] do
member do
get :jobs
get :logs
get :stats
post :stats
get :configuration
end
end
resources :hosts, only: [:show] do
collection do
get :unverified
end
member do
post :verify
end
end
end
end