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
No known key found for this signature in database
GPG Key ID: 436B8D5EDC704CE3
4 changed files with 13 additions and 13 deletions

View File

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

View File

@ -92,7 +92,7 @@ export default ['$stateParams', '$scope', '$rootScope',
$scope.$on("ReloadOrgListView", function() {
Rest.setUrl($scope.current_url);
Rest.get()
.success((data) => $scope.organizations = data.results)
.then(({data}) => $scope.organizations = data.results)
.catch(({data, status}) => {
ProcessErrors($scope, data, status, null, {
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.get()
.success(function (res) {
if(res.results && res.results.length > 0) {
goToJobResults(res.results[0].type);
.then(function (res) {
if(res.data.results && res.data.results.length > 0) {
goToJobResults(res.data.results[0].type);
}
})
.catch(({data, status}) => {

View File

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