Skip to content

Commit

Permalink
Improvements to Background Activity
Browse files Browse the repository at this point in the history
A whole bunch of changes. New activities, messages
are visible in the index page, more doc, some
test scripts, better validations.
  • Loading branch information
prioux committed Apr 15, 2024
1 parent 4a40015 commit 47aaeca
Show file tree
Hide file tree
Showing 22 changed files with 599 additions and 124 deletions.
10 changes: 8 additions & 2 deletions BrainPortal/app/controllers/background_activities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def create #:nodoc:
add_options_for_random_activity if @bac.is_a?(BackgroundActivity::RandomActivity)
add_options_for_compress_file if @bac.is_a?(BackgroundActivity::CompressFile) || @bac.is_a?(BackgroundActivity::UncompressFile)
add_options_for_move_file if @bac.is_a?(BackgroundActivity::MoveFile) || @bac.is_a?(BackgroundActivity::CopyFile)
add_options_for_archive_task if @bac.is_a?(BackgroundActivity::ArchiveTaskWorkdir)
add_options_for_archive_task_wd if @bac.is_a?(BackgroundActivity::ArchiveTaskWorkdir)
add_options_for_remove_task_wd if @bac.is_a?(BackgroundActivity::RemoveTaskWorkdir)
add_options_for_clean_cache if @bac.is_a?(BackgroundActivity::CleanCache)

if (@bac.errors.present?) || (! @bac.valid?) || (! @bac.save)
Expand All @@ -77,6 +78,7 @@ def create #:nodoc:
# GET /background_activities
def index #:nodoc:
@scope = scope_from_session
scope_default_order(@scope, :updated_at, :desc)
@base_scope = BackgroundActivity.all.includes( [:user, :remote_resource] )
if ! current_user.has_role? :admin_user
@base_scope = @base_scope.where(:user_id => current_user.id)
Expand Down Expand Up @@ -173,12 +175,16 @@ def add_options_for_move_file #:nodoc:
add_options_userfile_custom_filter_id()
end

def add_options_for_archive_task #:nodoc:
def add_options_for_archive_task_wd #:nodoc:
@archive_task_dp_id = params[:archive_task_dp_id]
@bac.options[:archive_data_provider_id] = @archive_task_dp_id.presence # can be nil
add_options_task_custom_filter_id()
end

def add_options_for_remove_task_wd #:nodoc:
add_options_task_custom_filter_id()
end

def add_options_for_clean_cache #:nodoc:
opt = params_options.permit(
:days_older, # a string
Expand Down
Loading

0 comments on commit 47aaeca

Please sign in to comment.