This is an automated email from the ASF dual-hosted git repository.

jialiang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 26666c7d2e AMBARI-26192: Ambari checkbox issue #3959
26666c7d2e is described below

commit 26666c7d2ed03273aff67c71a753484d7c73e6fd
Author: zrain <[email protected]>
AuthorDate: Fri Mar 21 16:17:30 2025 +0800

    AMBARI-26192: Ambari checkbox issue #3959
---
 .../app/controllers/wizard/step6_controller.js       |  9 ++++++++-
 ambari-web/app/styles/theme/bootstrap-ambari.css     |  5 +++++
 ambari-web/app/templates/wizard/step6.hbs            |  2 +-
 ambari-web/app/views/wizard/step6_view.js            | 20 +++++++++++++-------
 4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/ambari-web/app/controllers/wizard/step6_controller.js 
b/ambari-web/app/controllers/wizard/step6_controller.js
index c17514768c..88e3ea7031 100644
--- a/ambari-web/app/controllers/wizard/step6_controller.js
+++ b/ambari-web/app/controllers/wizard/step6_controller.js
@@ -251,7 +251,14 @@ App.WizardStep6Controller = 
Em.Controller.extend(App.HostComponentValidationMixi
       host.checkboxes.filterProperty('isInstalled', false).forEach(function 
(checkbox) {
         if (checkbox.component === component) {
           if (!checkbox.isDisabled) {
-            Em.set(checkbox, 'checked', checked);
+            var newCheckValue = checked;
+            Em.set(checkbox, 'checked', newCheckValue);
+            Em.run.next(() => {
+              var input = document.getElementById(checkbox.uId);
+              if (input && input.checked !== newCheckValue) {
+                input.checked = newCheckValue;
+              }
+            });
           }
         }
       });
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css 
b/ambari-web/app/styles/theme/bootstrap-ambari.css
index 507d479048..a3b8e2f75f 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -887,6 +887,11 @@ td[data-qa="toggle-component"] input[checked="checked"] + 
label::after,
   font-size: 9px !important;
   background: transparent;
 }
+
+table.host-operation-table td[data-qa="toggle-component"] 
input[checked="checked"] + label::after {
+  position: static !important;
+}
+
 th[data-qa="confirm-hosts-table-heading-cell"] label[checked="checked"]:after {
   top: -11px !important;
 }
diff --git a/ambari-web/app/templates/wizard/step6.hbs 
b/ambari-web/app/templates/wizard/step6.hbs
index e8e851ceb2..72d9216531 100644
--- a/ambari-web/app/templates/wizard/step6.hbs
+++ b/ambari-web/app/templates/wizard/step6.hbs
@@ -52,7 +52,7 @@
 
       <div class="col-sm-12">
         <div class="pre-scrollable">
-          <table class="table table-hover" id="component_assign_table" 
{{QAAttr "slave-clients-table"}}>
+          <table class="table table-hover host-operation-table" 
id="component_assign_table" {{QAAttr "slave-clients-table"}}>
             <thead>
             <tr>
               <th class="host-column freeze">{{t common.host}}</th>
diff --git a/ambari-web/app/views/wizard/step6_view.js 
b/ambari-web/app/views/wizard/step6_view.js
index c3f9d4b8f2..21a5e21e15 100644
--- a/ambari-web/app/views/wizard/step6_view.js
+++ b/ambari-web/app/views/wizard/step6_view.js
@@ -56,7 +56,7 @@ App.WizardStep6View = App.TableView.extend({
     Em.run.next(this, this.adjustColumnWidth);
   },
 
-  adjustColumnWidth: function() {
+  adjustColumnWidth: function () {
     const table = $('#component_assign_table'),
       tableWrapper = $('.pre-scrollable').first(),
       tableCells = table.find('tbody > tr:first-of-type > td');
@@ -65,7 +65,7 @@ App.WizardStep6View = App.TableView.extend({
     if (tableWrapper.width() > cellsWidth) {
       const columnsCount = this.get('controller.headers.length'),
         hostColumnWidth = 210, // from ambari-web/app/styles/wizard.less
-        columnWidth = Math.floor((table.width() - hostColumnWidth)/ 
columnsCount);
+        columnWidth = Math.floor((table.width() - hostColumnWidth) / 
columnsCount);
       table.find("th:not('.freeze'), td:not('.freeze')").width(columnWidth);
       // a trick to keep checkbox abd label on the single line
       table.find('.host-component-checkbox').css({
@@ -89,7 +89,7 @@ App.WizardStep6View = App.TableView.extend({
    */
   setLabel: function () {
     var clients = this.get('controller.content.clients');
-    var label = !!clients.length ? Em.I18n.t('installer.step6.body') +  
Em.I18n.t('installer.step6.body.clientText') : 
Em.I18n.t('installer.step6.body');
+    var label = !!clients.length ? Em.I18n.t('installer.step6.body') + 
Em.I18n.t('installer.step6.body.clientText') : 
Em.I18n.t('installer.step6.body');
 
     clients.forEach(function (_client) {
       if (clients.length === 1) {
@@ -109,9 +109,15 @@ App.WizardStep6View = App.TableView.extend({
     this.set('label', label);
   },
 
-  checkboxClick: function(e) {
-    var checkbox = e.context;
-    Em.set(checkbox, 'checked', !checkbox.checked);
+  checkboxClick: function (e) {
+    var checkbox = e.context, newCheckValue = !checkbox.checked;
+    Em.set(checkbox, 'checked', newCheckValue);
+    Em.run.next(() => {
+      var input = document.getElementById(checkbox.uId);
+      if (input && input.checked !== newCheckValue) {
+        input.checked = newCheckValue;
+      }
+    });
     this.get('controller').checkCallback(checkbox.component);
     this.get('controller').callValidation();
   }
@@ -148,7 +154,7 @@ App.WizardStep6HostView = Em.View.extend({
     });
   },
 
-  willDestroyElement: function() {
+  willDestroyElement: function () {
     this.$().popover('destroy');
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to