Fixed file store access, added builders page in admin section
This commit is contained in:
parent
710d6096ba
commit
1f18eca69c
|
@ -0,0 +1,19 @@
|
|||
ActiveAdmin.register_page 'Builders' do
|
||||
content do
|
||||
table do
|
||||
thead do
|
||||
["id", "system?", "Hostname", "Busy workers", "Supported Arches", "Supported Platforms"].each &method(:th)
|
||||
end
|
||||
tbody do
|
||||
RpmBuildNode.all.to_a.each do |node|
|
||||
next unless node.user_id
|
||||
tr do
|
||||
%w(id system host busy_workers supported_arches supported_platforms).each do |col|
|
||||
td { node.send(col) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -23,6 +23,14 @@ class Api::V1::BaseController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def check_auth_pw_or_token
|
||||
authenticate_or_request_with_http_basic do |username,pw|
|
||||
if user = User.auth_by_token_or_login_pass(username, pw)
|
||||
sign_in user, false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_csv_file_headers(file_name)
|
||||
headers['Content-Type'] = 'text/csv'
|
||||
headers['Content-disposition'] = "attachment; filename=\"#{file_name}.csv\""
|
||||
|
|
|
@ -42,11 +42,14 @@ class Api::V1::JobsController < Api::V1::BaseController
|
|||
def statistics
|
||||
if params[:uid].present?
|
||||
RpmBuildNode.create(
|
||||
id: params[:uid],
|
||||
user_id: current_user.id,
|
||||
system: current_user.system?,
|
||||
worker_count: params[:worker_count],
|
||||
busy_workers: params[:busy_workers]
|
||||
id: params[:uid],
|
||||
user_id: current_user.id,
|
||||
system: current_user.system?,
|
||||
worker_count: params[:worker_count],
|
||||
busy_workers: params[:busy_workers],
|
||||
host: params[:host],
|
||||
supported_arches: params[:supported_arches],
|
||||
supported_platforms: params[:supported_platforms]
|
||||
) rescue nil
|
||||
end
|
||||
render nothing: true
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
class Api::V1::UsersController < Api::V1::BaseController
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :check_auth_pw_or_token, only: :show_current_user
|
||||
skip_before_action :check_auth, only: :show_current_user
|
||||
skip_before_action :check_auth, only: [:show] if APP_CONFIG['anonymous_access']
|
||||
skip_before_action :authenticate_user!, only: [:show] if APP_CONFIG['anonymous_access']
|
||||
before_action :load_user, only: %i(show)
|
||||
|
|
|
@ -12,6 +12,9 @@ class RpmBuildNode < Ohm::Model
|
|||
attribute :worker_count
|
||||
attribute :busy_workers
|
||||
attribute :system
|
||||
attribute :host
|
||||
attribute :supported_arches
|
||||
attribute :supported_platforms
|
||||
|
||||
def user
|
||||
User.where(id: user_id).first
|
||||
|
|
Loading…
Reference in New Issue