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 d8fb8c0b07 - Show all commits

View File

@ -1,13 +1,6 @@
import { defineStore } from 'pinia'
import { useNotifs } from '@/stores/notifications'
// Not sure if this is the best way to deal with those notifications. It feels a
// bit spaghetto to have one Pinia store influence another. Maybe move this to
// the app level once the Workers and Settings views are fleshed out. Maybe
// that'll cause the Notifications popover to be handled at the app-global
// level, instead of per view, creating a better place to put this logic.
const notifs = useNotifs();
/**
* Status of the SocketIO/Websocket connection to Flamenco Manager.
*/
@ -30,7 +23,7 @@ export const useSocketStatus = defineStore('socket-status', {
// Only patch the state if it actually will change.
if (!this.isConnected)
return;
notifs.add(`Connection to Flamenco Manager lost`);
this._get_notifs().add(`Connection to Flamenco Manager lost`);
this.$patch({
isConnected: false,
wasEverDisconnected: true,
@ -46,11 +39,20 @@ export const useSocketStatus = defineStore('socket-status', {
return;
if (this.wasEverDisconnected)
notifs.add("Connection to Flamenco Manager established");
this._get_notifs().add("Connection to Flamenco Manager established");
this.$patch({
isConnected: true,
message: "",
});
},
_get_notifs() {
// Not sure if this is the best way to deal with those notifications. It feels a
// bit spaghetto to have one Pinia store influence another. Maybe move this to
// the app level once the Workers and Settings views are fleshed out. Maybe
// that'll cause the Notifications popover to be handled at the app-global
// level, instead of per view, creating a better place to put this logic.
return useNotifs();
}
}
})