ryanahamilton commented on a change in pull request #15068:
URL: https://github.com/apache/airflow/pull/15068#discussion_r603420994



##########
File path: airflow/ui/src/api/index.ts
##########
@@ -75,3 +84,112 @@ export function useVersion() {
     (): Promise<Version> => axios.get('/version'),
   );
 }
+
+export function useTriggerRun(dagId: Dag['dagId']) {
+  const queryClient = useQueryClient();
+  const toast = useToast();
+  return useMutation(
+    (trigger: TriggerRunRequest) => axios.post(`dags/${dagId}/dagRuns`, 
camelToSnakeCase(trigger)),
+    {
+      onSettled: (res, error) => {
+        if (error) {
+          toast({
+            title: 'Error triggering DAG',
+            description: (error as Error).message,
+            status: 'error',
+            duration: 3000,
+            isClosable: true,

Review comment:
       Not for this PR, but we should refactor so that the default values are 
consistent per status value so we don't have to define every time.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to