forked from didirus/AstralRinth
* 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>
33 lines
937 B
TypeScript
33 lines
937 B
TypeScript
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')
|