Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F886105
No One
Temporary
Actions
View 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
Fri, Aug 8, 8:44 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Sun, Aug 10, 8:44 PM (23 h, 34 m)
Engine
blob
Format
Raw Data
Handle
246058
Attached To
rARCHIVING archiving
View Options
diff --git a/app/assets/javascripts/jobs.js b/app/assets/javascripts/jobs.js
index 4647e6e..5d42966 100644
--- a/app/assets/javascripts/jobs.js
+++ b/app/assets/javascripts/jobs.js
@@ -1,28 +1,29 @@
$(document).ready(function() {
$("#job_template_schedule_id").change(function() {
showSchedule();
});
$("#job_template_fileset_id").change(function() {
showFileset();
});
if ($('a#toggle-advanced').size() > 0) {
$('a#toggle-advanced').click(function() {
$('#advanced').toggleClass('hidden');
});
};
});
function showSchedule() {
var scheduleId = $("#job_template_schedule_id").val();
$.ajax({
url: "/hosts/" + hostId + "/schedules/" + scheduleId,
data: jobIdParam
});
}
function showFileset() {
var filesetId = $("#job_template_fileset_id").val();
$.ajax({
- url: "/hosts/" + hostId + "/filesets/" + filesetId
+ url: "/hosts/" + hostId + "/filesets/" + filesetId,
+ data: jobIdParam
});
}
diff --git a/app/controllers/filesets_controller.rb b/app/controllers/filesets_controller.rb
index 438f879..261bf6d 100644
--- a/app/controllers/filesets_controller.rb
+++ b/app/controllers/filesets_controller.rb
@@ -1,94 +1,94 @@
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_job_id, only: [:new, :create, :edit, :update, :show]
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] }
@fileset.exclude_directions = ['']
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']
@fileset.exclude_directions = [''] if @fileset.exclude_directions.empty?
end
# PATCH /hosts/:host_id/filesets/:id/
def update
fileset_params = fetch_params
if fileset_params[:exclude_directions].nil?
fileset_params[:exclude_directions] = []
end
if @fileset.update(fileset_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 = ['']
@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