You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2015/07/02 16:32:42 UTC

ambari git commit: AMBARI-12253. Files View Upload does not work in IE10 (Erik Bergenholtz via rlevas)

Repository: ambari
Updated Branches:
  refs/heads/trunk 4d03e8c5b -> 260d9d46a


AMBARI-12253. Files View Upload does not work in IE10 (Erik Bergenholtz via rlevas)


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

Branch: refs/heads/trunk
Commit: 260d9d46aaa641c259316b356a2cbecbe6a0b8f4
Parents: 4d03e8c
Author: Erik Bergenholtz <eb...@hortonworks.com>
Authored: Thu Jul 2 10:32:33 2015 -0400
Committer: Robert Levas <rl...@hortonworks.com>
Committed: Thu Jul 2 10:32:33 2015 -0400

----------------------------------------------------------------------
 .../files/src/main/resources/ui/app/adapter.js  | 38 ++++++++++++++++++++
 1 file changed, 38 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/260d9d46/contrib/views/files/src/main/resources/ui/app/adapter.js
----------------------------------------------------------------------
diff --git a/contrib/views/files/src/main/resources/ui/app/adapter.js b/contrib/views/files/src/main/resources/ui/app/adapter.js
index 1c13b3d..6ec763b 100644
--- a/contrib/views/files/src/main/resources/ui/app/adapter.js
+++ b/contrib/views/files/src/main/resources/ui/app/adapter.js
@@ -156,6 +156,44 @@ App.ApplicationStore = DS.Store.extend({
     headers: {
       'X-Requested-By': 'ambari'
     },
+
+    /**
+      @method ajaxOptions
+      @param {String} url
+      @param {String} type The request type GET, POST, PUT, DELETE etc.
+      @param {Object} hash
+      @return {Object} hash
+    */
+    ajaxOptions: function(url, type, options) {
+      var hash = options || {};
+      hash.url = url;
+      hash.type = type;
+      hash.dataType = 'json';
+      hash.context = this;
+
+      if (hash.data && type !== 'GET') {
+        hash.contentType = 'application/json; charset=utf-8';
+        hash.data = JSON.stringify(hash.data);
+      }
+
+      var headers = this.get('headers');
+
+      if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!navigator.userAgent.match(/Trident.*rv[ :]*11\./))) {
+        headers['Cache-Control'] = 'no-cache, no-store, must-revalidate';
+        headers['Pragma'] = 'no-cache';
+        headers['Expires'] = '0';
+      }
+
+      if (headers !== undefined) {
+        hash.beforeSend = function (xhr) {
+          Ember.keys(headers).forEach(function (key) {
+            xhr.setRequestHeader(key, headers[key]);
+          });
+        };
+      }
+
+      return hash;
+    },
     listdir: function(store, type, query) {
       return this.ajax(this.buildURL('fileops','listdir'), 'GET', { data: query });
     },