open-vault/ui/app/components/list-item.js
Matthew Irish afc84286b9
UI namespace additions (#5150)
* add switch link on namespace link page if user has access to the namespace
* refresh list when you delete, only show manage if you can list
* fix bug where disconnected namespaces wouldn't show the picker properly
* namespaces list should end in a slash
* end full namespace paths with a /
* shorten pop up menu link
2018-08-22 11:13:28 -05:00

25 lines
656 B
JavaScript

import Ember from 'ember';
import { task } from 'ember-concurrency';
const { inject } = Ember;
export default Ember.Component.extend({
flashMessages: inject.service(),
tagName: '',
linkParams: null,
componentName: null,
hasMenu: false,
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();
}
}),
});