Browse Source

AMBARI-6020. Check database connection: host name location of master component should be passed as parameter for custom action. (Buzhor Denys via alexantonenko)

Alex Antonenko 11 năm trước cách đây
mục cha
commit
31bbefadfe

+ 9 - 2
ambari-web/app/views/wizard/controls_view.js

@@ -735,6 +735,14 @@ App.CheckDBConnectionView = Ember.View.extend({
       db_connection_url: /jdbc\.url|connectionurl/ig
       db_connection_url: /jdbc\.url|connectionurl/ig
     }
     }
   }.property(),
   }.property(),
+  /** @property {String} masterHostName - host name location of Master Component related to Service **/
+  masterHostName: function() {
+    var serviceMasterMap = {
+      'OOZIE': 'oozieserver_host',
+      'HIVE': 'hivemetastore_host'
+    };
+    return this.get('parentView.categoryConfigsAll').findProperty('name', serviceMasterMap[this.get('parentView.service.serviceName')]).get('value');
+  }.property(),
   /** @property {Object} connectionProperties - service specific config values mapped for custom action request **/
   /** @property {Object} connectionProperties - service specific config values mapped for custom action request **/
   connectionProperties: function() {
   connectionProperties: function() {
     var propObj = {};
     var propObj = {};
@@ -848,7 +856,6 @@ App.CheckDBConnectionView = Ember.View.extend({
    * @method createCustomAction
    * @method createCustomAction
    **/
    **/
   createCustomAction: function() {
   createCustomAction: function() {
-    var databaseHost = this.get('parentView.categoryConfigsAll').findProperty('name', this.get('hostNameProperty')).get('value');
     var params = $.extend(true, {}, { db_name: this.get('databaseName').toLowerCase() }, this.get('connectionProperties'), this.get('ambariProperties'));
     var params = $.extend(true, {}, { db_name: this.get('databaseName').toLowerCase() }, this.get('connectionProperties'), this.get('ambariProperties'));
     App.ajax.send({
     App.ajax.send({
       name: 'custom_action.create',
       name: 'custom_action.create',
@@ -857,7 +864,7 @@ App.CheckDBConnectionView = Ember.View.extend({
         requestInfo: {
         requestInfo: {
           parameters: params
           parameters: params
         },
         },
-        filteredHosts: [databaseHost]
+        filteredHosts: [this.get('masterHostName')]
       },
       },
       success: 'onCreateActionSuccess',
       success: 'onCreateActionSuccess',
       error: 'onCreateActionError'
       error: 'onCreateActionError'