open-vault/ui/app/components/auth-info.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

39 lines
889 B
JavaScript

import { inject as service } from '@ember/service';
import { or } from '@ember/object/computed';
import Component from '@ember/component';
import { run } from '@ember/runloop';
export default Component.extend({
auth: service(),
wizard: service(),
router: service(),
transitionToRoute: function() {
this.get('router').transitionTo(...arguments);
},
classNames: 'user-menu auth-info',
isRenewing: or('fakeRenew', 'auth.isRenewing'),
actions: {
restartGuide() {
this.get('wizard').restartGuide();
},
renewToken() {
this.set('fakeRenew', true);
run.later(() => {
this.set('fakeRenew', false);
this.get('auth').renew();
}, 200);
},
revokeToken() {
this.get('auth')
.revokeCurrentToken()
.then(() => {
this.transitionToRoute('vault.cluster.logout');
});
},
},
});