mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-20 04:17:57 -05:00
use reactquery
This commit is contained in:
@@ -131,12 +131,10 @@ export const POST = withMcpAuth('write')(
|
||||
})
|
||||
.returning()
|
||||
|
||||
// If workflowIds are provided, create tools for each workflow
|
||||
const workflowIds: string[] = body.workflowIds || []
|
||||
const addedTools: Array<{ workflowId: string; toolName: string }> = []
|
||||
|
||||
if (workflowIds.length > 0) {
|
||||
// Fetch all workflows in one query
|
||||
const workflows = await db
|
||||
.select({
|
||||
id: workflow.id,
|
||||
@@ -148,9 +146,7 @@ export const POST = withMcpAuth('write')(
|
||||
.from(workflow)
|
||||
.where(inArray(workflow.id, workflowIds))
|
||||
|
||||
// Create tools for each valid workflow
|
||||
for (const workflowRecord of workflows) {
|
||||
// Skip if workflow doesn't belong to this workspace
|
||||
if (workflowRecord.workspaceId !== workspaceId) {
|
||||
logger.warn(
|
||||
`[${requestId}] Skipping workflow ${workflowRecord.id} - does not belong to workspace`
|
||||
@@ -158,13 +154,11 @@ export const POST = withMcpAuth('write')(
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip if workflow is not deployed
|
||||
if (!workflowRecord.isDeployed) {
|
||||
logger.warn(`[${requestId}] Skipping workflow ${workflowRecord.id} - not deployed`)
|
||||
continue
|
||||
}
|
||||
|
||||
// Skip if workflow doesn't have a start block
|
||||
const hasStartBlock = await hasValidStartBlock(workflowRecord.id)
|
||||
if (!hasStartBlock) {
|
||||
logger.warn(`[${requestId}] Skipping workflow ${workflowRecord.id} - no start block`)
|
||||
|
||||
@@ -59,7 +59,7 @@ interface ServerDetailViewProps {
|
||||
type McpClientType = 'cursor' | 'claude-code' | 'claude-desktop' | 'vscode'
|
||||
|
||||
function ServerDetailView({ workspaceId, serverId, onBack }: ServerDetailViewProps) {
|
||||
const { data, isLoading, error, refetch } = useWorkflowMcpServer(workspaceId, serverId)
|
||||
const { data, isLoading, error } = useWorkflowMcpServer(workspaceId, serverId)
|
||||
const { data: deployedWorkflows = [], isLoading: isLoadingWorkflows } =
|
||||
useDeployedWorkflows(workspaceId)
|
||||
const deleteToolMutation = useDeleteWorkflowMcpTool()
|
||||
@@ -146,7 +146,6 @@ function ServerDetailView({ workspaceId, serverId, onBack }: ServerDetailViewPro
|
||||
setShowAddWorkflow(false)
|
||||
setSelectedWorkflowId(null)
|
||||
setActiveServerTab('workflows')
|
||||
refetch()
|
||||
} catch (err) {
|
||||
logger.error('Failed to add workflow:', err)
|
||||
}
|
||||
@@ -253,7 +252,6 @@ function ServerDetailView({ workspaceId, serverId, onBack }: ServerDetailViewPro
|
||||
isPublic: editServerIsPublic,
|
||||
})
|
||||
setShowEditServer(false)
|
||||
refetch()
|
||||
} catch (err) {
|
||||
logger.error('Failed to update server:', err)
|
||||
}
|
||||
@@ -676,7 +674,6 @@ function ServerDetailView({ workspaceId, serverId, onBack }: ServerDetailViewPro
|
||||
toolDescription: editingDescription.trim() || undefined,
|
||||
parameterSchema: updatedSchema,
|
||||
})
|
||||
refetch()
|
||||
setToolToView(null)
|
||||
setEditingDescription('')
|
||||
setEditingParameterDescriptions({})
|
||||
|
||||
Reference in New Issue
Block a user