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

ambari git commit: AMBARI-17882. Add new macros for collections (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 17ad59dbb -> d4cec42ee


AMBARI-17882. Add new macros for collections (onechiporenko)


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

Branch: refs/heads/branch-2.5
Commit: d4cec42ee9e9e8b139cf89a4746e0147950940db
Parents: 17ad59d
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Mon Jul 25 14:56:10 2016 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Sep 14 14:24:02 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/utils/ember_computed.js          | 125 +++++++++++++
 ambari-web/test/aliases/computed/everyByKey.js  |  91 ++++++++++
 ambari-web/test/aliases/computed/filterByKey.js |  74 ++++++++
 ambari-web/test/aliases/computed/findByKey.js   |  73 ++++++++
 ambari-web/test/aliases/computed/someByKey.js   |  96 ++++++++++
 .../step7/assign_master_controller_test.js      |   2 +-
 ambari-web/test/init_computed_aliases.js        |   4 +
 ambari-web/test/utils/ember_computed_test.js    | 175 +++++++++++++++++++
 8 files changed, 639 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/app/utils/ember_computed.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ember_computed.js b/ambari-web/app/utils/ember_computed.js
index a49ba68..08be4e5 100644
--- a/ambari-web/app/utils/ember_computed.js
+++ b/ambari-web/app/utils/ember_computed.js
@@ -652,6 +652,37 @@ computed.someBy = function (collectionKey, propertyName, neededValue) {
 };
 
 /**
+ * A computed property that returns true of some collection's item has property with needed value
+ * Needed value is stored in the another property
+ * <pre>
+ * var o = Em.Object.create({
+ *  p1: [{a: 1}, {a: 2}, {a: 3}],
+ *  p2: Em.computed.someByKey('p1', 'a', 'v1'),
+ *  v1: 1
+ * });
+ * console.log(o.get('p2')); // true
+ * o.set('p1.0.a', 2);
+ * console.log(o.get('p2')); // false
+ * </pre>
+ *
+ * @method someByKey
+ * @param {string} collectionKey
+ * @param {string} propertyName
+ * @param {string} neededValueKey
+ * @returns {Ember.ComputedProperty}
+ */
+computed.someByKey = function (collectionKey, propertyName, neededValueKey) {
+  return computed(collectionKey + '.@each.' + propertyName, neededValueKey, function () {
+    var collection = smartGet(this, collectionKey);
+    if (!collection) {
+      return false;
+    }
+    var neededValue = smartGet(this, neededValueKey);
+    return collection.someProperty(propertyName, neededValue);
+  });
+};
+
+/**
  * A computed property that returns true of all collection's items have property with needed value
  * <pre>
  * var o = Em.Object.create({
@@ -680,6 +711,37 @@ computed.everyBy = function (collectionKey, propertyName, neededValue) {
 };
 
 /**
+ * A computed property that returns true of all collection's items have property with needed value
+ * Needed value is stored in the another property
+ * <pre>
+ * var o = Em.Object.create({
+ *  p1: [{a: 1}, {a: 1}, {a: 1}],
+ *  p2: Em.computed.everyByKey('p1', 'a', 'v1'),
+ *  v1: 1
+ * });
+ * console.log(o.get('p2')); // true
+ * o.set('p1.0.a', 2);
+ * console.log(o.get('p2')); // false
+ * </pre>
+ *
+ * @method everyByKey
+ * @param {string} collectionKey
+ * @param {string} propertyName
+ * @param {string} neededValueKey
+ * @returns {Ember.ComputedProperty}
+ */
+computed.everyByKey = function (collectionKey, propertyName, neededValueKey) {
+  return computed(collectionKey + '.@each.' + propertyName, neededValueKey, function () {
+    var collection = smartGet(this, collectionKey);
+    if (!collection) {
+      return false;
+    }
+    var neededValue = smartGet(this, neededValueKey);
+    return collection.everyProperty(propertyName, neededValue);
+  });
+};
+
+/**
  * A computed property that returns array with values of named property on all items in the collection
  * <pre>
  * var o = Em.Object.create({
@@ -735,6 +797,38 @@ computed.filterBy = function (collectionKey, propertyName, neededValue) {
 };
 
 /**
+ * A computed property that returns array with collection's items that have needed property value
+ * Needed value is stored in the another property
+ *
+ * <pre>
+ * var o = Em.Object.create({
+ *  p1: [{a: 1}, {a: 2}, {a: 3}],
+ *  p2: Em.computed.filterByKey('p1', 'a', 'v1'),
+ *  v1: 2
+ * });
+ * console.log(o.get('p2')); // [{a: 2}]
+ * o.set('p1.0.a', 2);
+ * console.log(o.get('p2')); // [{a: 2}, {a: 2}]
+ * </pre>
+ *
+ * @method filterByKey
+ * @param {string} collectionKey
+ * @param {string} propertyName
+ * @param {string} neededValueKey
+ * @returns {Ember.ComputedProperty}
+ */
+computed.filterByKey = function (collectionKey, propertyName, neededValueKey) {
+  return computed(collectionKey + '.@each.' + propertyName, neededValueKey, function () {
+    var collection = smartGet(this, collectionKey);
+    if (!collection) {
+      return [];
+    }
+    var neededValue = smartGet(this, neededValueKey);
+    return collection.filterProperty(propertyName, neededValue);
+  });
+};
+
+/**
  * A computed property that returns first collection's item that has needed property value
  * <pre>
  * var o = Em.Object.create({
@@ -763,6 +857,37 @@ computed.findBy = function (collectionKey, propertyName, neededValue) {
 };
 
 /**
+ * A computed property that returns first collection's item that has needed property value
+ * Needed value is stored in the another property
+ * <pre>
+ * var o = Em.Object.create({
+ *  p1: [{a: 1, b: 1}, {a: 2, b: 2}, {a: 3, b: 3}],
+ *  p2: Em.computed.findByKey('p1', 'a', 'v1'),
+ *  v1: 2
+ * });
+ * console.log(o.get('p2')); // [{a: 2, b: 2}]
+ * o.set('p1.0.a', 2);
+ * console.log(o.get('p2')); // [{a: 2, b: 1}]
+ * </pre>
+ *
+ * @method findByKey
+ * @param {string} collectionKey
+ * @param {string} propertyName
+ * @param {string} neededValueKey
+ * @returns {Ember.ComputedProperty}
+ */
+computed.findByKey = function (collectionKey, propertyName, neededValueKey) {
+  return computed(collectionKey + '.@each.' + propertyName, neededValueKey, function () {
+    var collection = smartGet(this, collectionKey);
+    if (!collection) {
+      return null;
+    }
+    var neededValue = smartGet(this, neededValueKey);
+    return collection.findProperty(propertyName, neededValue);
+  });
+};
+
+/**
  * A computed property that returns value equal to the dependent
  * Should be used as 'short-name' for deeply-nested values
  * App.*-keys are supported

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/aliases/computed/everyByKey.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/everyByKey.js b/ambari-web/test/aliases/computed/everyByKey.js
new file mode 100644
index 0000000..a877e61
--- /dev/null
+++ b/ambari-web/test/aliases/computed/everyByKey.js
@@ -0,0 +1,91 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var helpers = App.TestAliases.helpers;
+
+/**
+ *
+ * @param {Em.Object} context
+ * @param {string} propertyName
+ * @param {string} collectionName
+ * @param {string} keyName
+ * @param {string} neededValueKey
+ */
+App.TestAliases.testAsComputedEveryByKey = function (context, propertyName, collectionName, keyName, neededValueKey) {
+
+  describe('#' + propertyName + ' as Em.computed.everyByKey', function () {
+
+    afterEach(function () {
+      helpers.smartRestoreGet(context);
+    });
+
+    it('has valid dependent keys', function () {
+      expect(Em.meta(context).descs[propertyName]._dependentKeys).to.eql([collectionName + '.@each.' + keyName, neededValueKey]);
+    });
+
+    it('should be `true` if ' + JSON.stringify(collectionName) + ' is empty', function () {
+      helpers.smartStubGet(context, collectionName, [])
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.true;
+    });
+
+    it('should be `false` if ' + JSON.stringify(collectionName) + ' does not exist', function () {
+      helpers.smartStubGet(context, collectionName, null)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `false` if no one object in the ' + JSON.stringify(collectionName) + ' does not have ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.setEach(keyName, !neededValue); // something that not equal to the `neededValue`
+      helpers.smartStubGet(context, {collectionName: collection, neededValueKey: neededValue})
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `false` if at least one object in the ' + JSON.stringify(collectionName) + ' does not have ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.setEach(keyName, neededValue);
+      collection[1][keyName] = !neededValue;
+      helpers.smartStubGet(context, {collectionName: collection, neededValueKey: neededValue})
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `true` if all objects in the ' + JSON.stringify(collectionName) + ' have ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.setEach(keyName, neededValue);
+      var hash = {};
+      hash[collectionName] = collection;
+      hash[neededValueKey] = neededValue;
+      helpers.smartStubGet(context, hash)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.true;
+    });
+
+  });
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/aliases/computed/filterByKey.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/filterByKey.js b/ambari-web/test/aliases/computed/filterByKey.js
new file mode 100644
index 0000000..a5d0476
--- /dev/null
+++ b/ambari-web/test/aliases/computed/filterByKey.js
@@ -0,0 +1,74 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var helpers = App.TestAliases.helpers;
+
+/**
+ *
+ * @param {Em.Object} context
+ * @param {string} propertyName
+ * @param {string} collectionName
+ * @param {string} keyName
+ * @param {string} neededValueKey
+ */
+App.TestAliases.testAsComputedFilterByKey = function (context, propertyName, collectionName, keyName, neededValueKey) {
+
+  describe('#' + propertyName + ' as Em.computed.filterByKey', function () {
+
+    afterEach(function () {
+      helpers.smartRestoreGet(context);
+    });
+
+    it('has valid dependent keys', function () {
+      expect(Em.meta(context).descs[propertyName]._dependentKeys).to.eql([collectionName + '.@each.' + keyName, neededValueKey]);
+    });
+
+    it('should be `[]` if ' + JSON.stringify(collectionName) + ' is empty', function () {
+      helpers.smartStubGet(context, collectionName, [])
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.eql([]);
+    });
+
+    it('should be `[]` if ' + JSON.stringify(collectionName) + ' does not exist', function () {
+      helpers.smartStubGet(context, collectionName, null)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.eql([]);
+    });
+
+    it('should be an array objects from  ' + JSON.stringify(collectionName) + ' with ' + JSON.stringify(keyName) + ' equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.forEach(function (item) {
+        Ember.setFullPath(item, keyName, neededValue);
+      });
+
+      Em.set(collection[2], keyName, !neededValue);
+      var hash = {};
+      hash[collectionName] = collection;
+      hash[neededValueKey] = neededValue;
+      helpers.smartStubGet(context, hash)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.eql(collection.slice(0, 2));
+    });
+
+  });
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/aliases/computed/findByKey.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/findByKey.js b/ambari-web/test/aliases/computed/findByKey.js
new file mode 100644
index 0000000..85b71a2
--- /dev/null
+++ b/ambari-web/test/aliases/computed/findByKey.js
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var helpers = App.TestAliases.helpers;
+
+/**
+ *
+ * @param {Em.Object} context
+ * @param {string} propertyName
+ * @param {string} collectionName
+ * @param {string} keyName
+ * @param {string} neededValueKey
+ */
+App.TestAliases.testAsComputedFindByKey = function (context, propertyName, collectionName, keyName, neededValueKey) {
+
+  describe('#' + propertyName + ' as Em.computed.findByKey', function () {
+
+    afterEach(function () {
+      helpers.smartRestoreGet(context);
+    });
+
+    it('has valid dependent keys', function () {
+      expect(Em.meta(context).descs[propertyName]._dependentKeys).to.eql([collectionName + '.@each.' + keyName, neededValueKey]);
+    });
+
+    it('should be `undefined` if ' + JSON.stringify(collectionName) + ' is empty', function () {
+      helpers.smartStubGet(context, collectionName, [])
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.undefined;
+    });
+
+    it('should be `null` if ' + JSON.stringify(collectionName) + ' does not exist', function () {
+      helpers.smartStubGet(context, collectionName, null)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.null;
+    });
+
+    it('should be a first object from ' + JSON.stringify(collectionName) + ' with ' + JSON.stringify(keyName) + ' equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{i: 0}, {i: 1}, {i: 2}];
+      var neededValue = Math.random();
+      collection.forEach(function (item) {
+        Ember.setFullPath(item, keyName, neededValue)
+      });
+      Em.set(collection[2], keyName, !neededValue);
+      var hash = {};
+      hash[collectionName] = collection;
+      hash[neededValueKey] = neededValue;
+      helpers.smartStubGet(context, hash)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.eql(collection[0]);
+    });
+
+  });
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/aliases/computed/someByKey.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/someByKey.js b/ambari-web/test/aliases/computed/someByKey.js
new file mode 100644
index 0000000..4474dee
--- /dev/null
+++ b/ambari-web/test/aliases/computed/someByKey.js
@@ -0,0 +1,96 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var helpers = App.TestAliases.helpers;
+
+/**
+ *
+ * @param {Em.Object} context
+ * @param {string} propertyName
+ * @param {string} collectionName
+ * @param {string} keyName
+ * @param {string} neededValueKey
+ */
+App.TestAliases.testAsComputedSomeByKey = function (context, propertyName, collectionName, keyName, neededValueKey) {
+
+  describe('#' + propertyName + ' as Em.computed.someByKey', function () {
+
+    afterEach(function () {
+      helpers.smartRestoreGet(context);
+    });
+
+    it('has valid dependent keys', function () {
+      expect(Em.meta(context).descs[propertyName]._dependentKeys).to.eql([collectionName + '.@each.' + keyName, neededValueKey]);
+    });
+
+    it('should be `false` if ' + JSON.stringify(collectionName) + ' is empty', function () {
+      helpers.smartStubGet(context, collectionName, [])
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `false` if ' + JSON.stringify(collectionName) + ' does not exist', function () {
+      helpers.smartStubGet(context, collectionName, null)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `false` if no one object in the ' + JSON.stringify(collectionName) + ' does not have ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.setEach(keyName, !neededValue); // something that not equal to the `neededValue`
+      helpers.smartStubGet(context, {collectionName: collection, neededValueKey: neededValue})
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.false;
+    });
+
+    it('should be `true` if at least one object in the ' + JSON.stringify(collectionName) + ' has ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.setEach(keyName, !neededValue);
+      collection.forEach(function (item) {
+        Em.setFullPath(item, keyName, !neededValue);
+      });
+      Em.set(collection[1], keyName, neededValue);
+      helpers.smartStubGet(context, {collectionName: collection, neededValueKey: neededValue})
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.true;
+    });
+
+    it('should be `true` if all objects in the ' + JSON.stringify(collectionName) + ' have ' + JSON.stringify(keyName) + ' with value equal to the value in ' + JSON.stringify(neededValueKey), function () {
+      var collection = [{}, {}, {}];
+      var neededValue = Math.random();
+      collection.forEach(function (item) {
+        Em.setFullPath(item, keyName, neededValue);
+      });
+      var hash = {};
+      hash[collectionName] = collection;
+      hash[neededValueKey] = neededValue;
+      helpers.smartStubGet(context, hash)
+        .propertyDidChange(context, propertyName);
+      var value = helpers.smartGet(context, propertyName);
+      expect(value).to.be.true;
+    });
+
+  });
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js
index f1f6487..053b900 100644
--- a/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js
+++ b/ambari-web/test/controllers/wizard/step7/assign_master_controller_test.js
@@ -411,7 +411,7 @@ describe('App.AssignMasterOnStep7Controller', function () {
       expect(config.get('recommendedValue')).to.be.equal('host1');
     });
 
