mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-31 21:49:52 +00:00
Major additions: - Complete Next.js studio application with 1600+ components - Docker support (Dockerfile.combined, docker-compose.yml) - GCP deployment documentation and benchmarks - SQL benchmark scripts for performance testing - Sentry integration for monitoring - Comprehensive test suite and mocks Studio features: - Dashboard and admin interfaces - Data visualization components - Authentication and user management - API integration with RuVector backend - Static data and public assets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { useState, useEffect } from 'react'
|
|
|
|
import { useWorkflowRunsQuery } from 'data/workflow-runs/workflow-runs-query'
|
|
import { useWorkflowRunQuery } from 'data/workflow-runs/workflow-run-query'
|
|
|
|
interface UseWorkflowManagementProps {
|
|
workflowRunId?: string
|
|
projectRef?: string
|
|
onWorkflowComplete?: (status: string) => void
|
|
}
|
|
|
|
export const useWorkflowManagement = ({
|
|
workflowRunId,
|
|
projectRef,
|
|
onWorkflowComplete,
|
|
}: UseWorkflowManagementProps) => {
|
|
const [hasRefetched, setHasRefetched] = useState(false)
|
|
|
|
// Get workflow runs and logs
|
|
const { data: workflowRuns } = useWorkflowRunsQuery(
|
|
{ projectRef },
|
|
{
|
|
enabled: Boolean(workflowRunId),
|
|
refetchInterval: 3000,
|
|
refetchOnMount: 'always',
|
|
staleTime: 0,
|
|
}
|
|
)
|
|
|
|
const { data: workflowRunLogs } = useWorkflowRunQuery(
|
|
{ projectRef, workflowRunId },
|
|
{
|
|
refetchInterval: 2000,
|
|
refetchOnMount: 'always',
|
|
staleTime: 0,
|
|
}
|
|
)
|
|
|
|
// Find current workflow run
|
|
const currentWorkflowRun = workflowRuns?.find((run) => run.id === workflowRunId)
|
|
|
|
// Handle workflow completion
|
|
useEffect(() => {
|
|
if (!currentWorkflowRun?.status || !workflowRunId) return
|
|
|
|
const isComplete = ['FUNCTIONS_DEPLOYED', 'MIGRATIONS_FAILED', 'FUNCTIONS_FAILED'].includes(
|
|
currentWorkflowRun.status
|
|
)
|
|
|
|
// Only refetch once per workflow completion
|
|
if (isComplete && !hasRefetched) {
|
|
setHasRefetched(true)
|
|
onWorkflowComplete?.(currentWorkflowRun.status)
|
|
}
|
|
}, [currentWorkflowRun?.status, workflowRunId, hasRefetched, onWorkflowComplete])
|
|
|
|
// Reset refetch flag when workflow ID changes
|
|
useEffect(() => {
|
|
setHasRefetched(false)
|
|
}, [workflowRunId])
|
|
|
|
return {
|
|
currentWorkflowRun,
|
|
workflowRunLogs: workflowRunLogs?.logs,
|
|
}
|
|
}
|