Skip to content

Workflow Triggers #508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Workflow Triggers #508

wants to merge 10 commits into from

Conversation

aahaanmaini
Copy link
Contributor

No description provided.

@aahaanmaini aahaanmaini marked this pull request as ready for review May 29, 2025 20:43
Copy link
Member

@aliasaria aliasaria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2025-05-30 at 10 32 08 AM

The menu is easily obscured if you resize the app

@aliasaria
Copy link
Member

Make the button say "Triggers" instead of "Set Triggers"

@aliasaria
Copy link
Member

The menu makes it easy to set many triggers. But this is an uncommon usecase.
Screenshot 2025-05-30 at 10 34 47 AM

It would be better to use an autocomplete with multiselection or just a select with multiselection https://mui.com/joy-ui/react-autocomplete/#multiple-selection https://mui.com/joy-ui/react-select/#multiple-selections

@@ -75,6 +80,24 @@ export default function WorkflowList({ experimentInfo }) {
mutate: mutateWorkflows,
} = useSWR(chatAPI.Endpoints.Workflows.List(), fetcher);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use useAPI going forward

@@ -84,15 +107,39 @@ export default function WorkflowList({ experimentInfo }) {
}
}, [workflowsData, selectedWorkflowId, newWorkflowModalOpen]);

const workflows = workflowsData;
// Close triggers menu when clicking outside
useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should have to manage clickoutside etc. This should be managed by MUI Joy in the Menu Component

@@ -169,7 +219,7 @@ export default function WorkflowList({ experimentInfo }) {
<Typography level="title-lg">
Workflow {selectedWorkflow?.name}
</Typography>
<Box pl={2} display="flex" flexDirection="row" gap={1}>
<Box pl={2} display="flex" flexDirection="row" gap={1} position="relative">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does position=relative accomplish here?

const [optimisticConfigs, setOptimisticConfigs] = useState<TriggerConfig[] | null>(null);

// Debug logging
console.log('WorkflowTriggersMenu received:', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debug logging


// Ensure predefinedTriggers is an array and handle null/undefined cases
const safePredefinedTriggers = Array.isArray(predefinedTriggers) ? predefinedTriggers : [];
console.log('Safe predefined triggers:', safePredefinedTriggers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debug logging

return result;
}

export async function updateWorkflowTrigger(triggerId: string, payload: { is_enabled: boolean, config: { workflow_ids: number[] } }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add endpoints like this to our SDK. Use getFullURL

return result;
}

export async function listWorkflowsForExperiment(experimentId: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add endpoints like this to our SDK. Use getFullURL

return result;
}

export async function getPredefinedTriggers() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add endpoints like this to our SDK. Use getFullURL

return result;
}

export async function getWorkflowDetails(workflowId: string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add endpoints like this to our SDK. Use getFullURL

return result;
}

export async function updateWorkflowTriggerConfigs(workflowId: string, configs: Array<{trigger_type: string, is_enabled: boolean}>) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not add endpoints like this to our SDK. Use getFullURL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants