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 2012/10/18 02:26:50 UTC

svn commit: r1399490 - in /incubator/ambari/branches/AMBARI-666: ./ ambari-web/app/controllers/installer/ ambari-web/app/routes/ ambari-web/app/styles/ ambari-web/app/templates/installer/ ambari-web/app/views/installer/

Author: yusaku
Date: Thu Oct 18 00:26:50 2012
New Revision: 1399490

URL: http://svn.apache.org/viewvc?rev=1399490&view=rev
Log:
AMBARI-882. Group-based DataNode/TaskTracker/RegionServer overrides. (yusaku)

Added:
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/slave_group_hosts.hbs
Modified:
    incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
    incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
    incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
    incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step7.hbs
    incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js

Modified: incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt (original)
+++ incubator/ambari/branches/AMBARI-666/AMBARI-666-CHANGES.txt Thu Oct 18 00:26:50 2012
@@ -12,6 +12,9 @@ AMBARI-666 branch (unreleased changes)
 
   NEW FEATURES
 
+  AMBARI-882. Group-based DataNode/TaskTracker/RegionServer overrides.
+  (yusaku)
+
   AMBARI-881. Implement Add Hosts Wizard. (yusaku)
 
   AMBARI-869. Util to deserialize ExecutionCommand. (jitendra)

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/controllers/installer/step7_controller.js Thu Oct 18 00:26:50 2012
@@ -187,8 +187,6 @@ App.SlaveComponentGroupsController = Emb
 
   contentBinding: 'App.router.installerStep7Controller.slaveComponentHosts',
 
