UI/Remove spinner after token renew (#12887)

* fixes loading spinner

* adds changelog
This commit is contained in:
claire bontempo 2021-10-21 07:05:45 -07:00 committed by GitHub
parent fe3abd7e53
commit 1898e6c301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

3
changelog/12887.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Remove spinner after token renew
```

View File

@ -40,8 +40,9 @@ export default class AuthInfoComponent extends Component {
renewToken() {
this.fakeRenew = true;
run.later(() => {
this.fakeRenew = false;
this.auth.renew();
this.auth.renew().then(() => {
this.fakeRenew = this.auth.isRenewing;
});
}, 200);
}

View File

@ -23,6 +23,7 @@ export default Service.extend({
namespaceService: service('namespace'),
IDLE_TIMEOUT: 3 * 60e3,
expirationCalcTS: null,
isRenewing: false,
init() {
this._super(...arguments);
this.checkForRootToken();
@ -249,14 +250,14 @@ export default Service.extend({
if (currentlyRenewing) {
return;
}
this.set('isRenewing', true);
this.isRenewing = true;
return this.renewCurrentToken().then(
resp => {
this.set('isRenewing', false);
this.isRenewing = false;
return this.persistAuthData(tokenName, resp.data || resp.auth);
},
e => {
this.set('isRenewing', false);
this.isRenewing = false;
throw e;
}
);

View File

@ -26,7 +26,7 @@
{{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}}
{{#if this.auth.authData.renewable}}
<li class="action">
<button type="button" {{action "renewToken"}} class="link button {{if this.isRenewing 'is-loading'}}">
<button type="button" {{on "click" this.renewToken}} class="link button {{if this.isRenewing 'is-loading'}}">
Renew token
</button>
</li>