Skip to content

Commit

Permalink
Merge pull request #5241 from ZitaNemeckova/fix_dialog
Browse files Browse the repository at this point in the history
Check button's inputs before looking for records
  • Loading branch information
h-kataria authored Feb 13, 2019
2 parents 0b62dfa + e1360cb commit 1148f9a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/controllers/application_controller/buttons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,6 @@ def ab_button_save
end
@edit[:uri] = MiqAeEngine.create_automation_object(ab_button_name, attrs, :fqclass => @edit[:new][:starting_object], :message => @edit[:new][:object_message])
@edit[:new][:description] = @edit[:new][:description].strip == "" ? nil : @edit[:new][:description] unless @edit[:new][:description].nil?
button_set_record_vars(@custom_button)

unless button_valid?
@breadcrumbs = []
Expand All @@ -598,6 +597,8 @@ def ab_button_save
return
end

button_set_record_vars(@custom_button)

if @custom_button.save
add_flash(_("Custom Button \"%{name}\" was saved") % {:name => @edit[:new][:description]})
@edit = session[:edit] = nil
Expand Down Expand Up @@ -845,7 +846,9 @@ def button_valid?(button_hash = @edit[:new])
end

def validate_playbook_button(button_hash)
add_flash(_("An Ansible Playbook must be selected"), :error) if button_hash[:service_template_id].blank?
if button_hash[:service_template_id].blank? || button_hash[:service_template_id].zero?
add_flash(_("An Ansible Playbook must be selected"), :error)
end
if button_hash[:inventory_type] == 'manual' && button_hash[:hosts].blank?
add_flash(_("At least one host must be specified for manual mode"), :error)
end
Expand Down

0 comments on commit 1148f9a

Please sign in to comment.