ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject git commit: AMBARI-4069. Add hosts, if using Local Repository, UI incorrectly says 'no'. (xiwang via yusaku)
Date Mon, 16 Dec 2013 22:07:28 GMT
Updated Branches:
  refs/heads/trunk e5d225a2d -> 2dc955fa6


AMBARI-4069. Add hosts, if using Local Repository, UI incorrectly says 'no'. (xiwang via yusaku)


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

Branch: refs/heads/trunk
Commit: 2dc955fa61ba2290d5a3395fde90df5c3d6f0963
Parents: e5d225a
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Mon Dec 16 14:07:09 2013 -0800
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Mon Dec 16 14:07:09 2013 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step8_controller.js  | 100 +++++++++++++++++--
 ambari-web/app/messages.js                      |   4 +
 ambari-web/app/templates/wizard/step8.hbs       |  42 ++++----
 3 files changed, 122 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2dc955fa/ambari-web/app/controllers/wizard/step8_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step8_controller.js b/ambari-web/app/controllers/wizard/step8_controller.js
index da7f561..660fad3 100644
--- a/ambari-web/app/controllers/wizard/step8_controller.js
+++ b/ambari-web/app/controllers/wizard/step8_controller.js
@@ -376,16 +376,102 @@ App.WizardStep8Controller = Em.Controller.extend({
     this.get('clusterInfo').pushObject(Ember.Object.create(totalHostsObj));
 
     //repo
-    var repoOption = this.get('content.installOptions.localRepo');
-    var repoObj = this.rawContent.findProperty('config_name', 'Repo');
-    if (repoOption) {
-      repoObj.config_value = 'Yes';
-    } else {
-      repoObj.config_value = 'No';
+    if (this.get('content.controllerName') == 'addHostController') {
+      this.loadRepoInfo();
+    } else { // from install wizard
+      var selectedStack = this.get('content.stacks').findProperty('isSelected', true);
+      var allRepos = [];
+      if (selectedStack && selectedStack.operatingSystems) {
+        selectedStack.operatingSystems.forEach (function(os){
+          if (os.selected) {
+            switch (os.osType) {
+              case 'redhat6':
+                var repo = Em.Object.create({
+                  base_url: os.baseUrl,
+                  os_type: Em.I18n.t("installer.step8.repoInfo.osType.redhat6")
+                });
+                allRepos.push(repo);
+                break;
+              case 'redhat5':
+                var repo = Em.Object.create({
+                  base_url: os.baseUrl,
+                  os_type: Em.I18n.t("installer.step8.repoInfo.osType.redhat5")
+                });
+                allRepos.push(repo);
+                break;
+              case 'sles11':
+                var repo = Em.Object.create({
+                  base_url: os.baseUrl,
+                  os_type: Em.I18n.t("installer.step8.repoInfo.osType.sles11")
+                });
+                allRepos.push(repo);
+                break;
+            }
+          }
+        }, this);
+      }
+      allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
+      this.get('clusterInfo').set('repoInfo', allRepos);
     }
-    this.get('clusterInfo').pushObject(Ember.Object.create(repoObj));
   },
 
+  /**
+   * get the repositories info of HDP from server. Used only in addHost controller.
+   */
+  loadRepoInfo: function(){
+    var nameVersionCombo = App.get('currentStackVersion');
+    var stackName = nameVersionCombo.split('-')[0];
+    var stackVersion = nameVersionCombo.split('-')[1];
+    App.ajax.send({
+      name: 'cluster.load_repositories',
+      sender: this,
+      data: {
+        stackName: stackName,
+        stackVersion: stackVersion
+      },
+      success: 'loadRepoInfoSuccessCallback',
+      error: 'loadRepositoriesErrorCallback'
+    });
+  },
+
+  loadRepoInfoSuccessCallback: function (data) {
+    var allRepos = [];
+    data.items.forEach(function(item) {
+      var os = item.repositories[0].Repositories;
+        switch (os.os_type) {
+          case 'redhat6':
+            var repo = Em.Object.create({
+              base_url: os.base_url,
+              os_type: Em.I18n.t("installer.step8.repoInfo.osType.redhat6")
+            });
+            allRepos.push(repo);
+            break;
+          case 'redhat5':
+            var repo = Em.Object.create({
+              base_url: os.base_url,
+              os_type: Em.I18n.t("installer.step8.repoInfo.osType.redhat5")
+            });
+            allRepos.push(repo);
+            break;
+          case 'sles11':
+            var repo = Em.Object.create({
+              base_url: os.base_url,
+              os_type: Em.I18n.t("installer.step8.repoInfo.osType.sles11")
+            });
+            allRepos.push(repo);
+            break;
+        }
+    }, this);
+    allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
+    this.get('clusterInfo').set('repoInfo', allRepos);
+  },
+
+  loadRepoInfoErrorCallback: function(request, ajaxOptions, error) {
+    console.log('Error message is: ' + request.responseText);
+    var allRepos = [];
+    allRepos.set('display_name', Em.I18n.t("installer.step8.repoInfo.displayName"));
+    this.get('clusterInfo').set('repoInfo', allRepos);
+  },
 
   /**
    * Load all info about services to <code>services</code> variable

http://git-wip-us.apache.org/repos/asf/ambari/blob/2dc955fa/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 4a5fd42..2d0e226 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -490,6 +490,10 @@ Em.I18n.translations = {
   'installer.step8.hosts':' hosts',
   'installer.step8.host':' host',
   'installer.step8.other':' and {0} other hosts',
+  'installer.step8.repoInfo.osType.redhat6':'RHEL 6/CentOS 6/Oracle Linux 6',
+  'installer.step8.repoInfo.osType.redhat5':'RHEL 5/CentOS 5/Oracle Linux 5',
+  'installer.step8.repoInfo.osType.sles11':'SLES 11/SUSE 11',
+  'installer.step8.repoInfo.displayName':'Repositories',
   'installer.step8.securityWarning':'You are running your cluster in secure mode. You must
set up the keytabs for all the hosts you are adding before you proceed.',
   'installer.step8.securityConfirmationPopupBody':'Before you proceed, please make sure that
the keytabs have been set up on the hosts you are adding per the instructions on the Review
page. Otherwise, the assigned components will not be able to start properly on the hosts being
added.',
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/2dc955fa/ambari-web/app/templates/wizard/step8.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/wizard/step8.hbs b/ambari-web/app/templates/wizard/step8.hbs
index 1e13645..af77c04 100644
--- a/ambari-web/app/templates/wizard/step8.hbs
+++ b/ambari-web/app/templates/wizard/step8.hbs
@@ -39,23 +39,31 @@
       </p>
     {{/each}}
 
-      <div>
-        {{#if controller.services.length}}
-          <p><b>{{t menu.item.services}}</b></p>
-          {{#each controller.services}}
-            <div>
-              <ul><em><b>{{display_name}}</b></em>
-                <div>
-                  {{#each component in this.service_components}}
-                    <ul><span class="text text-info">{{component.display_name
}}
-                        : </span>{{component.component_value}}</ul>
-                  {{/each}}
-                </div>
-              </ul>
-            </div>
-          {{/each}}
-        {{/if}}
-      </div>
+    <p><b>{{controller.clusterInfo.repoInfo.display_name}}</b>:</p>
+    <div>
+      {{#each item in controller.clusterInfo.repoInfo}}
+        <ul><span class="text text-info">{{item.os_type}}
+          : </span>{{item.base_url}}</ul>
+      {{/each}}
+    </div>
+
+    <div>
+      {{#if controller.services.length}}
+        <p><b>{{t menu.item.services}}</b></p>
+        {{#each controller.services}}
+          <div>
+            <ul><em><b>{{display_name}}</b></em>
+              <div>
+                {{#each component in this.service_components}}
+                  <ul><span class="text text-info">{{component.display_name }}
+                      : </span>{{component.component_value}}</ul>
+                {{/each}}
+              </div>
+            </ul>
+          </div>
+        {{/each}}
+      {{/if}}
+    </div>
   </div>
 </div>
 <div class="btn-area">


Mime
View raw message