Files
AstralRinth/packages/ui/src/providers/server-context.ts
T
Calum H. 620894aecb feat: backups page cleanup before worlds (#5844)
* feat: card alignment + fix modals

* feat: change admon title in restore alert modal

* fix: lint

* feat: backups queue api into api-client

* feat: impl backup queue api endpoints into frontend

* feat: ack fix

* feat: bulk actions

* feat: bulk delete impl

* fix: lint

* fix: align error states

* fix: transition group

* feat: ready for qa

* fix: lint

* feat: qa

* feat: stacked admonitions component

* fix: issues with stacking

* feat: hook up admonition stacking + fix app csp for staging kyros nodes

* fix: logs.vue

* qa: close stack on admonitions click

* fix: all problems with stacked admonitions

* qa: admonition cleanup and copy overhaul draft

* fix: qa issues padding

* fix: padding bug

* feat: qa

* fix: intercom in app csp bug

* fix: positioning intercom

* feat: loading overlay on top of console + admon consistency changes

* feat: scroll indicator fade in backup delete modal + admon timestamp fix

* feat: move action bar behind modal

* fix: lint + i18n

* fix: server ping spam on filter (cache but clear on unmount)

* fix: 1 admon fade in flicker issue

* chore: temp staging undo

* qa: changes

* fix: lint

* chore: revert staging to use staging

* fix: scoping
2026-04-27 19:03:48 +00:00

56 lines
1.8 KiB
TypeScript

import type { Archon, UploadState } from '@modrinth/api-client'
import type { Stats } from '@modrinth/utils'
import type { ComputedRef, Ref } from 'vue'
import type { MessageDescriptor } from '#ui/composables/i18n'
import type { FileOperation } from '#ui/layouts/shared/files-tab/types'
import { createContext } from '.'
export interface BusyReason {
reason: MessageDescriptor
}
export interface FilesystemAuth {
url: string
token: string
}
export interface ModrinthServerContext {
readonly serverId: string
readonly worldId: Ref<string | null>
readonly server: Ref<Archon.Servers.v0.Server>
// Websocket state
readonly isConnected: Ref<boolean>
readonly isWsAuthIncorrect: Ref<boolean>
readonly powerState: Ref<Archon.Websocket.v0.PowerState>
readonly powerStateDetails: Ref<{ oom_killed?: boolean; exit_code?: number } | undefined>
readonly isServerRunning: ComputedRef<boolean>
readonly stats: Ref<Stats>
readonly uptimeSeconds: Ref<number>
// Content sync state
readonly isSyncingContent: Ref<boolean>
// Busy state — when non-empty, all write operations should be disabled
readonly busyReasons: ComputedRef<BusyReason[]>
// Filesystem state
readonly fsAuth: Ref<FilesystemAuth | null>
readonly fsOps: Ref<Archon.Websocket.v0.FilesystemOperation[]>
readonly fsQueuedOps: Ref<Archon.Websocket.v0.QueuedFilesystemOp[]>
refreshFsAuth: () => Promise<void>
// File upload state
readonly uploadState: Ref<UploadState>
readonly cancelUpload: Ref<(() => void) | null>
// File operations (extract, move, etc.)
readonly activeOperations: ComputedRef<FileOperation[]>
dismissOperation: (opId: string, action: 'dismiss' | 'cancel') => Promise<void>
}
export const [injectModrinthServerContext, provideModrinthServerContext] =
createContext<ModrinthServerContext>('[id].vue', 'modrinthServerContext')