2018-09-25 16:28:26 +00:00
|
|
|
import { inject as service } from '@ember/service';
|
|
|
|
import { or } from '@ember/object/computed';
|
|
|
|
import Component from '@ember/component';
|
|
|
|
import { run } from '@ember/runloop';
|
2018-08-28 05:03:55 +00:00
|
|
|
export default Component.extend({
|
2018-09-25 16:28:26 +00:00
|
|
|
auth: service(),
|
|
|
|
wizard: service(),
|
|
|
|
router: service(),
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
transitionToRoute: function() {
|
2018-09-25 16:28:26 +00:00
|
|
|
this.get('router').transitionTo(...arguments);
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
classNames: 'user-menu auth-info',
|
|
|
|
|
2018-09-25 16:28:26 +00:00
|
|
|
isRenewing: or('fakeRenew', 'auth.isRenewing'),
|
2018-04-03 14:16:57 +00:00
|
|
|
|
|
|
|
actions: {
|
2018-08-28 05:03:55 +00:00
|
|
|
restartGuide() {
|
|
|
|
this.get('wizard').restartGuide();
|
|
|
|
},
|
2018-04-03 14:16:57 +00:00
|
|
|
renewToken() {
|
|
|
|
this.set('fakeRenew', true);
|
2018-08-28 05:03:55 +00:00
|
|
|
run.later(() => {
|
2018-04-03 14:16:57 +00:00
|
|
|
this.set('fakeRenew', false);
|
|
|
|
this.get('auth').renew();
|
|
|
|
}, 200);
|
|
|
|
},
|
|
|
|
|
|
|
|
revokeToken() {
|
2018-09-25 16:28:26 +00:00
|
|
|
this.get('auth')
|
|
|
|
.revokeCurrentToken()
|
|
|
|
.then(() => {
|
|
|
|
this.transitionToRoute('vault.cluster.logout');
|
|
|
|
});
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|