Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show acknowledgement when saving replication settings #4714

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 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,8 @@ 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_opts[:action]}' on MyTasks screen"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#{task_opts[:action]} inside _() will not work. You have to use _("один %{two} три") % {:two => два} here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mzazrivec for review and nice explanation :)

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