Преглед изворни кода

AMBARI-6783. Add service wizard -> Assign Slave and Client page: Change selection/display criteria for headers. (jaimin)

Jaimin Jetly пре 11 година
родитељ
комит
f1273f29d4

+ 22 - 12
ambari-web/app/controllers/wizard/step6_controller.js

@@ -231,19 +231,21 @@ App.WizardStep6Controller = Em.Controller.extend({
             label: serviceComponent.get('displayName'),
             allChecked: false,
             isRequired: serviceComponent.get('isRequired'),
-            noChecked: true
+            noChecked: true,
+            isDisabled: installedServices.someProperty('serviceName',stackService.get('serviceName'))
           }));
         }
       }, this);
     }, this);
-
-    headers.pushObject(Em.Object.create({
-      name: 'CLIENT',
-      label: App.format.role('CLIENT'),
-      allChecked: false,
-      noChecked: true
-    }));
-
+    if (this.get('content.clients') && !!this.get('content.clients').length) {
+      headers.pushObject(Em.Object.create({
+        name: 'CLIENT',
+        label: App.format.role('CLIENT'),
+        allChecked: false,
+        noChecked: true,
+        isDisabled: false
+      }));
+    }
     this.get('headers').pushObjects(headers);
 
     this.render();
@@ -299,7 +301,8 @@ App.WizardStep6Controller = Em.Controller.extend({
           component: header.name,
           title: header.label,
           checked: false,
-          isInstalled: false
+          isInstalled: false,
+          isDisabled: header.get('isDisabled')
         }));
       });
 
@@ -327,6 +330,7 @@ App.WizardStep6Controller = Em.Controller.extend({
    */
   renderSlaves: function (hostsObj) {
     var headers = this.get('headers');
+    var clientHeaders = headers.findProperty('name', 'CLIENT');
     var slaveComponents = this.get('content.slaveComponentHosts');
     if (!slaveComponents) { // we are at this page for the first time
       if (!App.supports.serverRecommendValidate) {
@@ -334,7 +338,9 @@ App.WizardStep6Controller = Em.Controller.extend({
           var checkboxes = host.get('checkboxes');
           checkboxes.setEach('checked', !host.hasMaster);
           checkboxes.setEach('isInstalled', false);
-          checkboxes.findProperty('title', headers.findProperty('name', 'CLIENT').get('label')).set('checked', false);
+          if (clientHeaders) {
+            checkboxes.findProperty('title', clientHeaders.get('label')).set('checked', false);
+          }
         });
         this.selectClientHost(hostsObj);
 
@@ -399,6 +405,10 @@ App.WizardStep6Controller = Em.Controller.extend({
    */
   selectClientHost: function (hostsObj) {
     var headers = this.get('headers');
+    var clientHeaders = headers.findProperty('name', 'CLIENT');
+    if (!clientHeaders) {
+      return;
+    }
     var client_is_set = false;
     hostsObj.forEach(function (host) {
       if (!client_is_set) {
@@ -407,7 +417,7 @@ App.WizardStep6Controller = Em.Controller.extend({
         var checkboxServiceComponent = checkboxes.findProperty('title', headers.findProperty('name', dfsService.get('serviceComponents').
           findProperty('isShownOnInstallerSlaveClientPage').get('componentName')).get('label'));
         if (checkboxServiceComponent && checkboxServiceComponent.get('checked')) {
-          checkboxes.findProperty('title', headers.findProperty('name', 'CLIENT').get('label')).set('checked', true);
+          checkboxes.findProperty('title', clientHeaders.get('label')).set('checked', true);
           client_is_set = true;
         }
       }

+ 2 - 1
ambari-web/app/messages.js

@@ -609,7 +609,8 @@ Em.I18n.translations = {
   'installer.step5.hiveGroup':'HiveServer2, WebHCat Server, MySQL Server',
 
   'installer.step6.header':'Assign Slaves and Clients',
-  'installer.step6.body':'Assign slave and client components to hosts you want to run them on.<br/>Hosts that are assigned master components are shown with <i class=icon-asterisks>&#10037;</i>. <br/>&quot;Client&quot; will install ',
+  'installer.step6.body':'Assign slave and client components to hosts you want to run them on.<br/>Hosts that are assigned master components are shown with <i class=icon-asterisks>&#10037;</i>.',
+  'installer.step6.body.clientText': ' <br/>&quot;Client&quot; will install ',
   'installer.step6.error.mustSelectOne':'You must assign at least one host to each component.',
   'installer.step6.error.mustSelectOneForHost':'You must assign at least one slave/client component to each.',
   'installer.step6.error.mustSelectComponents': 'You must assign at least: {0}',

+ 6 - 0
ambari-web/app/styles/application.less

@@ -798,6 +798,12 @@ h1 {
     }
   }
   #step6 {
+    a.remove-link {
+      text-decoration:none;
+      pointer-events: none;
+      color:black;
+      cursor: default;
+    }
     .pre-scrollable {
       max-height: 440px;
       position: relative;

+ 1 - 1
ambari-web/app/templates/wizard/step6.hbs

@@ -54,7 +54,7 @@
             {{#each checkbox in host.checkboxes}}
               <td>
                 <label class="checkbox">
-                  <input {{bindAttr checked = "checkbox.checked" disabled="checkbox.isInstalled"}} {{action "checkboxClick" checkbox target="view" }}
+                  <input {{bindAttr checked = "checkbox.checked" disabled="checkbox.isDisabled"}} {{action "checkboxClick" checkbox target="view" }}
                           type="checkbox"/>{{checkbox.title}}
                 </label>
               </td>

+ 3 - 3
ambari-web/app/views/wizard/step6_view.js

@@ -65,13 +65,13 @@ App.WizardStep6View = App.TableView.extend({
    * @method setLabel
    */
   setLabel: function () {
-    var label = Em.I18n.t('installer.step6.body');
     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');
+
     clients.forEach(function (_client) {
       if (clients.length === 1) {
         label = label + ' ' + _client.display_name;
-      }
-      else {
+      } else {
         if (_client !== clients[clients.length - 1]) {           // [clients.length - 1]
           label = label + ' ' + _client.display_name;
           if (_client !== clients[clients.length - 2]) {