Display success message after uploading image
Fix includes:
- Displaying an 'Upload complete' message and clearing the image's
file name if the upload succeeds.
- Displaying an error pop-up with reason for failure when the
upload fails.
Change-Id: Id9474b62ed62e1b40ffa018eb273abbf19be26ce
Signed-off-by: CamVan Nguyen <ctnguyen@us.ibm.com>
diff --git a/app/configuration/controllers/firmware-controller.js b/app/configuration/controllers/firmware-controller.js
index 780bb19..5ebf6ce 100644
--- a/app/configuration/controllers/firmware-controller.js
+++ b/app/configuration/controllers/firmware-controller.js
@@ -48,6 +48,7 @@
$scope.confirm_priority = false;
$scope.file_empty = true;
$scope.uploading = false;
+ $scope.upload_success = false;
$scope.activate = { reboot: true };
$scope.download_error_msg = "";
$scope.download_success = false;
@@ -151,16 +152,20 @@
$scope.upload = function(){
if($scope.file) {
$scope.uploading = true;
+ $scope.upload_success = false;
APIUtils.uploadImage($scope.file).then(function(response){
+ $scope.file = "";
$scope.uploading = false;
+ $scope.upload_success = true;
$scope.loadFirmwares();
}, function(error){
$scope.uploading = false;
+ console.log(error);
$scope.displayError({
modal_title: 'Error during image upload',
title: 'Error during image upload',
- desc: 'Error uploading image',
- type: 'Error uploading image, please check the image'
+ desc: error,
+ type: 'Error'
});
});
}