Skip to content

Commit

Permalink
rhn_edit - use observe queue for validate & save
Browse files Browse the repository at this point in the history
validate:
  this is a straight transform from link_to + RJS remote: true,
  to a button using miqAjaxButton

  except adding observe:true so that the validate action never happens before any pending edit actions

  (auth_credentials2 is only ever used from that single Red Hat Updates edit form)

save:
  just enabling observe=true for x_edit_buttons in settings_rhn_edit

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1532201
  • Loading branch information
himdel committed Aug 13, 2018
1 parent c78ba1e commit f3b9b79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
1 change: 1 addition & 0 deletions app/controllers/ops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ def set_form_locals
record_id = @lt_map.try(:id)
elsif @sb[:active_tab] == 'settings_rhn_edit'
locals[:no_cancel] = false
locals[:observe_queue] = true
action_url = "settings_update"
record_id = @sb[:active_tab].split("settings_").last
else
Expand Down
20 changes: 9 additions & 11 deletions app/views/layouts/_auth_credentials2.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,15 @@
- if validate
.form-group
.col-md-10{:align => 'right'}
= link_to(_('Validate'),
{:action => validate_url,
:button => 'validate',
:type => prefix,
:id => record_id},
:class => 'btn btn-primary btn-xs',
:alt => labels[:title],
:title => labels[:title],
:remote => true,
"data-method" => :post,
'data-miq_sparkle_on' => true)
- url = url_for_only_path(:action => validate_url,
:button => 'validate',
:type => prefix,
:id => record_id)
= button_tag(_('Validate'),
:onclick => "miqAjaxButton('#{url}', undefined, { observeQueue: true, beforeSend: true, complete: false })",
:class => 'btn btn-primary btn-xs',
:alt => labels[:title],
:title => labels[:title])
- if validate_note
.note
%b= validate_note
Expand Down

0 comments on commit f3b9b79

Please sign in to comment.