feat: qa improvements for backups page (#4857)

* feat: fix backup action disabling logic

* feat: allow actions when backup is being created

* feat: qa fixes

* feat: backups empty state

* fix: lint

* intl:extract

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2025-12-05 01:48:34 +00:00
committed by GitHub
parent 0f1f27d450
commit 41e4086973
8 changed files with 139 additions and 88 deletions

View File

@@ -76,12 +76,10 @@ export abstract class AbstractWebSocketClient {
): () => void {
const eventKey = `${serverId}:${eventType}` as keyof WSEventMap
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.emitter.on(eventKey, handler as any)
this.emitter.on(eventKey, handler as () => void)
return () => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.emitter.off(eventKey, handler as any)
this.emitter.off(eventKey, handler as () => void)
}
}

View File

@@ -7,6 +7,8 @@ type WSEventMap = {
[K in Archon.Websocket.v0.WSEvent as `${string}:${K['event']}`]: K
}
const NORMAL_CLOSURE = 1000
export class GenericWebSocketClient extends AbstractWebSocketClient {
protected emitter = mitt<WSEventMap>()
@@ -55,7 +57,7 @@ export class GenericWebSocketClient extends AbstractWebSocketClient {
}
ws.onclose = (event) => {
if (event.code !== 1000) {
if (event.code !== NORMAL_CLOSURE) {
this.scheduleReconnect(serverId, auth)
}
}
@@ -83,7 +85,7 @@ export class GenericWebSocketClient extends AbstractWebSocketClient {
connection.socket.readyState === WebSocket.OPEN ||
connection.socket.readyState === WebSocket.CONNECTING
) {
connection.socket.close(1000, 'Client disconnecting')
connection.socket.close(NORMAL_CLOSURE, 'Client disconnecting')
}
this.emitter.all.forEach((_handlers, type) => {