diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2018-09-20 16:02:08 -0500 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2019-01-23 20:00:36 +0000 |
commit | f7f59469b85d8494803bb637371bf3fc1f4aea37 (patch) | |
tree | 9529fd809e9c55dd644c9944efa37f0d2e80231e | |
parent | 90ae95eb6f5f30e3863f24ad364b111258ea4ee4 (diff) | |
download | phosphor-webui-f7f59469b85d8494803bb637371bf3fc1f4aea37.tar.gz phosphor-webui-f7f59469b85d8494803bb637371bf3fc1f4aea37.zip |
Firmware: Remove unnecessary promises
From the firmware functions in api-utils.js, don't create a new
promise.
Tested: Changed Priority, deleted, and activated images.
Change-Id: I53e4def6dda2e1868f65ccd365510cd84d01a065
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r-- | app/common/services/api-utils.js | 95 |
1 files changed, 34 insertions, 61 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js index 0de6b1f..89b2c71 100644 --- a/app/common/services/api-utils.js +++ b/app/common/services/api-utils.js @@ -1349,71 +1349,44 @@ window.angular && (function(angular) { return deferred.promise; }, changePriority: function(imageId, priority) { - var deferred = $q.defer(); - $http({ - method: 'PUT', - url: DataService.getHost() + '/xyz/openbmc_project/software/' + - imageId + '/attr/Priority', - withCredentials: true, - data: JSON.stringify({'data': priority}) - }) - .then( - function(response) { - var json = JSON.stringify(response.data); - var content = JSON.parse(json); - deferred.resolve(content); - }, - function(error) { - console.log(error); - deferred.reject(error); - }); - - return deferred.promise; + return $http({ + method: 'PUT', + url: DataService.getHost() + + '/xyz/openbmc_project/software/' + imageId + + '/attr/Priority', + withCredentials: true, + data: JSON.stringify({'data': priority}) + }) + .then(function(response) { + return response.data; + }); }, deleteImage: function(imageId) { - var deferred = $q.defer(); - $http({ - method: 'POST', - url: DataService.getHost() + '/xyz/openbmc_project/software/' + - imageId + '/action/Delete', - withCredentials: true, - data: JSON.stringify({'data': []}) - }) - .then( - function(response) { - var json = JSON.stringify(response.data); - var content = JSON.parse(json); - deferred.resolve(content); - }, - function(error) { - console.log(error); - deferred.reject(error); - }); - - return deferred.promise; + return $http({ + method: 'POST', + url: DataService.getHost() + + '/xyz/openbmc_project/software/' + imageId + + '/action/Delete', + withCredentials: true, + data: JSON.stringify({'data': []}) + }) + .then(function(response) { + return response.data; + }); }, activateImage: function(imageId) { - var deferred = $q.defer(); - $http({ - method: 'PUT', - url: DataService.getHost() + '/xyz/openbmc_project/software/' + - imageId + '/attr/RequestedActivation', - withCredentials: true, - data: - JSON.stringify({'data': Constants.FIRMWARE.ACTIVATE_FIRMWARE}) - }) - .then( - function(response) { - var json = JSON.stringify(response.data); - var content = JSON.parse(json); - deferred.resolve(content); - }, - function(error) { - console.log(error); - deferred.reject(error); - }); - - return deferred.promise; + return $http({ + method: 'PUT', + url: DataService.getHost() + + '/xyz/openbmc_project/software/' + imageId + + '/attr/RequestedActivation', + withCredentials: true, + data: JSON.stringify( + {'data': Constants.FIRMWARE.ACTIVATE_FIRMWARE}) + }) + .then(function(response) { + return response.data; + }); }, uploadImage: function(file) { return $http({ |