forked from didirus/AstralRinth
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:
committed by
GitHub
parent
3fd6ce1b6d
commit
14d227a1a3
@@ -790,7 +790,7 @@ const handleBackupProgress = (data: Archon.Websocket.v0.WSBackupProgressEvent) =
|
||||
'list',
|
||||
serverId,
|
||||
])
|
||||
const backup = backupData?.find((b) => (b.physical_id ?? b.id) === backupId)
|
||||
const backup = backupData?.find((b) => b.id === backupId)
|
||||
|
||||
if (backup?.ongoing && attempt < 3) {
|
||||
// retry 3 times max, archon is slow compared to ws state
|
||||
|
||||
@@ -5,7 +5,7 @@ const { server, isServerRunning } = injectModrinthServerContext()
|
||||
const flags = useFeatureFlags()
|
||||
|
||||
useHead({
|
||||
title: `Backups - ${server.value.name ?? 'Server'} - Modrinth`,
|
||||
title: `Backups - ${server.value?.name ?? 'Server'} - Modrinth`,
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -174,7 +174,6 @@ export namespace Archon {
|
||||
|
||||
export type Backup = {
|
||||
id: string
|
||||
physical_id?: string
|
||||
name: string
|
||||
created_at: string
|
||||
automated: 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!.physical_id ?? currentBackup.value!.id, {
|
||||
ctx.backupsState.set(currentBackup.value!.id, {
|
||||
restore: { progress: 0, state: 'ongoing' },
|
||||
})
|
||||
modal.value?.hide()
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user