6e0a43ae95
* add versions routes * move commands and permissions check to stand-alone menu component * add versions template * make list-item component more flexible and use hasMenu to optionally render the menu * move current check next to the version * fix linting * remove is-wide from secret list popup
25 lines
683 B
JavaScript
25 lines
683 B
JavaScript
import { inject as service } from '@ember/service';
|
|
import Component from '@ember/component';
|
|
import { task } from 'ember-concurrency';
|
|
|
|
export default Component.extend({
|
|
flashMessages: service(),
|
|
tagName: '',
|
|
linkParams: null,
|
|
componentName: null,
|
|
hasMenu: true,
|
|
|
|
callMethod: task(function*(method, model, successMessage, failureMessage, successCallback = () => {}) {
|
|
let flash = this.get('flashMessages');
|
|
try {
|
|
yield model[method]();
|
|
flash.success(successMessage);
|
|
successCallback();
|
|
} catch (e) {
|
|
let errString = e.errors.join(' ');
|
|
flash.danger(failureMessage + errString);
|
|
model.rollbackAttributes();
|
|
}
|
|
}),
|
|
});
|