open-vault/ui/app/components/list-item.js
Matthew Irish 6e0a43ae95
UI - kv v2 versions page (#5563)
* 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
2018-10-19 17:24:57 -05:00

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();
}
}),
});