You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2016/12/09 21:57:07 UTC

[15/51] [abbrv] ambari git commit: AMBARI-19041 Choose services page select/deselect all services not working while adding smartsense to the cluster. (ababiichuk)

AMBARI-19041 Choose services page select/deselect all services not working while adding smartsense to the cluster. (ababiichuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59f520b8
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59f520b8
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59f520b8

Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 59f520b85df153616cc2010b23542311e59b50cb
Parents: 1238674
Author: ababiichuk <ab...@hortonworks.com>
Authored: Thu Dec 8 15:40:46 2016 +0200
Committer: ababiichuk <ab...@hortonworks.com>
Committed: Thu Dec 8 15:50:37 2016 +0200

----------------------------------------------------------------------
 ambari-web/app/models/stack_service.js       |  4 +-
 ambari-web/test/models/stack_service_test.js | 71 ++++++++++++++++++++++-
 2 files changed, 73 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/59f520b8/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 0136ec3..f824b6a 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -46,7 +46,9 @@ App.StackService = DS.Model.extend({
   configs: DS.attr('array'),
   requiredServices: DS.attr('array', {defaultValue: []}),
 
-  isDisabled: Em.computed.or('isMandatory', 'isInstalled'),
+  isDisabled: function () {
+    return this.get('isInstalled') || (this.get('isMandatory') && !App.get('router.clusterInstallCompleted'));
+  }.property('isMandatory', 'isInstalled', 'App.router.clusterInstallCompleted'),
 
   /**
    * @type {String[]}

http://git-wip-us.apache.org/repos/asf/ambari/blob/59f520b8/ambari-web/test/models/stack_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_service_test.js b/ambari-web/test/models/stack_service_test.js
index 9f12e88..bc101e0 100644
--- a/ambari-web/test/models/stack_service_test.js
+++ b/ambari-web/test/models/stack_service_test.js
@@ -283,7 +283,76 @@ describe('App.StackService', function () {
     });
   });
 
-  App.TestAliases.testAsComputedOr(ss, 'isDisabled', ['isMandatory', 'isInstalled']);
+  describe('#isDisabled', function () {
+
+    var cases = [
+      {
+        isInstalled: true,
+        isMandatory: true,
+        clusterInstallCompleted: true,
+        isDisabled: true
+      },
+      {
+        isInstalled: true,
+        isMandatory: true,
+        clusterInstallCompleted: false,
+        isDisabled: true
+      },
+      {
+        isInstalled: true,
+        isMandatory: false,
+        clusterInstallCompleted: true,
+        isDisabled: true
+      },
+      {
+        isInstalled: true,
+        isMandatory: false,
+        clusterInstallCompleted: false,
+        isDisabled: true
+      },
+      {
+        isInstalled: false,
+        isMandatory: true,
+        clusterInstallCompleted: true,
+        isDisabled: false
+      },
+      {
+        isInstalled: false,
+        isMandatory: true,
+        clusterInstallCompleted: false,
+        isDisabled: true
+      },
+      {
+        isInstalled: false,
+        isMandatory: false,
+        clusterInstallCompleted: true,
+        isDisabled: false
+      },
+      {
+        isInstalled: false,
+        isMandatory: false,
+        clusterInstallCompleted: false,
+        isDisabled: false
+      }
+    ];
+
+    cases.forEach(function (testCase) {
+
+      var title = 'isInstalled: {0}, isMandatory: {1}, clusterInstallCompleted: {2}, isDisabled: {3}'
+        .format(testCase.isInstalled, testCase.isMandatory, testCase.clusterInstallCompleted, testCase.isDisabled);
+
+      it(title, function () {
+        ss.setProperties({
+          isInstalled: testCase.isInstalled,
+          isMandatory: testCase.isMandatory
+        });
+        App.set('router.clusterInstallCompleted', testCase.clusterInstallCompleted);
+        expect(ss.get('isDisabled')).to.equal(testCase.isDisabled);
+      });
+
+    });
+
+  });
 
 
 });