-    it("config should be set", function() {
+    it("config should be set (loadConfigRecommendations is called once)", function() {
       expect(mock.loadConfigRecommendations.calledOnce).to.be.true;
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/init_computed_aliases.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_computed_aliases.js b/ambari-web/test/init_computed_aliases.js
index 35188b7..44faf4f 100644
--- a/ambari-web/test/init_computed_aliases.js
+++ b/ambari-web/test/init_computed_aliases.js
@@ -186,10 +186,14 @@ require('test/aliases/computed/lt');
 require('test/aliases/computed/lteProperties');
 require('test/aliases/computed/ltProperties');
 require('test/aliases/computed/someBy');
+require('test/aliases/computed/someByKey');
 require('test/aliases/computed/everyBy');
+require('test/aliases/computed/everyByKey');
 require('test/aliases/computed/mapBy');
 require('test/aliases/computed/filterBy');
+require('test/aliases/computed/filterByKey');
 require('test/aliases/computed/findBy');
+require('test/aliases/computed/findByKey');
 require('test/aliases/computed/sumBy');
 require('test/aliases/computed/and');
 require('test/aliases/computed/or');

http://git-wip-us.apache.org/repos/asf/ambari/blob/d4cec42e/ambari-web/test/utils/ember_computed_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/ember_computed_test.js b/ambari-web/test/utils/ember_computed_test.js
index f01c0c7..829f2e2 100644
--- a/ambari-web/test/utils/ember_computed_test.js
+++ b/ambari-web/test/utils/ember_computed_test.js
@@ -841,6 +841,50 @@ describe('Ember.computed macros', function () {
 
   });
 
+  describe('#someByKey', function () {
+
+    beforeEach(function () {
+      App.setProperties({
+        someAnotherKey: 2
+      });
+      this.obj = Em.Object.create({
+        prop1: [{a: 1}, {a: 2}, {a: 3}],
+        prop2: Em.computed.someByKey('prop1', 'a', 'value1'),
+        prop3: Em.computed.someByKey('prop1', 'a', 'App.someRandomTestingKey'),
+        value1: 2
+      });
+    });
+
+    it('`true` if some collection item has needed property value', function () {
+      expect(this.obj.get('prop2')).to.be.true;
+    });
+
+    it('`false` if on one collection item doesn\'t have needed property value', function () {
+      this.obj.set('prop1.1.a', 3);
+      expect(this.obj.get('prop2')).to.be.false;
+    });
+
+    it('`false` for null/undefined collection', function () {
+      this.obj.set('prop1', null);
+      expect(this.obj.get('prop2')).to.be.false;
+    });
+
+    it('`prop2` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop2._dependentKeys).to.eql(['prop1.@each.a', 'value1']);
+    });
+
+    it('`prop3` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop3._dependentKeys).to.eql(['prop1.@each.a', 'App.someRandomTestingKey']);
+    });
+
+    it('`prop3` depends on App.* key', function () {
+      expect(this.obj.get('prop3')).to.be.true;
+      this.obj.set('prop1.1.a', 3);
+      expect(this.obj.get('prop3')).to.be.false;
+    });
+
+  });
+
   describe('#everyBy', function () {
 
     beforeEach(function () {
@@ -870,6 +914,49 @@ describe('Ember.computed macros', function () {
 
   });
 
+  describe('#everyByKey', function () {
+    beforeEach(function () {
+      App.setProperties({
+        someAnotherKey: 2
+      });
+      this.obj = Em.Object.create({
+        prop1: [{a: 2}, {a: 2}, {a: 2}],
+        prop2: Em.computed.everyByKey('prop1', 'a', 'value1'),
+        prop3: Em.computed.everyByKey('prop1', 'a', 'App.someRandomTestingKey'),
+        value1: 2
+      });
+    });
+
+    it('`true` if all collection items have needed property value', function () {
+      expect(this.obj.get('prop2')).to.be.true;
+    });
+
+    it('`false` if at least one collection item doesn\'t have needed property value', function () {
+      this.obj.set('prop1.1.a', 3);
+      expect(this.obj.get('prop2')).to.be.false;
+    });
+
+    it('`false` for null/undefined collection', function () {
+      this.obj.set('prop1', null);
+      expect(this.obj.get('prop2')).to.be.false;
+    });
+
+    it('`prop2` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop2._dependentKeys).to.eql(['prop1.@each.a', 'value1']);
+    });
+
+    it('`prop3` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop3._dependentKeys).to.eql(['prop1.@each.a', 'App.someRandomTestingKey']);
+    });
+
+    it('`prop3` depends on App.* key', function () {
+      expect(this.obj.get('prop3')).to.be.true;
+      this.obj.set('prop1.1.a', 3);
+      expect(this.obj.get('prop3')).to.be.false;
+    });
+
+  });
+
   describe('#mapBy', function () {
 
     beforeEach(function () {
@@ -928,6 +1015,50 @@ describe('Ember.computed macros', function () {
 
   });
 
+  describe('#filterByKey', function () {
+
+    beforeEach(function () {
+      App.setProperties({
+        someAnotherKey: 2
+      });
+      this.obj = Em.Object.create({
+        prop1: [{a: 2}, {a: 2}, {a: 3}],
+        prop2: Em.computed.filterByKey('prop1', 'a', 'value1'),
+        prop3: Em.computed.filterByKey('prop1', 'a', 'App.someRandomTestingKey'),
+        value1: 2
+      });
+    });
+
+    it('should filter dependent property', function () {
+      expect(this.obj.get('prop2')).to.eql([{a: 2}, {a: 2}]);
+    });
+
+    it('should filter dependent property (2)', function () {
+      this.obj.get('prop1').pushObject({a: 2});
+      expect(this.obj.get('prop2')).to.eql([{a: 2}, {a: 2}, {a: 2}]);
+    });
+
+    it('`[]` for null/undefined collection', function () {
+      this.obj.set('prop1', null);
+      expect(this.obj.get('prop2')).to.eql([]);
+    });
+
+    it('`prop2` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop2._dependentKeys).to.eql(['prop1.@each.a', 'value1']);
+    });
+
+    it('`prop3` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop3._dependentKeys).to.eql(['prop1.@each.a', 'App.someRandomTestingKey']);
+    });
+
+    it('`prop3` depends on App.* key', function () {
+      expect(this.obj.get('prop3')).to.eql([{a: 2}, {a: 2}]);
+      this.obj.set('prop1.1.a', 3);
+      expect(this.obj.get('prop3')).to.eql([{a: 2}]);
+    });
+
+  });
+
   describe('#findBy', function () {
 
     beforeEach(function () {
@@ -957,6 +1088,50 @@ describe('Ember.computed macros', function () {
 
   });
 
+  describe('#findByKey', function () {
+
+    beforeEach(function () {
+      App.setProperties({
+        someAnotherKey: 2
+      });
+      this.obj = Em.Object.create({
+        prop1: [{b: 1, a: 2}, {b: 2, a: 2}, {a: 3}],
+        prop2: Em.computed.findByKey('prop1', 'a', 'value1'),
+        prop3: Em.computed.findByKey('prop1', 'a', 'App.someRandomTestingKey'),
+        value1: 2
+      });
+    });
+
+    it('should filter dependent property', function () {
+      expect(this.obj.get('prop2')).to.eql({b:1, a: 2});
+    });
+
+    it('should filter dependent property (2)', function () {
+      this.obj.get('prop1').pushObject({b: 3, a: 2});
+      expect(this.obj.get('prop2')).to.eql({b: 1, a: 2});
+    });
+
+    it('`null` for null/undefined collection', function () {
+      this.obj.set('prop1', null);
+      expect(this.obj.get('prop2')).to.be.null;
+    });
+
+    it('`prop2` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop2._dependentKeys).to.eql(['prop1.@each.a', 'value1']);
+    });
+
+    it('`prop3` has valid dependent keys', function () {
+      expect(Em.meta(this.obj).descs.prop3._dependentKeys).to.eql(['prop1.@each.a', 'App.someRandomTestingKey']);
+    });
+
+    it('`prop3` depends on App.* key', function () {
+      expect(this.obj.get('prop3')).to.eql({b: 1, a: 2});
+      this.obj.get('prop1').pushObject({b: 3, a: 2});
+      expect(this.obj.get('prop3')).to.eql({b: 1, a: 2});
+    });
+
+  });
+
   describe('#alias', function() {
 
     beforeEach(function () {