Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F887741
clients_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, 4:47 AM
Size
1 KB
Mime Type
text/x-ruby
Expires
Tue, Aug 12, 4:47 AM (9 h, 10 m)
Engine
blob
Format
Raw Data
Handle
246385
Attached To
rARCHIVING archiving
clients_controller.rb
View Options
class
ClientsController
<
ApplicationController
before_action
:require_logged_in
before_action
:set_client
,
only
:
[
:show
,
:jobs
,
:logs
,
:stats
]
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
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
Event Timeline
Log In to Comment