You've already forked AstralRinth
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',
|
'list',
|
||||||
serverId,
|
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) {
|
if (backup?.ongoing && attempt < 3) {
|
||||||
// retry 3 times max, archon is slow compared to ws state
|
// retry 3 times max, archon is slow compared to ws state
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ const { server, isServerRunning } = injectModrinthServerContext()
|
|||||||
const flags = useFeatureFlags()
|
const flags = useFeatureFlags()
|
||||||
|
|
||||||
useHead({
|
useHead({
|
||||||
title: `Backups - ${server.value.name ?? 'Server'} - Modrinth`,
|
title: `Backups - ${server.value?.name ?? 'Server'} - Modrinth`,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ export namespace Archon {
|
|||||||
|
|
||||||
export type Backup = {
|
export type Backup = {
|
||||||
id: string
|
id: string
|
||||||
physical_id?: string
|
|
||||||
name: string
|
name: string
|
||||||
created_at: string
|
created_at: string
|
||||||
automated: boolean
|
automated: boolean
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const restoreBackup = () => {
|
|||||||
restoreMutation.mutate(currentBackup.value.id, {
|
restoreMutation.mutate(currentBackup.value.id, {
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
// Optimistically update backupsState to show restore in progress immediately
|
// 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' },
|
restore: { progress: 0, state: 'ongoing' },
|
||||||
})
|
})
|
||||||
modal.value?.hide()
|
modal.value?.hide()
|
||||||
|
|||||||
@@ -242,11 +242,10 @@ const {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const deleteMutation = useMutation({
|
const deleteMutation = useMutation({
|
||||||
mutationFn: ({ id }: { id: string; physicalId: string }) =>
|
mutationFn: (backupId: string) => client.archon.backups_v0.delete(serverId, backupId),
|
||||||
client.archon.backups_v0.delete(serverId, id),
|
onSuccess: (_data, backupId) => {
|
||||||
onSuccess: (_data, { physicalId }) => {
|
markBackupCancelled(backupId)
|
||||||
markBackupCancelled(physicalId)
|
backupsState.delete(backupId)
|
||||||
backupsState.delete(physicalId)
|
|
||||||
queryClient.invalidateQueries({ queryKey: backupsQueryKey })
|
queryClient.invalidateQueries({ queryKey: backupsQueryKey })
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -260,7 +259,7 @@ const backups = computed(() => {
|
|||||||
if (!backupsData.value) return []
|
if (!backupsData.value) return []
|
||||||
|
|
||||||
const merged = backupsData.value.map((backup) => {
|
const merged = backupsData.value.map((backup) => {
|
||||||
const progressState = backupsState.get(backup.physical_id ?? backup.id)
|
const progressState = backupsState.get(backup.id)
|
||||||
if (progressState) {
|
if (progressState) {
|
||||||
const hasOngoingTask = Object.values(progressState).some((task) => task?.state === 'ongoing')
|
const hasOngoingTask = Object.values(progressState).some((task) => task?.state === 'ongoing')
|
||||||
const hasCompletedTask = Object.values(progressState).some((task) => task?.state === 'done')
|
const hasCompletedTask = Object.values(progressState).some((task) => task?.state === 'done')
|
||||||
@@ -404,19 +403,16 @@ function deleteBackup(backup?: Archon.Backups.v1.Backup) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteMutation.mutate(
|
deleteMutation.mutate(backup.id, {
|
||||||
{ id: backup.id, physicalId: backup.physical_id ?? backup.id },
|
onError: (err) => {
|
||||||
{
|
const message = err instanceof Error ? err.message : String(err)
|
||||||
onError: (err) => {
|
addNotification({
|
||||||
const message = err instanceof Error ? err.message : String(err)
|
type: 'error',
|
||||||
addNotification({
|
title: 'Error deleting backup',
|
||||||
type: 'error',
|
text: message,
|
||||||
title: 'Error deleting backup',
|
})
|
||||||
text: message,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import type { WSBackupState, WSBackupTask } from './websocket'
|
|||||||
|
|
||||||
export interface Backup {
|
export interface Backup {
|
||||||
id: string
|
id: string
|
||||||
physical_id?: string
|
|
||||||
name: string
|
name: string
|
||||||
created_at: string
|
created_at: string
|
||||||
automated: boolean
|
automated: boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user