ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-9459. Remove oozie-server item from +Add button on host page if oozie db is derby (alexantonenko)
Date Tue, 03 Feb 2015 21:07:21 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk a4d964500 -> 373ff1137


AMBARI-9459. Remove oozie-server item from +Add button on host page if oozie db is derby (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 373ff1137e8c0352181f9a603ac14500218ccd6c
Parents: a4d9645
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Tue Feb 3 23:06:54 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Feb 3 23:06:54 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 53 +++++++++++++++++++-
 ambari-web/app/routes/main.js                   | 12 ++++-
 ambari-web/app/views/main/host/summary.js       |  5 +-
 3 files changed, 67 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/373ff113/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index cc5b947..bd221c4 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -44,6 +44,17 @@ App.MainHostDetailsController = Em.Controller.extend({
   referer: '',
 
   /**
+   * Deferred object will be resolved when Oozie configs are downloaded
+   * @type {object}
+   */
+  isOozieConfigLoaded: $.Deferred(),
+
+  /**
+   * @type {bool}
+   */
+  isOozieServerAddable: true,
+
+  /**
    * Open dashboard page
    * @method routeHome
    */
@@ -569,6 +580,37 @@ App.MainHostDetailsController = Em.Controller.extend({
   /**
    * Success callback for load configs request
    * @param {object} data
+   * @method loadOozieConfigs
+   */
+  loadOozieConfigs: function (data) {
+    return App.ajax.send({
+      name: 'admin.get.all_configurations',
+      sender: this,
+      data: {
+        urlParams: '(type=oozie-env&tag=' + data.Clusters.desired_configs['oozie-env'].tag
+ ')'
+      },
+      success: 'onLoadOozieConfigs',
+      error: 'onLoadConfigsErrorCallback'
+    });
+  },
+
+  /**
+   * get Oozie database config and set databaseType
+   * @param {object} data
+   * @method onLoadHiveConfigs
+   */
+  onLoadOozieConfigs: function (data) {
+    var configs = {};
+    data.items.forEach(function(item) {
+      $.extend(configs, item.properties);
+    });
+    this.set('isOozieServerAddable', !(Em.isEmpty(configs["oozie_database"]) || configs["oozie_database"]
=== 'New Derby Database'));
+    this.get('isOozieConfigLoaded').resolve();
+  },
+
+  /**
+   * Success callback for load configs request
+   * @param {object} data
    * @method loadHiveConfigs
    */
   loadHiveConfigs: function (data) {
@@ -741,11 +783,20 @@ App.MainHostDetailsController = Em.Controller.extend({
     App.ajax.send({
       name: 'config.tags',
       sender: this,
-      success: callback ? callback : 'loadConfigsSuccessCallback'
+      success: callback ? callback : 'loadConfigsSuccessCallback',
+      error: 'onLoadConfigsErrorCallback'
     });
   },
 
   /**
+   * onLoadConfigsErrorCallback
+   * @method onLoadConfigsErrorCallback
+   */
+  onLoadConfigsErrorCallback: function () {
+    this.get('isOozieConfigLoaded').reject();
+  },
+
+  /**
    * Success callback for load configs request
    * @param {object} data
    * @method adConfigsSuccessCallback

http://git-wip-us.apache.org/repos/asf/ambari/blob/373ff113/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index aa4ae14..70a5e21 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -180,7 +180,17 @@ module.exports = Em.Route.extend({
       summary: Em.Route.extend({
         route: '/summary',
         connectOutlets: function (router, context) {
-          router.get('mainHostDetailsController').connectOutlet('mainHostSummary');
+          router.get('mainController').dataLoading().done(function() {
+            var controller = router.get('mainHostDetailsController');
+            if ( App.Service.find().mapProperty('serviceName').contains('OOZIE')) {
+              controller.loadConfigs('loadOozieConfigs');
+              controller.isOozieConfigLoaded.always(function () {
+                controller.connectOutlet('mainHostSummary');
+              });
+            }else {
+              controller.connectOutlet('mainHostSummary');
+            }
+          });
         }
       }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/373ff113/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index b462722..72e7a91 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -44,7 +44,7 @@ App.MainHostSummaryView = Em.View.extend({
   /**
    * @type {bool}
    */
-  isStopCommand:true,
+  isStopCommand: true,
 
   /**
    * @type {App.Host}
@@ -277,6 +277,9 @@ App.MainHostSummaryView = Em.View.extend({
 
     addableToHostComponents.forEach(function(addableComponent) {
       if(installedServices.contains(addableComponent.get('serviceName')) && !installedComponents.contains(addableComponent.get('componentName')))
{
+        if ((addableComponent.get('componentName') === 'OOZIE_SERVER') && !App.router.get('mainHostDetailsController.isOozieServerAddable'))
{
+          return;
+        }
         components.pushObject(self.addableComponentObject.create({'componentName': addableComponent.get('componentName'),
'serviceName': addableComponent.get('serviceName')}));
       }
     });


Mime
View raw message