From 496f5884d6a5074b92f45a6bbcb24da0f0483df7 Mon Sep 17 00:00:00 2001 From: Biswajeet Das Date: Tue, 12 Nov 2024 17:31:03 +0530 Subject: [PATCH] fix(dashboard): Nv 4679 visiting UI based workflow shows framework code (#6951) --- .../src/components/create-workflow-button.tsx | 4 +-- .../test-workflow/test-workflow-form.tsx | 35 +++++++++++-------- .../test-workflow/test-workflow-tabs.tsx | 4 +-- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/apps/dashboard/src/components/create-workflow-button.tsx b/apps/dashboard/src/components/create-workflow-button.tsx index f3b6764a62e..95724af5336 100644 --- a/apps/dashboard/src/components/create-workflow-button.tsx +++ b/apps/dashboard/src/components/create-workflow-button.tsx @@ -83,7 +83,7 @@ export const CreateWorkflowButton = (props: CreateWorkflowButtonProps) => { }} > - + e.preventDefault()}> Create workflow
@@ -134,7 +134,7 @@ export const CreateWorkflowButton = (props: CreateWorkflowButtonProps) => { /> - Name is required + )} /> diff --git a/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-form.tsx b/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-form.tsx index 18101e42313..630dcbd5efb 100644 --- a/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-form.tsx +++ b/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-form.tsx @@ -23,9 +23,10 @@ import { TestWorkflowFormType } from '../schema'; import { SnippetLanguage } from './types'; import { SnippetEditor } from './snippet-editor'; import { Editor } from '@/components/primitives/editor'; +import { WorkflowOriginEnum } from '@/utils/enums'; const tabsTriggerClassName = 'pt-1'; -const codePanelClassName = 'bg-background h-full w-full rounded-lg border border-neutral-200 p-3'; +const codePanelClassName = 'bg-background flex-1 w-full rounded-lg border border-neutral-200 p-3 overflow-y-auto'; const LANGUAGE_TO_SNIPPET_UTIL: Record string> = { shell: createCurlSnippet, @@ -41,7 +42,9 @@ export const TestWorkflowForm = ({ workflow }: { workflow?: WorkflowResponseDto control, formState: { errors }, } = useFormContext(); - const [activeSnippetTab, setActiveSnippetTab] = useState('framework'); + const [activeSnippetTab, setActiveSnippetTab] = useState(() => + workflow?.origin === WorkflowOriginEnum.EXTERNAL ? 'framework' : 'typescript' + ); const to = useWatch({ name: 'to', control }); const payload = useWatch({ name: 'payload', control }); const identifier = workflow?.workflowId ?? ''; @@ -51,7 +54,7 @@ export const TestWorkflowForm = ({ workflow }: { workflow?: WorkflowResponseDto }, [activeSnippetTab, identifier, to, payload]); return ( -
+
@@ -110,23 +113,25 @@ export const TestWorkflowForm = ({ workflow }: { workflow?: WorkflowResponseDto />
-
- +
+ setActiveSnippetTab(value as SnippetLanguage)} > - - Framework + {workflow?.origin === WorkflowOriginEnum.EXTERNAL && ( + + Framework + + )} + + NodeJS cURL - - NodeJS - PHP @@ -144,9 +149,11 @@ export const TestWorkflowForm = ({ workflow }: { workflow?: WorkflowResponseDto value="Copy code" /> - - - + {workflow?.origin === WorkflowOriginEnum.EXTERNAL && ( + + + + )} diff --git a/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-tabs.tsx b/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-tabs.tsx index bbc40770eeb..4378cb9fa81 100644 --- a/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-tabs.tsx +++ b/apps/dashboard/src/components/workflow-editor/test-workflow/test-workflow-tabs.tsx @@ -74,7 +74,7 @@ export const TestWorkflowTabs = ({ testData }: { testData: WorkflowTestDataRespo
- +
- +