Use backup physical_id for progress updates matching

This commit is contained in:
François-X. T.
2026-01-05 18:40:18 -05:00
parent 5b890dcd8a
commit de2f6275b9
5 changed files with 22 additions and 16 deletions
@@ -753,7 +753,7 @@ const handleBackupProgress = (data: Archon.Websocket.v0.WSBackupProgressEvent) =
'list',
serverId,
])
const backup = backupData?.find((b) => b.id === backupId)
const backup = backupData?.find((b) => (b.physical_id ?? b.id) === backupId)
if (backup?.ongoing && attempt < 3) {
// retry 3 times max, archon is slow compared to ws state
@@ -138,6 +138,7 @@ export namespace Archon {
export type Backup = {
id: string
physical_id?: string
name: string
created_at: string
locked: boolean
@@ -87,7 +87,7 @@ const restoreBackup = () => {
restoreMutation.mutate(currentBackup.value.id, {
onSuccess: () => {
// Optimistically update backupsState to show restore in progress immediately
ctx.backupsState.set(currentBackup.value!.id, {
ctx.backupsState.set(currentBackup.value!.physical_id ?? currentBackup.value!.id, {
restore: { progress: 0, state: 'ongoing' },
})
modal.value?.hide()
@@ -251,10 +251,11 @@ const {
})
const deleteMutation = useMutation({
mutationFn: (backupId: string) => client.archon.backups_v0.delete(serverId, backupId),
onSuccess: (_data, backupId) => {
markBackupCancelled(backupId)
backupsState.delete(backupId)
mutationFn: ({ id }: { id: string; physicalId: string }) =>
client.archon.backups_v0.delete(serverId, id),
onSuccess: (_data, { physicalId }) => {
markBackupCancelled(physicalId)
backupsState.delete(physicalId)
queryClient.invalidateQueries({ queryKey: backupsQueryKey })
},
})
@@ -278,7 +279,7 @@ const backups = computed(() => {
if (!backupsData.value) return []
const merged = backupsData.value.map((backup) => {
const progressState = backupsState.get(backup.id)
const progressState = backupsState.get(backup.physical_id ?? backup.id)
if (progressState) {
const hasOngoingTask = Object.values(progressState).some((task) => task?.state === 'ongoing')
const hasCompletedTask = Object.values(progressState).some((task) => task?.state === 'done')
@@ -443,16 +444,19 @@ function deleteBackup(backup?: Archon.Backups.v1.Backup) {
return
}
deleteMutation.mutate(backup.id, {
onError: (err) => {
const message = err instanceof Error ? err.message : String(err)
addNotification({
type: 'error',
title: 'Error deleting backup',
text: message,
})
deleteMutation.mutate(
{ id: backup.id, physicalId: backup.physical_id ?? backup.id },
{
onError: (err) => {
const message = err instanceof Error ? err.message : String(err)
addNotification({
type: 'error',
title: 'Error deleting backup',
text: message,
})
},
},
})
)
}
</script>
+1
View File
@@ -2,6 +2,7 @@ import type { WSBackupState, WSBackupTask } from './websocket'
export interface Backup {
id: string
physical_id?: string
name: string
created_at: string
locked: boolean