Skip to content

Commit

Permalink
Merge pull request #6152 from hstastna/App_mixin_vm_copy_params_present
Browse files Browse the repository at this point in the history
Use copy_params_if_present in vm_common, manager_controller_mixin and miq_request_methods
  • Loading branch information
mzazrivec authored Sep 5, 2019
2 parents dae0769 + 2098401 commit a359b69
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,8 @@ def prov_get_form_vars
id = params[:ou_id].gsub(/_-_/, ",") if params[:ou_id]
@edit[:new][:ldap_ous] = id.match(/(.*)\,(.*)/)[1..2] if id # ou selected in a tree

copy_params_if_present(@edit[:new], params, %i[start_hour start_min])
@edit[:new][:start_date] = params[:miq_date_1] if params[:miq_date_1]
@edit[:new][:start_hour] = params[:start_hour] if params[:start_hour]
@edit[:new][:start_min] = params[:start_min] if params[:start_min]
@edit[:new][:schedule_time] = Time.zone.parse("#{@edit[:new][:start_date]} #{@edit[:new][:start_hour]}:#{@edit[:new][:start_min]}")

params.each do |key, _value|
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/mixins/manager_controller_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,8 @@ def change_tab
end

def cs_edit_get_form_vars
@edit[:new][:name] = params[:name] if params[:name]
@edit[:new][:description] = params[:description] if params[:description]
copy_params_if_present(@edit[:new], params, %i[name description dialog_name])
@edit[:new][:draft] = params[:draft] == "true" if params[:draft]
@edit[:new][:dialog_name] = params[:dialog_name] if params[:dialog_name]
end

def cs_form_field_changed
Expand Down
4 changes: 1 addition & 3 deletions app/controllers/vm_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1589,9 +1589,7 @@ def get_vm_child_selection
# Get variables from edit form
def get_form_vars
@record = VmOrTemplate.find_by(:id => @edit[:vm_id])
@edit[:new][:custom_1] = params[:custom_1] if params[:custom_1]
@edit[:new][:description] = params[:description] if params[:description]
@edit[:new][:name] = params[:name] if params[:name]
copy_params_if_present(@edit[:new], params, %i[custom_1 description name])
@edit[:new][:parent] = params[:chosen_parent].to_i if params[:chosen_parent]
# if coming from explorer
get_vm_child_selection if %w[allright left right].include?(params[:button])
Expand Down

0 comments on commit a359b69

Please sign in to comment.