Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Target for mass VM transformation dialog
Created a separate vm_transform_mass action to handle VM Transform button clicks in on Providers page and on Compute > Infrastructure > Virtual Machines page. This action interprets the ID passed to it as provider ID, while regular vm_transform action interprets it as VM ID. If provider ID is not passed, the Redhat provider EMS object is used as target. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1514939 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1516497
- Loading branch information
Showing
9 changed files
with
75 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
app/controllers/mixins/actions/provider_actions/mass_transform.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module Mixins | ||
module Actions | ||
module ProviderActions | ||
module MassTransform | ||
def vm_transform_mass | ||
dialog = Dialog.find_by(:label => 'Transform VM') | ||
@right_cell_text = _("Transform VMs to RHV") | ||
if params.key?(:id) | ||
provider = ExtManagementSystem.find_by(:id => params[:id].to_i) | ||
dialog_initialize( | ||
dialog.resource_actions.first, | ||
:header => @right_cell_text, | ||
:target_id => provider.id, | ||
:target_kls => Provider.name | ||
) | ||
else | ||
provider = ExtManagementSystem.find_by(:type => 'ManageIQ::Providers::Redhat::InfraManager') | ||
simple_dialog_initialize( | ||
dialog.resource_actions.first, | ||
:header => @right_cell_text, | ||
:target => provider | ||
) | ||
end | ||
end | ||
|
||
private | ||
|
||
def simple_dialog_initialize(ra, options) | ||
@record = Dialog.find_by(:id => ra.dialog_id.to_i) | ||
new = options[:dialog] || {} | ||
id = @record.try(:id) | ||
opts = { | ||
:target => options[:target] | ||
} | ||
@edit = { | ||
:new => new, | ||
:wf => ResourceActionWorkflow.new(new, current_user, ra, opts), | ||
:rec_id => id, | ||
:key => "dialog_edit__#{id || "new"}", | ||
:explorer => @explorer || false, | ||
:dialog_mode => options[:dialog_mode], | ||
:current => copy_hash(new), | ||
:right_cell_text => options[:header].to_s | ||
} | ||
@in_a_form = true | ||
@changed = session[:changed] = true | ||
if @edit[:explorer] | ||
replace_right_cell(:action => "dialog_provision") | ||
else | ||
javascript_redirect(:action => 'dialog_load') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
app/helpers/application_helper/button/mass_transform_vm_button.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters