Fix #99410: SocketIO Reconnect Web Interface #104235

Merged
Sybren A. Stüvel merged 8 commits from Evelinealy/flamenco:socketio-web-interface into main 2023-07-21 17:16:51 +02:00
Showing only changes of commit 09333db822 - Show all commits

View File

@ -49,15 +49,16 @@ export default {
flamencoVersion: DEFAULT_FLAMENCO_VERSION,
backendURL: backendURL,
}),
mounted() {
window.app = this;
this.fetchManagerInfo();
const sockStatus = useSocketStatus();
this.$watch(() => sockStatus.isConnected, (isConnected) => {
dr.sybren marked this conversation as resolved

This should also check sockStatus.wasEverDisconnected, otherwise it'll also respond to the initial connection.

This should also check `sockStatus.wasEverDisconnected`, otherwise it'll also respond to the initial connection.
if (isConnected) {
this.socketIOReconnect();
}
if (!isConnected) return;
if (!sockStatus.wasEverDisconnected) return;
this.socketIOReconnect();
});
},
@ -72,14 +73,14 @@ export default {
},
socketIOReconnect() {
this.fetchManagerInfo()
if (this.flamencoVersion !== DEFAULT_FLAMENCO_VERSION || this.flamencoName !== DEFAULT_FLAMENCO_NAME ) {
console.log(`Upgraded Flamenco Version: ${this.flamencoVersion}`);
// Reload the page
const metaAPI = new API.MetaApi(getAPIClient())
metaAPI.getVersion().then((version) => {
if (version.name === this.flamencoName && version.version == this.flamencoVersion)
return;
console.log(`Updated from ${this.flamencoVersion} to ${version.version}`);
location.reload();
}
}
});
},
},
}
</script>