You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by yu...@apache.org on 2013/08/09 19:37:17 UTC
git commit: AMBARI-2855. Show only leaf queues in YARN summary.
(Andrii Babiichuk via yusaku)
Updated Branches:
refs/heads/trunk f9f3e51a9 -> 67ed85b9e
AMBARI-2855. Show only leaf queues in YARN summary. (Andrii Babiichuk via yusaku)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/67ed85b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/67ed85b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/67ed85b9
Branch: refs/heads/trunk
Commit: 67ed85b9e5104f5c4ee1135e7450a08ce16d4d07
Parents: f9f3e51
Author: Yusaku Sako <yu...@hortonworks.com>
Authored: Fri Aug 9 10:37:08 2013 -0700
Committer: Yusaku Sako <yu...@hortonworks.com>
Committed: Fri Aug 9 10:37:08 2013 -0700
----------------------------------------------------------------------
ambari-web/app/utils/object_utils.js | 42 +++++++++++++++++++------------
1 file changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/67ed85b9/ambari-web/app/utils/object_utils.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/object_utils.js b/ambari-web/app/utils/object_utils.js
index f204db9..badfa75 100644
--- a/ambari-web/app/utils/object_utils.js
+++ b/ambari-web/app/utils/object_utils.js
@@ -20,23 +20,34 @@ var stringUtils = require('utils/string_utils');
module.exports = {
+ isChild: function(obj)
+ {
+ for (var k in obj) {
+ if (obj.hasOwnProperty(k)) {
+ if (obj[k] instanceof Object) {
+ return false;
+ }
+ }
+ }
+ return true;
+ },
+
recursiveKeysCount: function(obj) {
if (!(obj instanceof Object)) {
return null;
}
-
+ var self = this;
function r(obj) {
var count = 0;
for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- if (obj[k] instanceof Object) {
- count += 1 + r(obj[k]);
- }
+ if(self.isChild(obj[k])){
+ count++;
+ } else {
+ count += r(obj[k]);
}
}
return count;
}
-
return r(obj);
},
@@ -44,20 +55,19 @@ module.exports = {
if (!(obj instanceof Object)) {
return null;
}
- function r(obj, indx) {
- var str = '';
+ var self = this;
+ function r(obj,parent) {
+ var leaf = '';
for (var k in obj) {
- if (obj.hasOwnProperty(k)) {
- if (obj[k] instanceof Object) {
- var spaces = (new Array(indx + 1).join(' '));
- var bull = (indx != 0 ? '• ' : ' '); // empty for "root" element
- str += spaces + bull + k + '<br />' + r(obj[k], indx + 1);
- }
+ if(self.isChild(obj[k])){
+ leaf += k + ' ('+parent+')' + '<br/>';
+ } else {
+ leaf += r(obj[k],parent +'/' + k);
}
}
- return str;
+ return leaf;
}
- return r(obj, 0);
+ return r(obj,'');
},
/**