Revert "Use backup physical_id for progress updates matching" (#5060)

* Revert "Use backup physical_id for progress updates matching"

This reverts commit de2f6275b97376fb92497399eba848ae1ace7b01.

* Fix page crash on backups page reload
This commit is contained in:
François-Xavier Talbot
2026-01-07 17:28:57 -05:00
committed by GitHub
parent 3fd6ce1b6d
commit 14d227a1a3
6 changed files with 17 additions and 23 deletions

View File

@@ -174,7 +174,6 @@ export namespace Archon {
export type Backup = {
id: string
physical_id?: string
name: string
created_at: string
automated: boolean

View File

@@ -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!.physical_id ?? currentBackup.value!.id, {
ctx.backupsState.set(currentBackup.value!.id, {
restore: { progress: 0, state: 'ongoing' },
})
modal.value?.hide()

View File

@@ -242,11 +242,10 @@ const {
})
const deleteMutation = useMutation({
mutationFn: ({ id }: { id: string; physicalId: string }) =>
client.archon.backups_v0.delete(serverId, id),
onSuccess: (_data, { physicalId }) => {
markBackupCancelled(physicalId)
backupsState.delete(physicalId)
mutationFn: (backupId: string) => client.archon.backups_v0.delete(serverId, backupId),
onSuccess: (_data, backupId) => {
markBackupCancelled(backupId)
backupsState.delete(backupId)
queryClient.invalidateQueries({ queryKey: backupsQueryKey })
},
})
@@ -260,7 +259,7 @@ const backups = computed(() => {
if (!backupsData.value) return []
const merged = backupsData.value.map((backup) => {
const progressState = backupsState.get(backup.physical_id ?? backup.id)
const progressState = backupsState.get(backup.id)
if (progressState) {
const hasOngoingTask = Object.values(progressState).some((task) => task?.state === 'ongoing')
const hasCompletedTask = Object.values(progressState).some((task) => task?.state === 'done')
@@ -404,19 +403,16 @@ function deleteBackup(backup?: Archon.Backups.v1.Backup) {
return
}
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,
})
},
deleteMutation.mutate(backup.id, {
onError: (err) => {
const message = err instanceof Error ? err.message : String(err)
addNotification({
type: 'error',
title: 'Error deleting backup',
text: message,
})
},
)
})
}
</script>

View File

@@ -2,7 +2,6 @@ import type { WSBackupState, WSBackupTask } from './websocket'
export interface Backup {
id: string
physical_id?: string
name: string
created_at: string
automated: boolean