feat: ws client & new backups frontend (#4813)

* feat: ws client

* feat: v1 backups endpoints

* feat: migrate backups page to api-client and new DI ctx

* feat: switch to ws client via api-client

* fix: disgust

* fix: stats

* fix: console

* feat: v0 backups api

* feat: migrate backups.vue to page system w/ components to ui pkgs

* feat: polish backups frontend

* feat: pending refactor for ws handling of backups

* fix: vue shit

* fix: cancel logic fix

* fix: qa issues

* fix: alignment issues for backups page

* fix: bar positioning

* feat: finish QA

* fix: icons

* fix: lint & i18n

* fix: clear comment

* lint

---------

Co-authored-by: Prospector <6166773+Prospector@users.noreply.github.com>
This commit is contained in:
Calum H.
2025-12-04 02:32:03 +00:00
committed by GitHub
parent e3444a3456
commit 8eff939039
43 changed files with 2466 additions and 1177 deletions

View File

@@ -80,4 +80,5 @@ export function createContext<ContextValue>(
export * from './api-client'
export * from './project-page'
export * from './server-context'
export * from './web-notifications'

View File

@@ -0,0 +1,32 @@
import type { Archon } from '@modrinth/api-client'
import type { ComputedRef, Reactive, Ref } from 'vue'
import { createContext } from '.'
export type BackupTaskState = {
progress: number
state: Archon.Backups.v1.BackupState
}
export type BackupProgressEntry = {
file?: BackupTaskState
create?: BackupTaskState
restore?: BackupTaskState
}
export type BackupsState = Map<string, BackupProgressEntry>
export interface ModrinthServerContext {
readonly serverId: string
readonly server: Ref<Archon.Servers.v0.Server>
// Websocket state
readonly isConnected: Ref<boolean>
readonly powerState: Ref<Archon.Websocket.v0.PowerState>
readonly isServerRunning: ComputedRef<boolean>
readonly backupsState: Reactive<BackupsState>
markBackupCancelled: (backupId: string) => void
}
export const [injectModrinthServerContext, provideModrinthServerContext] =
createContext<ModrinthServerContext>('[id].vue', 'modrinthServerContext')