From 12cff8b54933ea8f1e55fdd72b885f7f33444af6 Mon Sep 17 00:00:00 2001 From: loganhz Date: Tue, 13 Mar 2018 17:31:27 +0800 Subject: [PATCH 1/3] Fix catalog app pods bar issue https://github.com/rancher/rancher/issues/11953 --- app/models/app.js | 11 ++++++++++- .../addon/components/namespace-app/template.hbs | 9 ++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/models/app.js b/app/models/app.js index 0387e33d7..d4bc28fae 100644 --- a/app/models/app.js +++ b/app/models/app.js @@ -1,11 +1,20 @@ import Resource from 'ember-api-store/models/resource'; +import { hasMany } from 'ember-api-store/utils/denormalize'; import { computed, get } from '@ember/object'; import { parseHelmExternalId } from 'ui/utils/parse-externalid'; +import StateCounts from 'ui/mixins/state-counts'; import { inject as service } from '@ember/service'; -const App = Resource.extend({ +const App = Resource.extend(StateCounts, { catalog: service(), router: service(), + pods: hasMany('installNamespace', 'pod', 'namespaceId'), + + init() { + this._super(...arguments); + this.defineStateCounts('pods', 'podStates', 'podCountSort'); + }, + externalIdInfo: computed('externalId', function() { return parseHelmExternalId(get(this, 'externalId')); }), diff --git a/lib/shared/addon/components/namespace-app/template.hbs b/lib/shared/addon/components/namespace-app/template.hbs index 2bc088a21..f92ae7e70 100644 --- a/lib/shared/addon/components/namespace-app/template.hbs +++ b/lib/shared/addon/components/namespace-app/template.hbs @@ -14,13 +14,16 @@
-
+
{{progress-bar-multi labelKey="state" valueKey="count" - values=model.serviceStates.byColor - tooltipValues=model.serviceStates.byName + values=model.podStates.byColor + tooltipValues=model.podStates.byName }} + + {{model.pods.length}} +
{{#upgrade-btn model=model classNames="btn-sm" as |btn|}} {{model.externalIdInfo.version}} From f35f45fbabd19c26f4f23cc0f1487ca5f8a13b80 Mon Sep 17 00:00:00 2001 From: loganhz Date: Tue, 13 Mar 2018 17:59:43 +0800 Subject: [PATCH 2/3] Fix node count issue https://github.com/rancher/rancher/issues/12086 --- lib/shared/addon/components/cru-node-pools/component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared/addon/components/cru-node-pools/component.js b/lib/shared/addon/components/cru-node-pools/component.js index 42b4ea49a..2b885ee7d 100644 --- a/lib/shared/addon/components/cru-node-pools/component.js +++ b/lib/shared/addon/components/cru-node-pools/component.js @@ -71,7 +71,7 @@ export default Component.extend({ this._super(...arguments); const originalPools = (get(this,'cluster.nodePools')||[]).slice(); set(this, 'originalPools', originalPools); - set(this, 'nodePools', originalPools.slice()); + set(this, 'nodePools', originalPools.slice().map(p => p.clone())); if ( get(this, 'mode') === 'new' && get(originalPools, 'length') === 0 ) { get(this, 'nodePools').pushObject(get(this, 'globalStore').createRecord({ From 3b32354eac947b91cfbef65a3dde9329cf1012de Mon Sep 17 00:00:00 2001 From: loganhz Date: Tue, 13 Mar 2018 19:49:55 +0800 Subject: [PATCH 3/3] Fix focus issue https://github.com/rancher/rancher/issues/12056 --- .../components/form-scoped-roles/component.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/shared/addon/components/form-scoped-roles/component.js b/lib/shared/addon/components/form-scoped-roles/component.js index 22b7063ae..53cfd38a5 100644 --- a/lib/shared/addon/components/form-scoped-roles/component.js +++ b/lib/shared/addon/components/form-scoped-roles/component.js @@ -229,6 +229,21 @@ export default Component.extend(NewOrEdit,{ }); }, - } + }, + + didInsertElement() { + next(() => { + if ( this.isDestroyed || this.isDestroying ) { + return; + } + + const elem = this.$('INPUT')[0] + if ( elem ) { + setTimeout(()=>{ + elem.focus(); + }, 250); + } + }); + }, });