Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F462063
filesets_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, May 18, 7:55 PM
Size
2 KB
Mime Type
text/x-ruby
Expires
Tue, May 20, 7:55 PM (1 d, 1 h)
Engine
blob
Format
Raw Data
Handle
220515
Attached To
rARCHIVING archiving
filesets_controller.rb
View Options
class
FilesetsController
<
ApplicationController
before_action
:require_logged_in
before_action
:fetch_host
,
only
:
[
:new
,
:create
,
:show
,
:edit
,
:update
]
before_action
:fetch_job_id
,
only
:
[
:new
,
:create
,
:edit
,
:update
]
before_action
:fetch_fileset
,
only
:
[
:show
,
:edit
,
:update
]
# GET /hosts/:host_id/filesets/new
def
new
@fileset
=
@host
.
filesets
.
new
@fileset
.
include_directions
=
{
'file'
=>
[
nil
]
}
end
# GET /hosts/:host_id/filesets/:id
def
show
@fileset
=
@host
.
filesets
.
find
(
params
[
:id
]
)
respond_to
do
|
format
|
format
.
js
{}
end
end
# GET /hosts/:host_id/filesets/:id/edit
def
edit
@fileset
.
include_files
=
@fileset
.
include_directions
[
'file'
]
end
# PATCH /hosts/:host_id/filesets/:id/
def
update
if
@fileset
.
update
(
fetch_params
)
flash
[
:success
]
=
'Fileset updated successfully'
participating_hosts
=
@fileset
.
participating_hosts
if
participating_hosts
.
size
.
nonzero?
participating_hosts
.
each
(
&
:recalculate
)
flash
[
:alert
]
=
'You will need to redeploy the afffected clients: '
+
participating_hosts
.
map
(
&
:name
)
.
join
(
', '
)
end
if
@job_id
redirect_to
edit_host_job_path
(
@host
,
@job_id
,
fileset_id
:
@fileset
.
id
)
else
redirect_to
new_host_job_path
(
@host
,
fileset_id
:
@fileset
.
id
)
end
else
render
:edit
end
end
# POST /hosts/:host_id/filesets
def
create
@fileset
=
@host
.
filesets
.
new
(
fetch_params
)
if
@fileset
.
save
flash
[
:success
]
=
'Fileset created'
if
@job_id
.
present?
redirect_to
edit_host_job_path
(
@host
,
@job_id
,
fileset_id
:
@fileset
.
id
)
else
redirect_to
new_host_job_path
(
@host
,
fileset_id
:
@fileset
.
id
)
end
else
@fileset
.
include_files
=
nil
@fileset
.
exclude_directions
=
nil
@fileset
.
include_directions
=
{
'file'
=>
[
nil
]
}
render
:new
end
end
# DELETE /hosts/:host_id/filesets/:id
def
destroy
end
private
def
fetch_host
@host
=
current_user
.
hosts
.
find
(
params
[
:host_id
]
)
end
def
fetch_job_id
@job_id
=
@host
.
job_templates
.
find
(
params
[
:job_id
]
)
.
id
if
params
[
:job_id
].
present?
end
def
fetch_fileset
@fileset
=
@host
.
filesets
.
find
(
params
[
:id
]
)
end
def
fetch_params
params
.
require
(
:fileset
)
.
permit
(
:name
,
exclude_directions
:
[]
,
include_files
:
[]
)
end
end
Event Timeline
Log In to Comment