Fixed a few straggling success/error promises and replaced with then/catch

This commit is contained in:
mabashian
2018-01-11 13:59:46 -05:00
parent 03cef6fea3
commit f9b0a3121f
4 changed files with 13 additions and 13 deletions

View File

@@ -138,16 +138,16 @@ export default
this.url = GetBasePath('inventory_sources') + id + '/hosts/'; this.url = GetBasePath('inventory_sources') + id + '/hosts/';
Rest.setUrl(this.url); Rest.setUrl(this.url);
return Rest.destroy() return Rest.destroy()
.success(this.success.bind(this)) .then(this.success.bind(this))
.error(this.error.bind(this)) .catch(this.error.bind(this))
.finally(); .finally();
}, },
deleteGroups(id) { deleteGroups(id) {
this.url = GetBasePath('inventory_sources') + id + '/groups/'; this.url = GetBasePath('inventory_sources') + id + '/groups/';
Rest.setUrl(this.url); Rest.setUrl(this.url);
return Rest.destroy() return Rest.destroy()
.success(this.success.bind(this)) .then(this.success.bind(this))
.error(this.error.bind(this)) .catch(this.error.bind(this))
.finally(); .finally();
} }
}; };

View File

@@ -92,7 +92,7 @@ export default ['$stateParams', '$scope', '$rootScope',
$scope.$on("ReloadOrgListView", function() { $scope.$on("ReloadOrgListView", function() {
Rest.setUrl($scope.current_url); Rest.setUrl($scope.current_url);
Rest.get() Rest.get()
.success((data) => $scope.organizations = data.results) .then(({data}) => $scope.organizations = data.results)
.catch(({data, status}) => { .catch(({data, status}) => {
ProcessErrors($scope, data, status, null, { ProcessErrors($scope, data, status, null, {
hdr: 'Error!', hdr: 'Error!',

View File

@@ -919,9 +919,9 @@ export default ['$state','moment', '$timeout', '$window', '$filter', 'Rest', 'Ge
Rest.setUrl(GetBasePath("unified_jobs") + "?id=" + d.job.id); Rest.setUrl(GetBasePath("unified_jobs") + "?id=" + d.job.id);
Rest.get() Rest.get()
.success(function (res) { .then(function (res) {
if(res.results && res.results.length > 0) { if(res.data.results && res.data.results.length > 0) {
goToJobResults(res.results[0].type); goToJobResults(res.data.results[0].type);
} }
}) })
.catch(({data, status}) => { .catch(({data, status}) => {

View File

@@ -58,13 +58,13 @@ export default {
// Get the workflow nodes // Get the workflow nodes
Rest.setUrl(nextUrl); Rest.setUrl(nextUrl);
Rest.get() Rest.get()
.success(function(nextData) { .then(function(nextData) {
for(var i=0; i<nextData.results.length; i++) { for(var i=0; i<nextData.data.results.length; i++) {
allNodes.push(nextData.results[i]); allNodes.push(nextData.data.results[i]);
} }
if(nextData.next) { if(nextData.data.next) {
// Get the next page // Get the next page
getNodes(nextData.next); getNodes(nextData.data.next);
} }
else { else {
defer.resolve(allNodes); defer.resolve(allNodes);