diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index fce37cf..bb18b3f 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -1,90 +1,97 @@
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery.min
//= require jquery_ujs
//= require jquery.timepicker.min
//= require jquery-ui.min
//= require bootstrap.min
//= require jstree
//= require chosen.jquery.min
//= require jquery.dataTables.min
//= require dataTables.bootstrap.min
//= require_tree .
//= require highcharts
//= require jobs
//= require filesets
//= require clients
$(document).ready(function() {
if ($('table#admin_clients').size() > 0) {
$('table#admin_clients').DataTable({
paging: false,
order: [],
columnDefs: [
{
targets: 'neither-search-nor-order',
orderable: false,
searchable: false
},
{
targets: 'no-search',
orderable: true,
searchable: false
}],
});
};
if ($('table#admin_jobs').size() > 0) {
$('table#admin_jobs').DataTable({
paging: false,
order: [],
columnDefs: [
{
targets: 'neither-search-nor-order',
orderable: false,
searchable: false
},
{
targets: 'no-search',
orderable: true,
searchable: false
}],
});
};
+ if ($('table#rejected_hosts').size() > 0) {
+ $('table#rejected_hosts').DataTable({
+ paging: false,
+ order: [],
+ columnDefs: [],
+ });
+ };
if ($('table#logs').size() > 0) {
$('table#logs').DataTable({
paging: false,
order: [],
columnDefs: [
{
targets: 'neither-search-nor-order',
orderable: false,
searchable: false
},
{
targets: 'no-order',
orderable: false,
searchable: true
},
{
targets: 'no-search',
orderable: true,
searchable: false
}],
});
};
if ($('.datepicker').size() > 0) {
$('.datepicker').datepicker({
dateFormat: "dd-mm-yy"
});
};
});
diff --git a/app/controllers/admin/hosts_controller.rb b/app/controllers/admin/hosts_controller.rb
index 0c2a215..1d9bf04 100644
--- a/app/controllers/admin/hosts_controller.rb
+++ b/app/controllers/admin/hosts_controller.rb
@@ -1,56 +1,61 @@
class Admin::HostsController < Admin::BaseController
before_action :fetch_host, only: [:verify, :reject, :set_quota]
# GET /admin/hosts/unverified
def unverified
@hosts = Host.unverified
end
+ # GET /admin/hosts/rejected
+ def rejected
+ @hosts = RejectedHost.order(created_at: :desc)
+ end
+
# POST /admin/hosts/1/verify
def verify
@host.verify(current_user.id)
redirect_to unverified_admin_hosts_path
end
# POST /admin/hosts/1/reject
def reject
msg = 'You need to provide a reason' if params[:reason].blank?
if msg.blank?
if @host.reject(current_user.id, params[:reason])
flash[:success] = 'Client rejected'
else
flash[:error] = 'Something went wrong'
end
else
flash[:error] = msg
end
redirect_to unverified_admin_hosts_path
end
# PUT /admin/hosts/1/set_quota
def set_quota
@host.quota = case params[:unit]
when 'MB'
params[:quota].to_i * ConfigurationSetting::MEGA_BYTES
when 'GB'
params[:quota].to_i * ConfigurationSetting::GIGA_BYTES
when 'TB'
params[:quota].to_i * ConfigurationSetting::TERA_BYTES
end
if @host.save
flash[:success] = 'Changes saved'
else
flash[:error] = 'Changes not saved'
end
redirect_to admin_client_path(@host.client)
end
private
def fetch_host
@host = Host.find(params[:id])
end
end
diff --git a/app/views/admin/hosts/_rejected_host.html.erb b/app/views/admin/hosts/_rejected_host.html.erb
new file mode 100644
index 0000000..fa45022
--- /dev/null
+++ b/app/views/admin/hosts/_rejected_host.html.erb
@@ -0,0 +1,9 @@
+
+ <%= rejected_host.name %> |
+ <%= rejected_host.fqdn %> |
+ <%= I18n.l(rejected_host.host_created_at, format: :long) %> |
+ <%= link_to rejected_host.user.display_name, admin_user_path(rejected_host.user) %> |
+ <%= I18n.l(rejected_host.rejected_at, format: :long) %> |
+ <%= rejected_host.reason %> |
+ <%= link_to rejected_host.rejecter.username, admin_user_path(rejected_host.rejecter.id) %> |
+
diff --git a/app/views/admin/hosts/rejected.html.erb b/app/views/admin/hosts/rejected.html.erb
new file mode 100644
index 0000000..c232863
--- /dev/null
+++ b/app/views/admin/hosts/rejected.html.erb
@@ -0,0 +1,25 @@
+Rejected Clients
+
+<% if @hosts.empty? %>
+ There are no rejected clients
+<% else %>
+
+
+
+
+ Name |
+ FQDN |
+ Client request at |
+ User |
+ Rejected At |
+ Reason |
+ Rejecter |
+
+
+
+
+ <%= render partial: 'rejected_host', collection: @hosts %>
+
+
+
+<% end %>
diff --git a/app/views/shared/_admin.html.erb b/app/views/shared/_admin.html.erb
index f234d75..51d9e2e 100644
--- a/app/views/shared/_admin.html.erb
+++ b/app/views/shared/_admin.html.erb
@@ -1,42 +1,55 @@
<%= content_tag(:li, active_class(admin_path)) do %>
<%= link_to 'Admin', admin_path %>
<% end %>
<%= content_tag(:li, active_class(admin_clients_path, true)) do %>
<%= link_to 'Clients', admin_clients_path %>
<% end %>
- <%= content_tag(:li, active_class(unverified_admin_hosts_path, true)) do %>
- <%= link_to 'Unverified Clients', unverified_admin_hosts_path %>
+ <%= content_tag(:li,
+ { class: "dropdown #{active_class(unverified_admin_hosts_path)[:class]}" }) do %>
+
+ Unverified Clients
+
+
+ <%#= content_tag(:li, active_class(unverified_admin_hosts_path, true)) do %>
+ <%#= link_to 'Unverified Clients', unverified_admin_hosts_path %>
<% end %>
<%= content_tag(:li, { class: "dropdown #{active_class(admin_users_path)[:class]}" }) do %>
Users
<% end %>
<%= content_tag(:li, active_class(admin_faqs_path)) do %>
<%= link_to 'FAQ', admin_faqs_path %>
<% end %>
<%= content_tag(:li, active_class(admin_pools_path)) do %>
<%= link_to 'Pools', admin_pools_path %>
<% end %>
<%= content_tag(:li, active_class(admin_settings_path)) do %>
<%= link_to 'Settings', admin_settings_path %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 9bc62fd..5babe46 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,131 +1,132 @@
Rails.application.routes.draw do
root 'application#index'
get 'faq' => 'application#faq'
post 'grnet' => 'application#grnet'
get 'institutional' => 'application#institutional'
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
get :restore
post :run_restore
post :restore_selected
delete :remove_user
end
collection do
post :index
end
end
resources :clients, only: [], param: :client_id do
member do
get :tree
end
end
resources :invitations, only: [:create]
get '/invitations/:host_id/:verification_code/accept' => 'invitations#accept',
as: :accept_invitation
resources :hosts, only: [:new, :create, :show, :edit, :update, :destroy] do
member do
post :submit_config
post :disable
post :regenerate_token
delete :revoke
get :fd_config
end
collection do
get :fetch_vima_hosts, to: 'hosts#fetch_vima_hosts', as: :fetch_vima
end
resources :simple_configs, only: [:new, :create]
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, :edit, :update, :destroy]
resources :schedules, only: [:show, :new, :edit, :create, :update, :destroy]
end
resources :users, only: :show do
member do
patch :generate_token
end
end
namespace :admin do
match '/', to: 'base#index', via: [:get, :post]
get '/login' => 'base#login', as: :login
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
post :disable
post :block
post :unblock
delete :revoke
end
end
resources :hosts, only: [] do
collection do
get :unverified
+ get :rejected
end
member do
post :verify
post :reject
put :set_quota
end
end
resources :users, only: [:index, :new, :create, :show, :edit, :update] do
member do
patch :ban
patch :unban
patch :revoke_admin
patch :grant_admin
end
end
resources :pools, only: [:index, :new, :create]
resources :faqs
end
namespace :api, defaults: { format: :json } do
scope module: :v1, constraints: ApiVersion.new(version: 1, default: true) do
resources :clients, only: [:index, :show] do
member do
post :backup
post :restore
end
end
end
end
end