Merge pull request #4824 from mantis-toboggan-md/bugfix-cluster-member-refresh

reinitialize node pools and members when cluster changes
This commit is contained in:
Nancy 2022-04-04 08:19:19 -07:00 committed by GitHub
commit d4e4c1ccda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 18 deletions

View File

@ -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;

View File

@ -36,6 +36,10 @@ export default Component.extend({
}
},
didReceiveAttrs(){
this.buildUpdateList(get(this, 'primaryResource'))
},
actions: {
cancel() {
this.goBack();