Updated Branches:
  refs/heads/trunk 670cd8f1b -> 36ff824e5

AMBARI-3064. Ambari UI widgets should tolerate addition or removal of services. 
(xiwang 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/36ff824e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/36ff824e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/36ff824e

Branch: refs/heads/trunk
Commit: 36ff824e5dbc2ec46800026f5229e783b671029f
Parents: 670cd8f
Author: Yusaku Sako <[email protected]>
Authored: Fri Sep 6 17:44:38 2013 -0700
Committer: Yusaku Sako <[email protected]>
Committed: Fri Sep 6 17:44:38 2013 -0700

----------------------------------------------------------------------
 ambari-web/app/views/main/dashboard.js | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/36ff824e/ambari-web/app/views/main/dashboard.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/dashboard.js 
b/ambari-web/app/views/main/dashboard.js
index f65c2a6..2988d3f 100644
--- a/ambari-web/app/views/main/dashboard.js
+++ b/ambari-web/app/views/main/dashboard.js
@@ -257,13 +257,7 @@ App.MainDashboardView = Em.View.extend({
     var yarnWidgets = ['24', '25', '26', '27'];
 
     // check if cur_value has mapReduce
-    var curhasMapreduce = false;
-    for (var j = 0; j <= visible.length -1; j++) {
-      if (visible[j] == mapWidgets[0]) {
-        curhasMapreduce = true;
-        break;
-      }
-    }
+    var curhasMapreduce = visible.contains ( mapWidgets[0]);
     for (var j = 0; j <= hidden.length -1; j++) {
       if ( !curhasMapreduce && hidden[j][0] == mapWidgets[0]) {
         curhasMapreduce = true;
@@ -274,11 +268,7 @@ App.MainDashboardView = Em.View.extend({
     if ( this.get('yarn_model') != null && curhasMapreduce) {
       // Remove all Mapreduce widgets and add Yarn widgets as visible
       mapWidgets.forEach ( function (item) {
-        for (var j = 0; j <= visible.length -1; j++) {
-          if (visible[j] == item) {
-            visible.splice(j, 1);
-          }
-        }
+        visible = visible.without(item);
         for (var j = 0; j <= hidden.length -1; j++) {
           if (hidden[j][0] == item) {
             hidden.splice(j, 1);

Reply via email to