Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1615566
base_controller.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Mar 22, 1:57 AM
Size
925 B
Mime Type
text/x-ruby
Expires
Tue, Mar 24, 1:57 AM (6 h, 25 m)
Engine
blob
Format
Raw Data
Handle
354478
Attached To
rARCHIVING archiving
base_controller.rb
View Options
class
Admin
::
BaseController
<
ApplicationController
before_action
:require_admin
,
except
:
[
:login
]
# GET /admin
# POST /admin
def
index
@client_ids
=
Client
.
pluck
(
:ClientId
)
get_charts
@global_stats
=
GlobalStats
.
new
.
stats
@jobs
=
Job
.
includes
(
:file_set
,
:client
)
.
where
(
'EndTime > ?'
,
days_ago
.
days
.
ago
)
.
order
(
EndTime
:
:desc
)
render
'admin/index'
end
# GET /admin/login
def
login
render
'admin/login'
end
# GET /admin/raiser
# Raises an exception on demand, for sentry testing
def
raiser
raise
'Error on Demand'
end
protected
def
get_charts
@job_status
=
ChartGenerator
.
job_statuses
(
@client_ids
,
days_ago
)
@job_stats
=
ChartGenerator
.
job_stats
(
@client_ids
,
days_ago
-
1
)
end
def
require_admin
return
if
current_user
.
try
(
:has_admin_access?
)
flash
[
:alert
]
=
'You need to log in first'
redirect_to
admin_login_path
end
end
Event Timeline
Log In to Comment