Skip to content

Commit

Permalink
Merge pull request #4714 from yrudman/show-confirmation-when-replicat…
Browse files Browse the repository at this point in the history
…ion-setup-queued

Show acknowledgement when saving replication settings
  • Loading branch information
mzazrivec authored Oct 2, 2018
2 parents 5fae302 + c04af58 commit 883df6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
16 changes: 3 additions & 13 deletions app/controllers/ops_controller/settings/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,19 +205,9 @@ def pglogical_save_subscriptions
task_opts = {:action => "Set replication type to none", :userid => session[:userid]}
queue_opts = {:class_name => "MiqRegion", :method_name => "replication_type=", :args => [:none]}
end
task_id = MiqTask.generic_action_with_callback(task_opts, queue_opts)
initiate_wait_for_task(:task_id => task_id, :action => "pglogical_save_finished")
end

def pglogical_save_finished
task = MiqTask.find(session[:async][:params][:task_id])
if task.nil?
add_flash(_("Unknown result of saving replication configuration: task not found"), :error)
elsif MiqTask.status_ok?(task.status)
add_flash(_("Replication configuration save was successful"))
else
add_flash(_("Error during replication configuration save: %{message}") % {:message => task.message }, :error)
end
MiqTask.generic_action_with_callback(task_opts, queue_opts)
add_flash(_("Replication configuration save initiated. Check status of task \"%{task_name}\" on MyTasks screen") %
{:task_name => task_opts[:action]})
javascript_flash
end

Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/ops_controller/settings/common_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
end

describe "#pglogical_save_subscriptions" do
before { allow(controller).to receive(:initiate_wait_for_task) }
before { allow(controller).to receive(:javascript_flash) }

context "remote" do
let(:to_exlude) { "---\n- vmdb_databases\n- vmdb_indexes" }
Expand Down

0 comments on commit 883df6d

Please sign in to comment.