diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2018-02-19 16:27:27 -0600 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2018-02-23 11:40:29 -0600 |
commit | dddb1497a5fecd7bb8b51b6ce47534fea2af7414 (patch) | |
tree | ff1d679a4aafd7941a2c1b4c88148d6a7ce7ae42 | |
parent | 81a49deaf6ee327f7748e366707d8884576b1cc5 (diff) | |
download | phosphor-webui-dddb1497a5fecd7bb8b51b6ce47534fea2af7414.tar.gz phosphor-webui-dddb1497a5fecd7bb8b51b6ce47534fea2af7414.zip |
Fix the "Upload firmware" button
The "Upload firmware" button was not calling the uploadImage()
function in api-utils.js.
The uploadImage() function was not making the correct call to
the /upload/image REST API.
Removed the confirmUpload function since not needed on a
upload since the user has already selected the file they
want to upload, pressed "Open", and then pressed the
"Upload firmware" button.
Resolves openbmc/openbmc#2770
Tested: Uploaded several images to a Witherspoon system.
Change-Id: Ia0e0ffba501066f59a4355b8f61595e30aea3f98
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
-rw-r--r-- | app/common/services/api-utils.js | 2 | ||||
-rw-r--r-- | app/configuration/controllers/firmware-controller.html | 23 | ||||
-rw-r--r-- | app/configuration/controllers/firmware-controller.js | 35 |
3 files changed, 17 insertions, 43 deletions
diff --git a/app/common/services/api-utils.js b/app/common/services/api-utils.js index 4d8b12c..dc6de50 100644 --- a/app/common/services/api-utils.js +++ b/app/common/services/api-utils.js @@ -762,7 +762,7 @@ window.angular && (function (angular) { $http({ method: 'POST', timeout: 5 * 60 * 1000, - url: DataService.getHost() + "/upload/image/", + url: DataService.getHost() + "/upload/image", headers: { 'Content-Type': 'application/octet-stream' }, diff --git a/app/configuration/controllers/firmware-controller.html b/app/configuration/controllers/firmware-controller.html index c305047..b532b41 100644 --- a/app/configuration/controllers/firmware-controller.html +++ b/app/configuration/controllers/firmware-controller.html @@ -102,27 +102,6 @@ </div> </section> -<section class="modal" aria-hidden="true" aria-labelledby="modalTitle" aria-describedby="modalDescription" role="dialog" ng-class="{'active': confirm_upload_image}"> - <div class="modal__upload" role="document"> - <div class="screen-reader-offscreen modal-description">Upload image file modal</div><!-- accessibility only; used for screen readers --> - <div class="page-header "> - <h1 class="modal-title h4"><span class="icon icon__info"><svg xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 32 32"><path - d="M18 14h-6v2h1v6h-2v2h8v-2h-2z"/><circle cx="16" cy="10" r="2"/><path - d="M16 2C8.269 2 2 8.269 2 16s6.269 14 14 14 14-6.269 14-14S23.731 2 16 2zm0 26C9.383 28 4 22.617 4 16S9.383 4 16 4s12 5.383 12 12-5.383 12-12 12z"/></svg></span> - Upload image file - </h1> - </div> - <div class="modal__content"> - <p>Uploading this image may replace a non-active image, and prevent rollback from the current active image - to the previous image.</p> - </div> - <div class="modal__button-wrapper"> - <button class="inline btn-secondary" ng-click="confirm_upload_image = false;">Cancel</button> - <button class="inline btn-primary" ng-click="confirmUpload()">Continue</button> - </div> - </div> -</section> <section class="modal" aria-hidden="true" aria-labelledby="modalTitle" aria-describedby="modalDescription" role="dialog" ng-class="{'active': reboot_confirm}"> <div class="modal__reboot" role="document"> <div class="screen-reader-offscreen modal-description">Server reboot required modal</div><!-- accessibility only; used for screen readers --> @@ -181,4 +160,4 @@ </div> </div> </section> -<div class="modal-overlay" tabindex="-1" ng-class="{'active': (display_error || confirm_upload_image || reboot_confirm || preserve_settings_confirm)}"></div>
\ No newline at end of file +<div class="modal-overlay" tabindex="-1" ng-class="{'active': (display_error || reboot_confirm || preserve_settings_confirm)}"></div> diff --git a/app/configuration/controllers/firmware-controller.js b/app/configuration/controllers/firmware-controller.js index cafc707..873327c 100644 --- a/app/configuration/controllers/firmware-controller.js +++ b/app/configuration/controllers/firmware-controller.js @@ -33,7 +33,6 @@ window.angular && (function (angular) { $scope.bmcActiveVersion = ""; $scope.hostActiveVersion = ""; $scope.display_error = false; - $scope.confirm_upload_image = false; $scope.reboot_confirm = false; $scope.preserve_settings_confirm = false; $scope.delete_image_id = ""; @@ -85,27 +84,23 @@ window.angular && (function (angular) { } $scope.upload = function(){ - if(!$scope.file_empty){ - $scope.confirm_upload_image = true; + if($scope.file) { + $scope.uploading = true; + APIUtils.uploadImage($scope.file).then(function(response){ + $scope.uploading = false; + if(response.status == 'error'){ + $scope.displayError({ + modal_title: response.data.description, + title: response.data.description, + desc: response.data.exception, + type: 'Error' + }); + }else{ + $scope.loadFirmwares(); + } + }); } } - $scope.confirmUpload = function(){ - $scope.uploading = true; - APIUtils.uploadImage($scope.file).then(function(response){ - $scope.uploading = false; - if(response.status == 'error'){ - $scope.displayError({ - modal_title: response.data.description, - title: response.data.description, - desc: response.data.exception, - type: 'Error' - }); - }else{ - $scope.loadFirmwares(); - } - }); - $scope.confirm_upload_image = false; - } $scope.download = function(){ $scope.downloading = true; |