Skip to content

Commit

Permalink
Fixes #27764, #27798, #27391 - host form update on change
Browse files Browse the repository at this point in the history
  • Loading branch information
ezr-ondrej authored and tbrisker committed Sep 9, 2019
1 parent 1245c20 commit 16976e1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
10 changes: 5 additions & 5 deletions app/assets/javascripts/host_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function update_capabilities(capabilities) {
var stop_pooling;

function submit_with_all_params() {
$('form input[type="submit"]').attr('disabled', true);
$('form.hostresource-form input[type="submit"]').attr('disabled', true);
stop_pooling = false;
$('body').css('cursor', 'progress');
clear_errors();
Expand Down Expand Up @@ -345,7 +345,7 @@ function update_form(element, options) {
tfm.tools.hideSpinner();
},
success: function(response) {
$('form').replaceWith(response);
$('form.hostresource-form').replaceWith(response);
multiSelectOnLoad();
var host_compute_resource_id = $('#host_compute_resource_id');
if (host_compute_resource_id.exists()) {
Expand All @@ -371,7 +371,7 @@ function update_form(element, options) {

//Serializes only those input elements from form that are set explicitly
function serializeForm() {
return $('form input,select,textarea')
return $('form.hostresource-form input,select,textarea')
.not('.form_template *')
.serialize();
}
Expand Down Expand Up @@ -507,7 +507,7 @@ function use_image_selected(element) {
}

function reload_host_params() {
var host_id = $('form').data('id');
var host_id = $('form.hostresource-form').data('id');
var url = $('#params-tab').data('url');
var data = serializeForm().replace('method=patch', 'method=post');
if (url.length > 0) {
Expand All @@ -517,7 +517,7 @@ function reload_host_params() {
}

function reload_puppetclass_params() {
var host_id = $('form').data('id');
var host_id = $('form.hostresource-form').data('id');
var url2 = $('#params-tab').data('url2');
var data = serializeForm().replace('method=patch', 'method=post');
if (url2.match('hostgroups')) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/hostgroups/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= javascript 'host_edit', 'host_edit_interfaces' %>
<%= form_for @hostgroup, :html => {:data => {:id => @hostgroup.try(:id)}} do |f| %>
<%= form_for @hostgroup, :html => {:class => 'hostresource-form form-horizontal well', :data => {:id => @hostgroup.try(:id)}} do |f| %>
<%= base_errors_for @hostgroup %>

<ul class="nav nav-tabs" data-tabs="tabs">
Expand Down
3 changes: 1 addition & 2 deletions app/views/hosts/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<%= render "hosts/progress" %>
<% Taxonomy.as_taxonomy @organization , @location do %>
<%= form_for @host, :url => (@host.new_record? ? hosts_path : host_path(:id => @host.id)), :html => {:data => {:id => @host.try(:id), :type_changed => !!@host.type_changed?, :submit => 'progress_bar'}} do |f| %>
<%= form_for @host, :url => (@host.new_record? ? hosts_path : host_path(:id => @host.id)), :html => {:class => 'hostresource-form form-horizontal well', :data => {:id => @host.try(:id), :type_changed => !!@host.type_changed?, :submit => 'progress_bar'}} do |f| %>
<%= base_errors_for @host %>

<ul class="nav nav-tabs" data-tabs="tabs">
Expand Down

0 comments on commit 16976e1

Please sign in to comment.