Skip to content

Commit

Permalink
Clear previous messages, add miqSparkleOff to prevent infinite sparkle
Browse files Browse the repository at this point in the history
  • Loading branch information
ZitaNemeckova committed Dec 10, 2018
1 parent 74e4143 commit 2035006
Showing 1 changed file with 3 additions and 0 deletions.
Expand Up @@ -126,6 +126,7 @@ function mainCustomButtonFormController(API, miqService, $q, $http) {

vm.saveClicked = function() {
miqService.sparkleOn();
miqService.miqFlashClear(); // remove previous messages
var saveMsg = sprintf(__('%s "%s" has been successfully saved.'), vm.entity, vm.customButtonModel.name);
return API.put('/api/custom_buttons/' + vm.customButtonRecordId, vm.prepSaveObject(), {skipErrors: [400]})
.then(function() {
Expand All @@ -136,6 +137,7 @@ function mainCustomButtonFormController(API, miqService, $q, $http) {

vm.addClicked = function() {
miqService.sparkleOn();
miqService.miqFlashClear(); // remove previous messages
var saveMsg = sprintf(__('%s "%s" has been successfully added.'), vm.entity, vm.customButtonModel.name);
return API.post('/api/custom_buttons/', vm.prepSaveObject(), {skipErrors: [400]})
.then(function(response) {
Expand Down Expand Up @@ -205,6 +207,7 @@ function mainCustomButtonFormController(API, miqService, $q, $http) {

// private functions
function handleErrorMessages(error) {
miqSparkleOff();
if (error.status === 400) {
var errorMessages = error.data.error.message.split(',');
errorMessages.forEach(function(message) {
Expand Down

0 comments on commit 2035006

Please sign in to comment.