Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F888053
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, Aug 10, 8:53 AM
Size
682 B
Mime Type
text/x-ruby
Expires
Tue, Aug 12, 8:53 AM (7 h, 45 m)
Engine
blob
Format
Raw Data
Handle
230847
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
render
'admin/index'
end
# GET /admin/login
def
login
render
'admin/login'
end
protected
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
def
require_admin
return
if
current_user
.
try
(
:admin?
)
flash
[
:alert
]
=
'You need to log in first'
redirect_to
admin_login_path
end
end
Event Timeline
Log In to Comment