mirror of https://github.com/rancher/ui.git
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:
commit
d4e4c1ccda
|
|
@ -97,24 +97,7 @@ export default Component.extend({
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
const originalPools = (get(this, 'cluster.nodePools') || []).slice();
|
this.initNodePools()
|
||||||
|
|
||||||
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();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
didReceiveAttrs() {
|
didReceiveAttrs() {
|
||||||
|
|
@ -158,6 +141,10 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
reloadNodePools: observer('nodeTemplates', function(){
|
||||||
|
this.initNodePools()
|
||||||
|
}),
|
||||||
|
|
||||||
setDefaultNodeTemplate: observer('driver', function() {
|
setDefaultNodeTemplate: observer('driver', function() {
|
||||||
const templates = get(this, 'filteredNodeTemplates') || [];
|
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() {
|
savePools() {
|
||||||
if (this.isDestroyed || this.isDestroying || get(this, 'driver') === 'custom' ) {
|
if (this.isDestroyed || this.isDestroying || get(this, 'driver') === 'custom' ) {
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
didReceiveAttrs(){
|
||||||
|
this.buildUpdateList(get(this, 'primaryResource'))
|
||||||
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
cancel() {
|
cancel() {
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue