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() { renewToken() {
this.fakeRenew = true; this.fakeRenew = true;
run.later(() => { run.later(() => {
this.fakeRenew = false; this.auth.renew().then(() => {
this.auth.renew(); this.fakeRenew = this.auth.isRenewing;
});
}, 200); }, 200);
} }

View File

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

View File

@ -26,7 +26,7 @@
{{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}} {{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}}
{{#if this.auth.authData.renewable}} {{#if this.auth.authData.renewable}}
<li class="action"> <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 Renew token
</button> </button>
</li> </li>