chore: full stack stability and migration fixes, plus react UI progress
This commit is contained in:
@@ -12,6 +12,7 @@ export interface Server {
|
||||
id: string
|
||||
name: string
|
||||
template: string
|
||||
pillar: string
|
||||
provider: string
|
||||
ip_address: string
|
||||
status: 'provisioning' | 'starting' | 'active' | 'draining' | 'stopping' | 'stopped' | 'error'
|
||||
@@ -19,6 +20,36 @@ export interface Server {
|
||||
updated_at: string
|
||||
}
|
||||
|
||||
export interface AdminUser {
|
||||
id: string
|
||||
email: string
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export interface Bucket {
|
||||
id: string
|
||||
public: boolean
|
||||
}
|
||||
|
||||
export interface StorageObject {
|
||||
name: string
|
||||
metadata?: {
|
||||
size: number
|
||||
mimetype: string
|
||||
}
|
||||
}
|
||||
|
||||
export interface DbTable {
|
||||
schema: string
|
||||
name: string
|
||||
}
|
||||
|
||||
export interface EdgeFunction {
|
||||
name: string
|
||||
runtime: string
|
||||
code?: string
|
||||
}
|
||||
|
||||
export interface Template {
|
||||
id: string
|
||||
name: string
|
||||
@@ -84,32 +115,60 @@ export interface ScalingStep {
|
||||
total_cost: number
|
||||
}
|
||||
|
||||
// API Functions
|
||||
export const apiService = {
|
||||
// Servers
|
||||
getServers: () => api.get<{ servers: Server[] }>('/servers'),
|
||||
getServers: () => api.get<Server[]>('/servers'),
|
||||
getServer: (id: string) => api.get<Server>(`/servers/${id}`),
|
||||
addServer: (data: AddServerRequest) => api.post('/servers', data),
|
||||
getServer: (id: string) => api.get(`/servers/${id}`),
|
||||
deleteServer: (id: string) => api.delete(`/servers/${id}`),
|
||||
getServerStatus: (id: string) => api.get(`/servers/${id}/status`),
|
||||
removeServer: (id: string) => api.delete(`/servers/${id}`),
|
||||
fortifyServer: (id: string, data: FortifyRequest) => api.post(`/servers/${id}/fortify`, data),
|
||||
|
||||
// Templates
|
||||
getTemplates: () => api.get<{ templates: Template[] }>('/templates'),
|
||||
getTemplate: (id: string) => api.get(`/templates/${id}`),
|
||||
validateTemplate: (id: string) => api.post(`/templates/${id}/validate`),
|
||||
getTemplates: () => api.get<Template[]>('/templates'),
|
||||
getTemplate: (id: string) => api.get<Template>(`/templates/${id}`),
|
||||
|
||||
// Providers
|
||||
getProviders: () => api.get<{ providers: Provider[] }>('/providers'),
|
||||
getProviderPlans: (provider: string) => api.get(`/providers/${provider}/plans`),
|
||||
getProviderRegions: (provider: string) => api.get(`/providers/${provider}/regions`),
|
||||
getProviders: () => api.get<Provider[]>('/providers'),
|
||||
getPlans: (provider: string) => api.get<Plan[]>(`/providers/${provider}/plans`),
|
||||
getRegions: (provider: string) => api.get<any[]>(`/providers/${provider}/regions`),
|
||||
|
||||
// Scaling
|
||||
createScalingPlan: (data: ScalingPlanRequest) => api.post('/cluster/scale-plan', data),
|
||||
createScalingPlan: (data: ScalingPlanRequest) => api.post<ScalingPlan>('/cluster/scale-plan', data),
|
||||
executeScalingPlan: (plan: ScalingStep[]) => api.post('/cluster/scale-execute', plan),
|
||||
|
||||
// Cluster
|
||||
getClusterHealth: () => api.get<ClusterHealth>('/cluster/health'),
|
||||
|
||||
// Users
|
||||
getUsers: () => api.get<AdminUser[]>('/users'),
|
||||
deleteUser: (id: string) => api.delete(`/users/${id}`),
|
||||
|
||||
// Projects
|
||||
getProjects: () => api.get<any[]>('/projects'),
|
||||
createProject: (data: { name: string; owner_id?: string | null }) => api.post('/projects', data),
|
||||
deleteProject: (id: string) => api.delete(`/projects/${id}`),
|
||||
|
||||
// Storage
|
||||
getBuckets: () => api.get<Bucket[]>('/storage/buckets'),
|
||||
getBucketObjects: (bucketId: string) => api.post<StorageObject[]>(`/storage/buckets/${bucketId}/objects`),
|
||||
deleteObject: (bucketId: string, objectName: string) => api.delete(`/storage/${bucketId}/${objectName}`),
|
||||
|
||||
// Database
|
||||
getTables: () => api.get<DbTable[]>('/db/tables'),
|
||||
getTableData: (schema: string, name: string) => api.get<any[]>(`/db/tables/${schema}/${name}`),
|
||||
|
||||
// Functions
|
||||
getFunctions: () => api.get<EdgeFunction[]>('/functions'),
|
||||
getFunction: (name: string) => api.get<EdgeFunction>(`/functions/${name}`),
|
||||
deployFunction: (data: { name: string; runtime: string; code_base64: string }) => api.post('/functions', data),
|
||||
|
||||
// Observability
|
||||
getPillars: () => api.get<any[]>('/cluster/pillars'),
|
||||
getLogs: (params: { query: string; limit: number }) => api.get('/logs', { params }),
|
||||
|
||||
// Auth/Session
|
||||
login: (password: string) => api.post('/login', { password }),
|
||||
logout: () => api.post('/logout'),
|
||||
getAdminConfig: () => api.get('/admin/config'),
|
||||
getCsrfToken: () => api.get<{ token: string }>('/csrf-token'),
|
||||
}
|
||||
|
||||
export interface AddServerRequest {
|
||||
|
||||
Reference in New Issue
Block a user