Skip to content

Commit

Permalink
HUE-8619 [tb] Switch to POST for partitions API call
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanAhlen committed Oct 15, 2018
1 parent 4bc7386 commit 5ae8607
Showing 1 changed file with 28 additions and 33 deletions.
61 changes: 28 additions & 33 deletions desktop/core/src/desktop/static/desktop/js/apiHelper.js
Expand Up @@ -1461,40 +1461,35 @@ var ApiHelper = (function () {
var deferred = $.Deferred();

// TODO: No sourceType needed?
var request = $.ajax({
url: '/metastore/table/' + options.path.join('/') + '/partitions',
data: {
format: 'json',
cluster: JSON.stringify(options.compute)
},
success: function (response) {
if (!self.successResponseIsError(response)) {
if (!response) {
response = {};
}
response.hueTimestamp = Date.now();
deferred.resolve(response);
} else {
self.assistErrorCallback({
silenceErrors: options.silenceErrors,
errorCallback: deferred.reject
})(response);
}
},
error: function (response) {
// Don't report any partitions if it's not partitioned instead of error to prevent unnecessary calls
if (response && response.responseText && response.responseText.indexOf('is not partitioned') !== -1) {
deferred.resolve({
hueTimestamp: Date.now(),
partition_keys_json: [],
partition_values_json: []
})
} else {
self.assistErrorCallback({
silenceErrors: options.silenceErrors,
errorCallback: deferred.reject
})(response);
var request = $.post('/metastore/table/' + options.path.join('/') + '/partitions', {
format: 'json',
cluster: JSON.stringify(options.compute)
}).done(function (response) {
if (!self.successResponseIsError(response)) {
if (!response) {
response = {};
}
response.hueTimestamp = Date.now();
deferred.resolve(response);
} else {
self.assistErrorCallback({
silenceErrors: options.silenceErrors,
errorCallback: deferred.reject
})(response);
}
}).fail(function (response) {
// Don't report any partitions if it's not partitioned instead of error to prevent unnecessary calls
if (response && response.responseText && response.responseText.indexOf('is not partitioned') !== -1) {
deferred.resolve({
hueTimestamp: Date.now(),
partition_keys_json: [],
partition_values_json: []
})
} else {
self.assistErrorCallback({
silenceErrors: options.silenceErrors,
errorCallback: deferred.reject
})(response);
}
});

Expand Down

0 comments on commit 5ae8607

Please sign in to comment.