You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/11/03 12:09:13 UTC

ambari git commit: AMBARI-13691 Allow use passwords references in custom actions - UI changes. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/trunk dc0ac133d -> df693b7e1


AMBARI-13691 Allow use passwords references in custom actions - UI changes. (atkach)


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

Branch: refs/heads/trunk
Commit: df693b7e1af62fe28413e569b687cae16bd67e2d
Parents: dc0ac13
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Tue Nov 3 12:40:39 2015 +0200
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Tue Nov 3 12:40:39 2015 +0200

----------------------------------------------------------------------
 ambari-web/app/utils/ajax/ajax.js               | 23 ++++++++++++++++++++
 .../widgets/test_db_connection_widget_view.js   |  3 ++-
 2 files changed, 25 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/df693b7e/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index a72bbf7..4a3992e 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -2363,6 +2363,29 @@ var urls = {
       }
     }
   },
+
+  'cluster.custom_action.create': {
+    'real': '/clusters/{clusterName}/requests',
+    'mock': '',
+    'format': function (data) {
+      var requestInfo = {
+        context: 'Check host',
+        action: 'check_host',
+        parameters: {}
+      };
+      $.extend(true, requestInfo, data.requestInfo);
+      return {
+        type: 'POST',
+        data: JSON.stringify({
+          'RequestInfo': requestInfo,
+          'Requests/resource_filters': [{
+            hosts: data.filteredHosts.join(',')
+          }]
+        })
+      }
+    }
+  },
+
   'custom_action.request': {
     'real': '/requests/{requestId}/tasks/{taskId}',
     'mock': '/data/requests/1.json',

http://git-wip-us.apache.org/repos/asf/ambari/blob/df693b7e/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
index d22cb1f..199aac6 100644
--- a/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
+++ b/ambari-web/app/views/common/configs/widgets/test_db_connection_widget_view.js
@@ -195,6 +195,7 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
    **/
   createCustomAction: function () {
     var connectionProperties = this.getProperties('db_connection_url','user_name', 'user_passwd');
+    var isServiceInstalled = App.Service.find(this.get('config.serviceName')).get('isLoaded');
     for (var key in connectionProperties) {
       if (connectionProperties.hasOwnProperty(key)) {
         connectionProperties[key] = connectionProperties[key].value;
@@ -203,7 +204,7 @@ App.TestDbConnectionWidgetView = App.ConfigWidgetView.extend({
     var params = $.extend(true, {}, {db_name: this.get('db_type').toLowerCase()}, connectionProperties, this.get('ambariProperties'));
     var filteredHosts =  Array.isArray(this.get('masterHostName.value')) ? this.get('masterHostName.value') : [this.get('masterHostName.value')];
     App.ajax.send({
-      name: 'custom_action.create',
+      name: (isServiceInstalled) ? 'cluster.custom_action.create' : 'custom_action.create',
       sender: this,
       data: {
         requestInfo: {