From 1bf7671493ffdabc5e1652079bd14ff6a8b4a63f Mon Sep 17 00:00:00 2001 From: Arnav Palnitkar Date: Thu, 20 May 2021 15:37:07 -0700 Subject: [PATCH 1/5] Update cluster status partial to component --- ui/app/components/cluster-info.js | 15 +++++++++++++ ui/app/components/status-menu.js | 11 +--------- .../cluster-info.hbs} | 22 +++++++++---------- ui/app/templates/components/status-menu.hbs | 8 ++++++- ui/app/templates/partials/status/user.hbs | 3 --- 5 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 ui/app/components/cluster-info.js rename ui/app/templates/{partials/status/cluster.hbs => components/cluster-info.hbs} (90%) delete mode 100644 ui/app/templates/partials/status/user.hbs diff --git a/ui/app/components/cluster-info.js b/ui/app/components/cluster-info.js new file mode 100644 index 000000000000..998b6462ac1b --- /dev/null +++ b/ui/app/components/cluster-info.js @@ -0,0 +1,15 @@ +import { inject as service } from '@ember/service'; +import { reads } from '@ember/object/computed'; +import Component from '@ember/component'; + +export default Component.extend({ + auth: service(), + store: service(), + version: service(), + + transitionToRoute: function() { + this.router.transitionTo(...arguments); + }, + + currentToken: reads('auth.currentToken'), +}); diff --git a/ui/app/components/status-menu.js b/ui/app/components/status-menu.js index 8ec26c7c1a12..59bfc2bcf98b 100644 --- a/ui/app/components/status-menu.js +++ b/ui/app/components/status-menu.js @@ -1,5 +1,5 @@ import { inject as service } from '@ember/service'; -import { alias, reads } from '@ember/object/computed'; +import { alias } from '@ember/object/computed'; import Component from '@ember/component'; import { computed } from '@ember/object'; @@ -7,14 +7,9 @@ export default Component.extend({ currentCluster: service('current-cluster'), cluster: alias('currentCluster.cluster'), auth: service(), - store: service(), media: service(), - version: service(), type: 'cluster', itemTag: null, - partialName: computed('type', function() { - return `partials/status/${this.type}`; - }), glyphName: computed('type', function() { const glyphs = { cluster: 'status-indicator', @@ -22,8 +17,4 @@ export default Component.extend({ }; return glyphs[this.type]; }), - activeCluster: computed('auth.activeCluster', function() { - return this.store.peekRecord('cluster', this.auth.activeCluster); - }), - currentToken: reads('auth.currentToken'), }); diff --git a/ui/app/templates/partials/status/cluster.hbs b/ui/app/templates/components/cluster-info.hbs similarity index 90% rename from ui/app/templates/partials/status/cluster.hbs rename to ui/app/templates/components/cluster-info.hbs index 974400cb6bf1..448dc1e8e334 100644 --- a/ui/app/templates/partials/status/cluster.hbs +++ b/ui/app/templates/components/cluster-info.hbs @@ -1,7 +1,7 @@