Fix cancel and restart buttons

Callback functions for restart and cancel where improperly updated while
switching from coffeescript to javascript.
This commit is contained in:
Piotr Sarnacki 2016-01-07 10:18:18 +01:00
parent 561e671e0d
commit 7649c180dd

View File

@ -29,9 +29,7 @@ export default Ember.Mixin.create({
} }
this.set('restarting', true); this.set('restarting', true);
onFinished = () => { onFinished = () => {
return function() { this.set('restarting', false);
return this.set('restarting', false);
};
}; };
return this.get('item').restart().then(onFinished, onFinished); return this.get('item').restart().then(onFinished, onFinished);
}, },
@ -41,16 +39,14 @@ export default Ember.Mixin.create({
return; return;
} }
this.set('cancelling', true); this.set('cancelling', true);
type = this.get('type'); type = this.get('type');
return this.get('item').cancel().then(() => { return this.get('item').cancel().then(() => {
return function() {
this.set('cancelling', false); this.set('cancelling', false);
return Travis.flash({ return Travis.flash({
success: (type.capitalize()) + " has been successfully canceled." success: (type.capitalize()) + " has been successfully canceled."
}); });
}; }, (xhr) => {
}, () => {
return function(xhr) {
this.set('cancelling', false); this.set('cancelling', false);
if (xhr.status === 422) { if (xhr.status === 422) {
return Travis.flash({ return Travis.flash({
@ -65,7 +61,6 @@ export default Ember.Mixin.create({
error: "An error occured when canceling the " + type error: "An error occured when canceling the " + type
}); });
} }
};
}); });
} }
} }