ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-20521 Service quick links not showing up in the UI. (atkach)
Date Wed, 22 Mar 2017 13:57:31 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f8931a925 -> b8d5dd87a


AMBARI-20521 Service quick links not showing up in the UI. (atkach)


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

Branch: refs/heads/trunk
Commit: b8d5dd87a7bd854081d1db0ab7f054a05a5db7e1
Parents: f8931a9
Author: Andrii Tkach <atkach@apache.org>
Authored: Wed Mar 22 13:12:15 2017 +0200
Committer: Andrii Tkach <atkach@apache.org>
Committed: Wed Mar 22 15:57:04 2017 +0200

----------------------------------------------------------------------
 ambari-web/app/utils/ajax/ajax.js       | 13 ++++++++++---
 ambari-web/test/utils/ajax/ajax_test.js | 15 ++++++++++++++-
 2 files changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d5dd87/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 caf7a62..b63027e 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -3062,16 +3062,23 @@ var formatRequest = function (data) {
  */
 var doGetAsPost = function(opt) {
   var delimiterPos = opt.url.indexOf('?');
+  var fieldsIndex = opt.url.indexOf('&fields');
 
   opt.type = "POST";
   opt.headers["X-Http-Method-Override"] = "GET";
   if (delimiterPos !== -1) {
+    var query = fieldsIndex !== -1 ? opt.url.substring(delimiterPos + 1, fieldsIndex) : opt.url.substr(delimiterPos
+ 1);
     opt.data = JSON.stringify({
-      "RequestInfo": {"query" : opt.url.substr(delimiterPos + 1, opt.url.length)}
+      "RequestInfo": {"query" : query}
     });
-    opt.url = opt.url.substr(0, delimiterPos);
+    if (fieldsIndex !== -1) {
+      opt.url = opt.url.substr(0, delimiterPos) + '?' + opt.url.substr(fieldsIndex + 1) +
'&_=' + App.dateTime();
+    } else {
+      opt.url = opt.url.substr(0, delimiterPos)  + '?_=' + App.dateTime();
+    }
+  } else {
+    opt.url += '?_=' + App.dateTime();
   }
-  opt.url += '?_=' + App.dateTime();
   return opt;
 };
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b8d5dd87/ambari-web/test/utils/ajax/ajax_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/ajax/ajax_test.js b/ambari-web/test/utils/ajax/ajax_test.js
index 3556e1e..4e2a876 100644
--- a/ambari-web/test/utils/ajax/ajax_test.js
+++ b/ambari-web/test/utils/ajax/ajax_test.js
@@ -159,7 +159,7 @@ describe('App.ajax', function() {
         headers: {"X-Http-Method-Override": "GET"}
       });
     });
-    it("url has '?'", function () {
+    it("url has '?params'", function () {
       var opt = {
         type: 'GET',
         url: 'root?params',
@@ -172,6 +172,19 @@ describe('App.ajax', function() {
         data: "{\"RequestInfo\":{\"query\":\"params\"}}"
       });
     });
+    it("url has '?params&fields'", function () {
+      var opt = {
+        type: 'GET',
+        url: 'root?params&fields',
+        headers: {}
+      };
+      expect(App.ajax.fakeDoGetAsPost({}, opt)).to.eql({
+        type: 'POST',
+        url: 'root?fields&_=1',
+        headers: {"X-Http-Method-Override": "GET"},
+        data: "{\"RequestInfo\":{\"query\":\"params\"}}"
+      });
+    });
   });
 
   describe('#abortRequests', function () {


Mime
View raw message