Skip to content

Commit

Permalink
Fix cancel and restart buttons
Browse files Browse the repository at this point in the history
Callback functions for restart and cancel where improperly updated while
switching from coffeescript to javascript.
  • Loading branch information
drogus committed Jan 7, 2016
1 parent 561e671 commit 7649c18
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions app/utils/repo-actions-item-component-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export default Ember.Mixin.create({
}
this.set('restarting', true);
onFinished = () => {
return function() {
return this.set('restarting', false);
};
this.set('restarting', false);
};
return this.get('item').restart().then(onFinished, onFinished);
},
Expand All @@ -41,31 +39,28 @@ export default Ember.Mixin.create({
return;
}
this.set('cancelling', true);

type = this.get('type');
return this.get('item').cancel().then(() => {
return function() {
this.set('cancelling', false);
this.set('cancelling', false);
return Travis.flash({
success: (type.capitalize()) + " has been successfully canceled."
});
}, (xhr) => {
this.set('cancelling', false);
if (xhr.status === 422) {
return Travis.flash({
error: "This " + type + " can't be canceled"
});
} else if (xhr.status === 403) {
return Travis.flash({
error: "You don't have sufficient access to cancel this " + type
});
} else {
return Travis.flash({
success: (type.capitalize()) + " has been successfully canceled."
error: "An error occured when canceling the " + type
});
};
}, () => {
return function(xhr) {
this.set('cancelling', false);
if (xhr.status === 422) {
return Travis.flash({
error: "This " + type + " can't be canceled"
});
} else if (xhr.status === 403) {
return Travis.flash({
error: "You don't have sufficient access to cancel this " + type
});
} else {
return Travis.flash({
error: "An error occured when canceling the " + type
});
}
};
}
});
}
}
Expand Down

0 comments on commit 7649c18

Please sign in to comment.