-  slaveComponentGroups: [],
-
   selectedComponentName: function () {
     switch (App.router.get('installerStep7Controller.selectedService.serviceName')) {
       case 'HDFS':
@@ -203,6 +201,11 @@ App.SlaveComponentGroupsController = Emb
 
   }.property('App.router.installerStep7Controller.selectedService'),
 
+  selectedSlaveComponent: function () {
+    var component = this.findProperty('componentName', this.get('selectedComponentName'));
+    return component;
+  }.property('selectedComponentName'),
+
   showAddSlaveComponentGroup: function (event) {
     var componentName = event.context;
     App.ModalPopup.show({
@@ -219,17 +222,18 @@ App.SlaveComponentGroupsController = Emb
   addSlaveComponentGroup: function (event) {
     var componentName = event.context;
     var component = this.findProperty('componentName', componentName);
-    var slaveGroups = this.get('slaveComponentGroups');
     var newGroupName;
-    console.log(slaveGroups);
-    slaveGroups.forEach(function(group) {
-
-    });
-    var newGroup = {
-      groupName: "New Group"
-    };
-    slaveGroups.pushObject(newGroup);
-    console.log(slaveGroups);
+    component.groups.setEach('active', false);
+    var newGroups = component.groups.filterProperty('type', 'new');
+    if (newGroups.length === 0) {
+      component.newGroupIndex = 0;
+      newGroupName = 'New Group';
+    } else {
+      component.newGroupIndex++;
+      newGroupName = 'New Group ' + component.newGroupIndex;
+    }
+    var newGroup = {groupName: newGroupName, label: 'new_group_' + component.newGroupIndex, type: 'new', active: true};
+    component.groups.pushObject(newGroup);
   },
 
   showEditSlaveComponentGroups: function (event) {
@@ -254,16 +258,38 @@ App.SlaveComponentGroupsController = Emb
     }
   }.property('@each.hosts', 'selectedComponentName'),
 
-  getHostsGroups: function () {
-    var slaveGroups = this.get('slaveComponentGroups');
-    if (slaveGroups.length == 0){
-      var defaultGroup = {
-        groupName: "Default",
-        label: "default"
-      };
-      slaveGroups.pushObject(defaultGroup);
+  getGroups: function () {
+    if (this.get('selectedComponentName') !== null) {
+      var component = this.findProperty('componentName', this.get('selectedComponentName'));
+      if (component !== undefined && component !== null) {
+        if (component.groups === undefined){
+          component.groups = [];
+          var defaultGroup = {groupName: 'Default', label: 'default', type: 'default', active: true};
+          component.groups.pushObject(defaultGroup);
+        }
+        return component.groups;
+      }
     }
-    return slaveGroups;
-  }.property('slaveComponentGroups')
+  }.property('selectedComponentName'),
+
+  showSlaveComponentGroup: function(event){
+    var component = this.findProperty('componentName', this.get('selectedComponentName'));
+    component.groups.setEach('active', false);
+    var group = component.groups.filterProperty('groupName', event.context.groupName);
+    group.setEach('active', true);
+  },
+
+  removeSlaveComponentGroup: function(event){
+    var component = this.findProperty('componentName', this.get('selectedComponentName'));
+    component.groups.setEach('active', false);
+//    component.groups.forEach(function (group) {
+//      if(group.groupName == event.context.groupName)
+//        delete component.groups[i];
+//    }, this);
+
+    var group = component.groups.filterProperty('groupName', event.context.groupName);
+    component.groups.removeObjects(group);
+    group.setEach('active', true);
+  }
 
 });

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/routes/installer.js Thu Oct 18 00:26:50 2012
@@ -160,14 +160,6 @@ module.exports = Em.Route.extend({
     },
     back: Em.Router.transitionTo('step6'),
     next: Em.Router.transitionTo('step8')
-//    showSlaveComponentGroup:Em.Router.transitionTo('slaveComponentGroup'),
-//    slaveComponentGroup:Em.Route.extend({
-//      route:'/',
-//      connectOutlets:function (router, group) {
-//        router.get('installerController').connectOutlet('slaveComponentGroup', group);
-//      }
-//    })
-
   }),
 
   step8: Em.Route.extend({

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/styles/application.less Thu Oct 18 00:26:50 2012
@@ -227,6 +227,12 @@ h1 {
     .add-slave-component-group {
       margin-bottom: 20px;
     }
+    .slave-group {
+      display: none;
+    }
+    .slave-group.active {
+      display: block;
+    }
     .master-host, .master-hosts, .slave-hosts {
       padding-top: 5px;
       line-height: 20px;

Added: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/slave_group_hosts.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/slave_group_hosts.hbs?rev=1399490&view=auto
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/slave_group_hosts.hbs (added)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/slave_group_hosts.hbs Thu Oct 18 00:26:50 2012
@@ -0,0 +1 @@
+{{view.content.groupName}}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step7.hbs
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step7.hbs?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step7.hbs (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/templates/installer/step7.hbs Thu Oct 18 00:26:50 2012
@@ -51,6 +51,11 @@
             class="btn add-slave-component-group btn-large" {{action addSlaveComponentGroup category.name target="App.router.slaveComponentGroupsController"}}><i
             class="icon-plus"></i></a>
           {{/view}}
+          {{#each group in App.router.slaveComponentGroupsController.getGroups}}
+            {{#view App.SlaveComponentGroupView contentBinding="group" }}
+              {{group.groupName}}
+            {{/view}}
+          {{/each}}
           {{/if}}
           <form class="form-horizontal">
             {{#each view.categoryConfigs}}

Modified: incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js
URL: http://svn.apache.org/viewvc/incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js?rev=1399490&r1=1399489&r2=1399490&view=diff
==============================================================================
--- incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js (original)
+++ incubator/ambari/branches/AMBARI-666/ambari-web/app/views/installer/step7_view.js Thu Oct 18 00:26:50 2012
@@ -237,26 +237,22 @@ App.AddSlaveComponentGroupButton = Ember
 
 App.SlaveComponentGroupsMenu = Em.CollectionView.extend({
 
-  contentBinding: 'App.router.slaveComponentGroupsController.getHostsGroups',
-
-  init: function(){ this._super(); this.activateView(); },
-
+  contentBinding: 'App.router.slaveComponentGroupsController.getGroups',
   tagName:'ul',
   classNames: ["nav", "nav-tabs"],
 
-  activateView:function () {
-    $.each(this._childViews, function () {
-      this.set('active', (this.get('content.label') == 'default' ? "active" : ""));
-    });
-  },
-
   itemViewClass:Em.View.extend({
     classNameBindings:["active"],
-    active:"",
-    template:Ember.Handlebars.compile('<a {{action showSlaveGroup view.content}} href="#"> {{unbound view.content.groupName}}</a>')  })
-
+    active:function(){
+      return this.get('content.active');
+    }.property('content.active'),
+    template:Ember.Handlebars.compile('<a {{action showSlaveComponentGroup view.content target="App.router.slaveComponentGroupsController"}} href="#"> {{unbound view.content.groupName}}</a>')  })
 });
 
 App.SlaveComponentGroupView = Ember.View.extend({
-//  templateName: require('templates/main/service/item')
+  classNames: ['slave-group'],
+  classNameBindings:["active"],
+  active:function(){
+    return this.get('content.active');
+  }.property('content.active')
 });