Skip to content

Commit

Permalink
Fixes #38220 - page scroll freeze in host edit unselect arch
Browse files Browse the repository at this point in the history
(cherry picked from commit aefbddb)
  • Loading branch information
MariaAga authored and ofedoren committed Feb 20, 2025
1 parent e8372df commit 060fdee
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
8 changes: 8 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,15 @@ function activate_select2(container, allowClear ) {
formatNoMatches: __('No matches found'),
placeholder: selectAllowClear? placeholder || '' : { id: '-1', text: '' },
});
$(this).on("select2:clear", function (evt) {
$(this).on("select2:opening.cancelOpen", function (evt) {
evt.preventDefault();

$(this).off("select2:opening.cancelOpen");
});
});
});

}

function setError(field, text) {
Expand Down
20 changes: 11 additions & 9 deletions app/assets/javascripts/host_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@ $(document).on('ContentLoad', function() {
update_default_compute_resource($('.hostgroup-select').val());
});
$(document)
.on('change', '.hostgroup-select', function(evt) {
.on('select2:select select2:unselecting', '.hostgroup-select', function(evt) {
hostgroup_changed(evt.target);
}).on('change', '.host-form-compute-resource-handle', function(evt) {
}).on('select2:select select2:unselecting', '.host-form-compute-resource-handle', function(evt) {
computeResourceSelected(evt.target);
}).on('change', '.host-taxonomy-select', function(evt) {
}).on('select2:select select2:unselecting', '.host-taxonomy-select', function(evt) {
update_form(evt.target);
}).on('change', '.host-architecture-select', function(evt) {
}).on('select2:select select2:unselecting', '#host_architecture_id', function(evt) {
architecture_selected(evt.target);
}).on('change', '.host-architecture-os-select', function(evt) {
}).on('select2:select select2:unselecting', '#hostgroup_architecture_id', function(evt) {
architecture_selected(evt.target);
}).on('select2:select select2:unselecting', '.host-architecture-os-select', function(evt) {
os_selected(evt.target);
}).on('change', '.host-os-media-select', function(evt) {
}).on('select2:select select2:unselecting', '.host-os-media-select', function(evt) {
medium_selected(evt.target);
});

Expand Down Expand Up @@ -600,7 +602,7 @@ function build_provision_method_selected() {
$('#host_compute_attributes_template').select2('readonly',false);
}
$(document).on(
'change',
'select2:select select2:unselecting',
'#host_provision_method_build',
build_provision_method_selected
);
Expand All @@ -623,12 +625,12 @@ function image_provision_method_selected() {
}
}
$(document).on(
'change',
'select2:select select2:unselecting',
'#host_provision_method_image',
image_provision_method_selected
);

$(document).on('change', '.interface_domain', function() {
$(document).on('select2:select select2:unselecting', '.interface_domain', function() {
interface_domain_selected(this);
clearIpField(this, '.interface_ip');
clearIpField(this, '.interface_ip6');
Expand Down
2 changes: 1 addition & 1 deletion app/views/hosts/_operating_system.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

<%= select_f f, :architecture_id, accessible_resource(f.object, :architecture), :id, :to_label, {:include_blank => true},
{:onchange => 'architecture_selected(this);', :'data-url' => method_path('architecture_selected'), :'data-type' => controller_name.singularize == 'compute_resources_vm' ? 'host' : controller_name.singularize,
{:'data-url' => method_path('architecture_selected'), :'data-type' => controller_name.singularize == 'compute_resources_vm' ? 'host' : controller_name.singularize,
:help_inline => :indicator, :required => true} %>

<span id="os_select">
Expand Down

0 comments on commit 060fdee

Please sign in to comment.