mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
improvement(triggers): uuid, autolayout, copilot context (#1503)
* make trigger select uuid consistent with sidebar selection * add trigger allowed flag for core triggers * fix autolayout with new triggers
This commit is contained in:
committed by
GitHub
parent
79461840c3
commit
17edf0405b
@@ -781,7 +781,7 @@ const WorkflowContent = React.memo(() => {
|
||||
|
||||
// Create the trigger block at the center of the viewport
|
||||
const centerPosition = project({ x: window.innerWidth / 2, y: window.innerHeight / 2 })
|
||||
const id = `${triggerId}_${Date.now()}`
|
||||
const id = crypto.randomUUID()
|
||||
|
||||
// Add the trigger block with trigger mode if specified
|
||||
addBlock(
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { BlockConfig } from '@/blocks/types'
|
||||
|
||||
export const ApiTriggerBlock: BlockConfig = {
|
||||
type: 'api_trigger',
|
||||
triggerAllowed: true,
|
||||
name: 'API',
|
||||
description: 'Expose as HTTP API endpoint',
|
||||
longDescription:
|
||||
|
||||
@@ -7,6 +7,7 @@ const ChatTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(Messag
|
||||
|
||||
export const ChatTriggerBlock: BlockConfig = {
|
||||
type: 'chat_trigger',
|
||||
triggerAllowed: true,
|
||||
name: 'Chat',
|
||||
description: 'Start workflow from a chat deployment',
|
||||
longDescription: 'Chat trigger to run the workflow via deployed chat interfaces.',
|
||||
|
||||
@@ -7,6 +7,7 @@ const InputTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(FormI
|
||||
|
||||
export const InputTriggerBlock: BlockConfig = {
|
||||
type: 'input_trigger',
|
||||
triggerAllowed: true,
|
||||
name: 'Input Form',
|
||||
description: 'Start workflow manually with a defined input schema',
|
||||
longDescription:
|
||||
|
||||
@@ -7,6 +7,7 @@ const ManualTriggerIcon = (props: SVGProps<SVGSVGElement>) => createElement(Play
|
||||
|
||||
export const ManualTriggerBlock: BlockConfig = {
|
||||
type: 'manual_trigger',
|
||||
triggerAllowed: true,
|
||||
name: 'Manual',
|
||||
description: 'Start workflow manually from the editor',
|
||||
longDescription:
|
||||
|
||||
@@ -7,6 +7,7 @@ const ScheduleIcon = (props: SVGProps<SVGSVGElement>) => createElement(Clock, pr
|
||||
|
||||
export const ScheduleBlock: BlockConfig = {
|
||||
type: 'schedule',
|
||||
triggerAllowed: true,
|
||||
name: 'Schedule',
|
||||
description: 'Trigger workflow execution on a schedule',
|
||||
longDescription:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { TriggerUtils } from '@/lib/workflows/triggers'
|
||||
import type { BlockState } from '@/stores/workflows/workflow/types'
|
||||
import type { BlockDimensions, BoundingBox } from './types'
|
||||
|
||||
@@ -70,5 +71,9 @@ export function getBlocksByParent(blocks: Record<string, BlockState>): {
|
||||
}
|
||||
|
||||
export function isStarterBlock(block: BlockState): boolean {
|
||||
return block.type === 'starter' || block.type === 'webhook' || block.type === 'schedule'
|
||||
if (TriggerUtils.isTriggerBlock({ type: block.type, triggerMode: block.triggerMode })) {
|
||||
return true
|
||||
}
|
||||
|
||||
return block.triggerMode === true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user