diff --git a/lib/shared/addon/components/cru-node-pools/component.js b/lib/shared/addon/components/cru-node-pools/component.js index 020b593a9..1092720e3 100644 --- a/lib/shared/addon/components/cru-node-pools/component.js +++ b/lib/shared/addon/components/cru-node-pools/component.js @@ -97,24 +97,7 @@ export default Component.extend({ init() { this._super(...arguments); - const originalPools = (get(this, 'cluster.nodePools') || []).slice(); - - set(this, 'originalPools', originalPools); - 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({ - type: 'nodePool', - quantity: 1, - worker: true, - })); - } - - if (this.registerHook) { - this.registerHook(this.savePools.bind(this), 'savePools') - } - - this.setDefaultNodeTemplate(); + this.initNodePools() }, didReceiveAttrs() { @@ -158,6 +141,10 @@ export default Component.extend({ }, }, + reloadNodePools: observer('nodeTemplates', function(){ + this.initNodePools() + }), + setDefaultNodeTemplate: observer('driver', function() { const templates = get(this, 'filteredNodeTemplates') || []; @@ -307,6 +294,27 @@ export default Component.extend({ } }), + initNodePools(){ + const originalPools = (get(this, 'cluster.nodePools') || []).slice(); + + set(this, 'originalPools', originalPools); + 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({ + type: 'nodePool', + quantity: 1, + worker: true, + })); + } + + if (this.registerHook) { + this.registerHook(this.savePools.bind(this), 'savePools') + } + + this.setDefaultNodeTemplate(); + }, + savePools() { if (this.isDestroyed || this.isDestroying || get(this, 'driver') === 'custom' ) { return; diff --git a/lib/shared/addon/components/form-members/component.js b/lib/shared/addon/components/form-members/component.js index 4da264558..ccce7012a 100644 --- a/lib/shared/addon/components/form-members/component.js +++ b/lib/shared/addon/components/form-members/component.js @@ -36,6 +36,10 @@ export default Component.extend({ } }, + didReceiveAttrs(){ + this.buildUpdateList(get(this, 'primaryResource')) + }, + actions: { cancel() { this.goBack();