open-vault/ui/app/components/mount-accessor-select.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

32 lines
691 B
JavaScript

import { inject as service } from '@ember/service';
import Component from '@ember/component';
import { task } from 'ember-concurrency';
export default Component.extend({
store: service(),
// Public API
//value for the external mount selector
value: null,
onChange: () => {},
init() {
this._super(...arguments);
this.get('authMethods').perform();
},
authMethods: task(function*() {
let methods = yield this.get('store').findAll('auth-method');
if (!this.get('value')) {
this.set('value', methods.get('firstObject.accessor'));
}
return methods;
}).drop(),
actions: {
change(value) {
this.get('onChange')(value);
},
},
});