mirror of https://github.com/rancher/ui.git
gke project id not set before fetching cluster resources
this issue cropped up after a large dependency upgrade and I believe it has to do with some underlying ember changes. Basically we'd hit a race condition where we'd click next before the observer has had a chance to update the project id. Found an additional issue where the observer on zone change would cause all the fetchs to fire again after the cluster has saved because we merge the results, I added checks to see if we'd saved as saving was already set false but we hadn't started destroying yet. rancher/rancher#29646
This commit is contained in:
parent
046f203b41
commit
8906dd18cd
|
|
@ -325,6 +325,9 @@ export default Component.extend(ClusterDriver, {
|
|||
|
||||
actions: {
|
||||
clickNext() {
|
||||
if (isEmpty(get(this, 'config.projectId'))) {
|
||||
this.parseProjectId();
|
||||
}
|
||||
$('BUTTON[type="submit"]').click();
|
||||
},
|
||||
|
||||
|
|
@ -380,18 +383,7 @@ export default Component.extend(ClusterDriver, {
|
|||
return;
|
||||
}
|
||||
|
||||
const str = get(this, 'config.credential');
|
||||
|
||||
if ( str ) {
|
||||
try {
|
||||
const obj = JSON.parse(str);
|
||||
// Note: this is a Google project id, not ours.
|
||||
const projectId = obj.project_id;
|
||||
|
||||
set(this, 'config.projectId', projectId);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
this.parseProjectId();
|
||||
}),
|
||||
|
||||
zoneChanged: observer('config.zone', 'zones.[]', function() {
|
||||
|
|
@ -668,6 +660,10 @@ export default Component.extend(ClusterDriver, {
|
|||
}),
|
||||
|
||||
fetchZones() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeZones',
|
||||
method: 'POST',
|
||||
|
|
@ -697,6 +693,10 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
fetchVersions() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeVersions',
|
||||
method: 'POST',
|
||||
|
|
@ -720,6 +720,10 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
fetchMachineTypes() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeMachineTypes',
|
||||
method: 'POST',
|
||||
|
|
@ -742,6 +746,10 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
fetchNetworks() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeNetworks',
|
||||
method: 'POST',
|
||||
|
|
@ -768,6 +776,10 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
fetchSubnetworks() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
const zone = get(this, 'config.zone')
|
||||
const locationType = get(this, 'locationType');
|
||||
|
||||
|
|
@ -793,6 +805,10 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
|
||||
fetchServiceAccounts() {
|
||||
if (this.saved) {
|
||||
return;
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeServiceAccounts',
|
||||
method: 'POST',
|
||||
|
|
@ -936,4 +952,18 @@ export default Component.extend(ClusterDriver, {
|
|||
return this._super(...arguments);
|
||||
},
|
||||
|
||||
parseProjectId() {
|
||||
const str = get(this, 'config.credential');
|
||||
|
||||
if ( str ) {
|
||||
try {
|
||||
const obj = JSON.parse(str);
|
||||
// Note: this is a Google project id, not ours.
|
||||
const projectId = obj.project_id;
|
||||
|
||||
set(this, 'config.projectId', projectId);
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue