From db5abbdf81ee67f771fe052bc01a0b3179d22973 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 20 Oct 2021 12:40:26 -0500 Subject: [PATCH 1/4] fixes loading spinner --- ui/app/components/auth-info.js | 12 +++++------- ui/app/templates/components/auth-info.hbs | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ui/app/components/auth-info.js b/ui/app/components/auth-info.js index 9f77ebc28d9a..90864b67344a 100644 --- a/ui/app/components/auth-info.js +++ b/ui/app/components/auth-info.js @@ -21,11 +21,7 @@ export default class AuthInfoComponent extends Component { @service router; @tracked - fakeRenew = false; - - get isRenewing() { - return this.fakeRenew || this.auth.isRenewing; - } + isRenewing = false; transitionToRoute() { this.router.transitionTo(...arguments); @@ -38,10 +34,12 @@ export default class AuthInfoComponent extends Component { @action renewToken() { - this.fakeRenew = true; + this.isRenewing = true; + console.log('1'); run.later(() => { - this.fakeRenew = false; this.auth.renew(); + this.isRenewing = false; + console.log('2'); }, 200); } diff --git a/ui/app/templates/components/auth-info.hbs b/ui/app/templates/components/auth-info.hbs index a158e7b9d2f2..dc1660ae4217 100644 --- a/ui/app/templates/components/auth-info.hbs +++ b/ui/app/templates/components/auth-info.hbs @@ -26,7 +26,7 @@ {{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}} {{#if this.auth.authData.renewable}}
  • -
  • From c09ac1930e7b26454beceaeca68d38836150d26e Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 20 Oct 2021 14:27:43 -0500 Subject: [PATCH 2/4] correctly stops spinner --- ui/app/components/auth-info.js | 8 +++----- ui/app/templates/components/auth-info.hbs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/ui/app/components/auth-info.js b/ui/app/components/auth-info.js index 90864b67344a..335a7d365a41 100644 --- a/ui/app/components/auth-info.js +++ b/ui/app/components/auth-info.js @@ -21,7 +21,7 @@ export default class AuthInfoComponent extends Component { @service router; @tracked - isRenewing = false; + fakeRenew = false; transitionToRoute() { this.router.transitionTo(...arguments); @@ -34,12 +34,10 @@ export default class AuthInfoComponent extends Component { @action renewToken() { - this.isRenewing = true; - console.log('1'); + this.fakeRenew = true; run.later(() => { this.auth.renew(); - this.isRenewing = false; - console.log('2'); + this.fakeRenew = false; }, 200); } diff --git a/ui/app/templates/components/auth-info.hbs b/ui/app/templates/components/auth-info.hbs index dc1660ae4217..6ce8cab2d0b7 100644 --- a/ui/app/templates/components/auth-info.hbs +++ b/ui/app/templates/components/auth-info.hbs @@ -26,7 +26,7 @@ {{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}} {{#if this.auth.authData.renewable}}
  • -
  • From d3e3b2f6b09c852772b00955f4eccc77d992cf51 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 20 Oct 2021 15:30:20 -0500 Subject: [PATCH 3/4] re-adds getter and sets service isRenewing attr --- ui/app/components/auth-info.js | 9 +++++++-- ui/app/services/auth.js | 7 ++++--- ui/app/templates/components/auth-info.hbs | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/app/components/auth-info.js b/ui/app/components/auth-info.js index 335a7d365a41..602770edfb7b 100644 --- a/ui/app/components/auth-info.js +++ b/ui/app/components/auth-info.js @@ -23,6 +23,10 @@ export default class AuthInfoComponent extends Component { @tracked fakeRenew = false; + get isRenewing() { + return this.fakeRenew || this.auth.isRenewing; + } + transitionToRoute() { this.router.transitionTo(...arguments); } @@ -36,8 +40,9 @@ export default class AuthInfoComponent extends Component { renewToken() { this.fakeRenew = true; run.later(() => { - this.auth.renew(); - this.fakeRenew = false; + this.auth.renew().then(() => { + this.fakeRenew = this.auth.isRenewing; + }); }, 200); } diff --git a/ui/app/services/auth.js b/ui/app/services/auth.js index d8ceb145516a..005f0dbd51c2 100644 --- a/ui/app/services/auth.js +++ b/ui/app/services/auth.js @@ -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; } ); diff --git a/ui/app/templates/components/auth-info.hbs b/ui/app/templates/components/auth-info.hbs index 6ce8cab2d0b7..5b24756eb504 100644 --- a/ui/app/templates/components/auth-info.hbs +++ b/ui/app/templates/components/auth-info.hbs @@ -26,7 +26,7 @@ {{#if (is-before (now interval=1000) this.auth.tokenExpirationDate)}} {{#if this.auth.authData.renewable}}
  • -
  • From e5deb162429a54a1c9dcc2a7c2ffa7dde5323772 Mon Sep 17 00:00:00 2001 From: Claire Bontempo Date: Wed, 20 Oct 2021 16:00:33 -0500 Subject: [PATCH 4/4] adds changelog --- changelog/12887.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/12887.txt diff --git a/changelog/12887.txt b/changelog/12887.txt new file mode 100644 index 000000000000..92ce4c86a520 --- /dev/null +++ b/changelog/12887.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Remove spinner after token renew +```