feat: Add frontend support for one-click Rust server deployment
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
All checks were successful
Test Asgard Runner / test (push) Successful in 2s
Adds DeploymentConfig/DeploymentStatus types, deployment state management in the server store, tabbed Linux/Windows quick setup commands, and a Deploy Rust Server card with progress tracker and configuration form. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import type { ServerConnection, ServerConfig, ServerStats } from '@/types'
|
||||
import type { ServerConnection, ServerConfig, ServerStats, DeploymentConfig, DeploymentStatus } from '@/types'
|
||||
import { useApi } from '@/composables/useApi'
|
||||
|
||||
export const useServerStore = defineStore('server', () => {
|
||||
@@ -8,6 +8,8 @@ export const useServerStore = defineStore('server', () => {
|
||||
const config = ref<ServerConfig | null>(null)
|
||||
const stats = ref<ServerStats | null>(null)
|
||||
const isLoading = ref(false)
|
||||
const deploymentStatus = ref<DeploymentStatus | null>(null)
|
||||
const isDeploying = ref(false)
|
||||
|
||||
const api = useApi()
|
||||
|
||||
@@ -50,6 +52,30 @@ export const useServerStore = defineStore('server', () => {
|
||||
return api.post('/servers/restart')
|
||||
}
|
||||
|
||||
async function deployServer(config: DeploymentConfig) {
|
||||
isDeploying.value = true
|
||||
deploymentStatus.value = null
|
||||
try {
|
||||
await api.post('/servers/deploy', config)
|
||||
} catch (e) {
|
||||
console.error('Failed to start deployment:', e)
|
||||
isDeploying.value = false
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
function updateDeploymentStatus(status: DeploymentStatus) {
|
||||
deploymentStatus.value = status
|
||||
if (status.stage === 'online' || status.stage === 'failed') {
|
||||
isDeploying.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function clearDeploymentStatus() {
|
||||
deploymentStatus.value = null
|
||||
isDeploying.value = false
|
||||
}
|
||||
|
||||
function updateStats(newStats: ServerStats) {
|
||||
stats.value = newStats
|
||||
}
|
||||
@@ -59,12 +85,17 @@ export const useServerStore = defineStore('server', () => {
|
||||
config,
|
||||
stats,
|
||||
isLoading,
|
||||
deploymentStatus,
|
||||
isDeploying,
|
||||
fetchServer,
|
||||
updateConfig,
|
||||
sendCommand,
|
||||
startServer,
|
||||
stopServer,
|
||||
restartServer,
|
||||
deployServer,
|
||||
updateDeploymentStatus,
|
||||
clearDeploymentStatus,
|
||||
updateStats,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user