Skip to content

Commit

Permalink
Merge pull request #39 from anoopkarnik/main
Browse files Browse the repository at this point in the history
Run workflow working
  • Loading branch information
anoopkarnik authored Nov 7, 2024
2 parents adb5bc4 + 6db0cf8 commit 0805453
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
17 changes: 1 addition & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,4 @@ jobs:
- name: Build and Push Docker image
run: |
docker-compose build
docker-compose push
- name: Deploy to EC2
uses: appleboy/ssh-action@master
env:
DB_URL: ${{ secrets.DB_URL }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
timeout: 600
script: |
cd /home/ubuntu/saas-apps && sudo docker-compose pull
cd /home/ubuntu/saas-apps && sudo docker-compose rm -f
cd /home/ubuntu/saas-apps && sudo docker-compose up -d
docker-compose push
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, { useContext, useEffect, useState } from 'react'

import 'reactflow/dist/style.css';
import { useParams, useRouter, useSearchParams } from 'next/navigation';
import { deleteActionAction, deleteTriggerAction, editFlow, getActionTypesAction, getTriggerTypesAction, publishFlow, runWorkflow } from '../../../../../actions/workflows/workflow';
import { deleteActionAction, deleteTriggerAction, editFlow, getActionTypesAction, getTriggerTypesAction, publishFlow } from '../../../../../actions/workflows/workflow';
import { EditorContext } from '../../../../../../providers/editor-provider';
import { ArrowBigDownDash, Edit2Icon, TrashIcon } from 'lucide-react';
import { Input } from '@repo/ui/atoms/shadcn/Input';
Expand Down Expand Up @@ -91,8 +91,22 @@ const Nodes = () => {
}
}

if (loading) return (<div>Loading...</div>)

const runWorkflow = async (editorId:string) => {
try{
const res = await fetch(`/api/hooks/catch/${editorId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({'runType': 'Just a Trial Run','runTime': new Date().toISOString()})
})
const data = await res.json();
return {success: "Workflow run successfully", result: data}
}
catch (error) {
return {error: "Workflow run failed"}
}
}
const handleRun = async () => {
toast({title: "Running", description: "Workflow has started", variant: 'default'})
const res = await runWorkflow(editorId as string);
Expand All @@ -104,6 +118,10 @@ const Nodes = () => {
}
}

if (loading) return (<div>Loading...</div>)



return (
<>
<div className='text-4xl flex flex-col items-center gap-4 w-full justify-between px-10'>
Expand Down
2 changes: 1 addition & 1 deletion apps/dashboard-app/app/actions/workflows/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const updateActionAction = async({id,actionId, metadata}:any) => {
export const runWorkflow = async (editorId:string) => {
logger.info('Running workflow',editorId);
try{
const res = await fetch(`${process.env.NEXT_PUBLIC_URL}/api/hooks/catch/${editorId}`, {
const res = await fetch(`/api/hooks/catch/${editorId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Expand Down

0 comments on commit 0805453

Please sign in to comment.