Skip to content

Commit

Permalink
Fixed to load correct screen when pressing button sunder Lifecycle.
Browse files Browse the repository at this point in the history
When pressing Publish, Migrate, Clone buttons under Lifecycle toolbar button from list of VMs under a Provider thru relationship was loading pre provisioning dialog, it should load the workflow dialog directly. Pre-provisioning dialog is only supposed to show when Adding a new Provisioning request directly from VM explorers.

https://bugzilla.redhat.com/show_bug.cgi?id=1263845
  • Loading branch information
h-kataria committed Sep 17, 2015
1 parent 711ec1a commit f16094b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -2081,7 +2081,7 @@ def prov_redirect(typ=nil)
end
else
@org_controller = "vm" #request originated from controller
@refresh_partial = "pre_prov"
@refresh_partial = typ ? "prov_edit" : "pre_prov"
end
if typ
vms = find_checked_items
Expand Down
Expand Up @@ -783,7 +783,8 @@ def prov_set_form_vars(req = nil)
@edit[:key] = "prov_edit__#{@edit[:req_id] || "new"}"
options = req.try(:get_options) || {} # Use existing request options, if passed in
@edit[:new] = options unless @workflow_exists
@edit[:org_controller] = params[:org_controller] if params[:org_controller] # request originated from controller
# request originated from controller
@edit[:org_controller] = params[:org_controller] ? params[:org_controller] : "vm"
@edit[:wf], pre_prov_values = workflow_instance_from_vars(req)

if @edit[:wf]
Expand Down
9 changes: 9 additions & 0 deletions spec/controllers/ems_infra_controller_spec.rb
Expand Up @@ -20,6 +20,15 @@
controller.send(:flash_errors?).should_not be_true
end

it "when VM Migrate is pressed" do
vm = FactoryGirl.create(:vm_vmware)
ems = FactoryGirl.create("ems_vmware")
post :button, :pressed => "vm_migrate", :format => :js, "check_#{vm.id}" => 1, :id => ems.id
controller.send(:flash_errors?).should_not be_true
response.body.should include("/miq_request/prov_edit?")
expect(response.status).to eq(200)
end

it "when VM Retire is pressed" do
controller.should_receive(:retirevms).once
post :button, :pressed => "vm_retire", :format => :js
Expand Down

0 comments on commit f16094b

Please sign in to comment.