Merge pull request #15322 from torchiaf/backport-15313-2.12

[2.12.2] Fix missing Fleet clusters updates after saving
This commit is contained in:
Francesco Torchia 2025-09-04 12:57:10 +02:00 committed by GitHub
commit fa2a1a1654
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 0 deletions

View File

@ -56,10 +56,14 @@ export default {
async save(buttonDone) {
try {
this.errors = [];
await this.value.save();
await this.normanCluster.save();
// Changes (such as labels or annotations fields) to normanCluster are reflected in the fleet cluster via Rancher services, so wait for that to occur
await this.waitForFleetClusterLastRevision();
this.done();
buttonDone(true);
} catch (e) {
@ -67,6 +71,21 @@ export default {
buttonDone(false);
}
},
async waitForFleetClusterLastRevision() {
const inStore = this.$store.getters['currentProduct'].inStore;
const currRev = this.value?.metadata?.resourceVersion;
try {
return await this.value.waitForTestFn(() => {
const rev = this.$store.getters[`${ inStore }/byId`](this.value.type, this.value.id)?.metadata?.resourceVersion;
return currRev && currRev !== rev;
}, `${ this.value.id } - wait for resourceVersion to change`, 1000, 200);
} catch (e) {
}
}
},
};
</script>