From 6656c6601dd883c411d0bbacf044cabe6b349198 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Thu, 14 Nov 2019 10:55:44 -0700 Subject: [PATCH 1/2] Setup observed property on init rather than default to object @ boot `templateChanged` which loads the content of what we need for a MC app was updated to watch a new property, `editable: { selectedTemplateUrl } `. The new property was declared on the component as a object. Observers watching a static object and that have never been fetched do not recompute. If we set the property on init to the object it would have been declared with then additional sets on the watched property cause the observer to recompute. rancher/rancher#24057 --- .../components/new-multi-cluster-app/component.js | 11 +++++++---- lib/shared/addon/mixins/catalog-app.js | 7 ++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/global-admin/addon/components/new-multi-cluster-app/component.js b/lib/global-admin/addon/components/new-multi-cluster-app/component.js index 8ec237be5..422afb6fd 100644 --- a/lib/global-admin/addon/components/new-multi-cluster-app/component.js +++ b/lib/global-admin/addon/components/new-multi-cluster-app/component.js @@ -85,10 +85,7 @@ export default Component.extend(NewOrEdit, CatalogApp, { isClone: false, projectsToAddOnUpgrade: null, projectsToRemoveOnUpgrade: null, - editable: { - selectedTemplateUrl: null, - multiClusterApp: { targets: [], }, - }, + editable: null, mcAppIsSaving: false, overridesHeaders: OVERRIDE_HEADERS, @@ -101,6 +98,11 @@ export default Component.extend(NewOrEdit, CatalogApp, { init() { this._super(...arguments); + set(this, 'editable', { + selectedTemplateUrl: null, + multiClusterApp: { targets: [], }, + }); + this.initAttrs(); this.initUpgradeStrategy(); @@ -110,6 +112,7 @@ export default Component.extend(NewOrEdit, CatalogApp, { } else { this.initSelectedTemplateModel(); } + set(this, 'editable.selectedTemplateUrl', get(this, 'selectedTemplateUrl')); }); if (get(this, 'multiClusterApp.targets')) { diff --git a/lib/shared/addon/mixins/catalog-app.js b/lib/shared/addon/mixins/catalog-app.js index 854bd674a..8b243a848 100644 --- a/lib/shared/addon/mixins/catalog-app.js +++ b/lib/shared/addon/mixins/catalog-app.js @@ -7,6 +7,7 @@ import { compare as compareVersion } from 'ui/utils/parse-version'; import { stringifyAnswer } from 'shared/utils/evaluate'; import C from 'ui/utils/constants'; import { evaluate } from 'shared/utils/evaluate'; +import { isEmpty } from '@ember/utils'; export default Mixin.create({ previewTabDidChange: observer('previewTab', 'previewOpen', function() { @@ -35,7 +36,11 @@ export default Mixin.create({ }), templateChanged: observer('editable.selectedTemplateUrl', 'templateResource.defaultVersion', function() { - return this.getTemplate.perform(); + const { editable : { selectedTemplateUrl = '' } } = this; + + if (!isEmpty(selectedTemplateUrl)) { + this.getTemplate.perform(); + } }), filenames: computed('selectedTemplateModel', 'selectedTemplateModel.filesAsArray.[]', function(){ From 5062e53a4522f59744a9f72976f1ad3af14bcae1 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Thu, 14 Nov 2019 11:05:56 -0700 Subject: [PATCH 2/2] Fix borked jQuery targeting in input-password --- lib/shared/addon/components/schema/input-password/component.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared/addon/components/schema/input-password/component.js b/lib/shared/addon/components/schema/input-password/component.js index cf3afc33f..fc6f330ec 100644 --- a/lib/shared/addon/components/schema/input-password/component.js +++ b/lib/shared/addon/components/schema/input-password/component.js @@ -22,7 +22,7 @@ export default Component.extend({ set(this, 'value', randomStr); - var $field = $('INPUT'); + var $field = $(this.element).find('INPUT'); $field.attr('type', 'text'); setTimeout(() => {