From f175a7de9f392430a2ebc0d1ff5899baaf58ad63 Mon Sep 17 00:00:00 2001 From: Tyler Ohlsen Date: Thu, 6 Jun 2024 15:34:35 -0700 Subject: [PATCH] Enable workflow updates and document ingest (#166) Signed-off-by: Tyler Ohlsen (cherry picked from commit 2eb0bb919923900da26dc32dacefc1957d950296) --- .../workflow_detail/resizable_workspace.tsx | 23 ++- public/pages/workflow_detail/tools/tools.tsx | 114 ++++++++------ .../ingest_inputs/ingest_data.tsx | 49 +----- .../workflow_inputs/workflow_inputs.tsx | 146 +++++++++++------- 4 files changed, 179 insertions(+), 153 deletions(-) diff --git a/public/pages/workflow_detail/resizable_workspace.tsx b/public/pages/workflow_detail/resizable_workspace.tsx index 51037344..12cb99d0 100644 --- a/public/pages/workflow_detail/resizable_workspace.tsx +++ b/public/pages/workflow_detail/resizable_workspace.tsx @@ -69,6 +69,9 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) { setIsWorkflowInputsPanelOpen(!isWorkflowInputsPanelOpen); }; + // ingest state + const [ingestResponse, setIngestResponse] = useState(''); + // Tools side panel state const [isToolsPanelOpen, setIsToolsPanelOpen] = useState(true); const collapseFnVertical = useRef( @@ -160,6 +163,7 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) { workflow={props.workflow} formikProps={formikProps} onFormChange={onFormChange} + setIngestResponse={setIngestResponse} /> @@ -231,21 +235,12 @@ export function ResizableWorkspace(props: ResizableWorkspaceProps) { onToggleCollapsedInternal={() => onToggleToolsChange() } - style={{ marginBottom: '-24px' }} + style={{ marginBottom: '-16px' }} > - - - - - - - + ); diff --git a/public/pages/workflow_detail/tools/tools.tsx b/public/pages/workflow_detail/tools/tools.tsx index 3e0308c7..e363d238 100644 --- a/public/pages/workflow_detail/tools/tools.tsx +++ b/public/pages/workflow_detail/tools/tools.tsx @@ -5,9 +5,10 @@ import React, { useState } from 'react'; import { + EuiCodeEditor, EuiFlexGroup, EuiFlexItem, - EuiSpacer, + EuiPanel, EuiTab, EuiTabs, EuiText, @@ -18,6 +19,7 @@ import { Resources } from './resources'; interface ToolsProps { workflow?: Workflow; + ingestResponse: string; } enum TAB_ID { @@ -55,51 +57,73 @@ const inputTabs = [ */ export function Tools(props: ToolsProps) { const [selectedTabId, setSelectedTabId] = useState(TAB_ID.INGEST); + return ( - <> - -

Tools

-
- - <> - - {inputTabs.map((tab, idx) => { - return ( - setSelectedTabId(tab.id)} - isSelected={tab.id === selectedTabId} - disabled={tab.disabled} - key={idx} - > - {tab.name} - - ); - })} - - - - {selectedTabId === TAB_ID.INGEST && ( - - TODO: Run ingestion placeholder - - )} - {selectedTabId === TAB_ID.QUERY && ( - - TODO: Run queries placeholder - - )} - {selectedTabId === TAB_ID.ERRORS && ( - - TODO: View errors placeholder - - )} - {selectedTabId === TAB_ID.RESOURCES && ( - - + + + + +

Tools

+
+
+ + + {inputTabs.map((tab, idx) => { + return ( + setSelectedTabId(tab.id)} + isSelected={tab.id === selectedTabId} + disabled={tab.disabled} + key={idx} + > + {tab.name} + + ); + })} + + + + + + <> + {selectedTabId === TAB_ID.INGEST && ( + // TODO: known issue with the editor where resizing the resizablecontainer does not + // trigger vertical scroll updates. Updating the window, or reloading the component + // by switching tabs etc. will refresh it correctly. + {}} + readOnly={true} + setOptions={{ + fontSize: '12px', + autoScrollEditorIntoView: true, + }} + tabSize={2} + /> + )} + {selectedTabId === TAB_ID.QUERY && ( + TODO: Run queries placeholder + )} + {selectedTabId === TAB_ID.ERRORS && ( + TODO: View errors placeholder + )} + {selectedTabId === TAB_ID.RESOURCES && ( + + )} + - )} - - - +
+
+
+ ); } diff --git a/public/pages/workflow_detail/workflow_inputs/ingest_inputs/ingest_data.tsx b/public/pages/workflow_detail/workflow_inputs/ingest_inputs/ingest_data.tsx index d8259f1f..e961881b 100644 --- a/public/pages/workflow_detail/workflow_inputs/ingest_inputs/ingest_data.tsx +++ b/public/pages/workflow_detail/workflow_inputs/ingest_inputs/ingest_data.tsx @@ -18,36 +18,10 @@ interface IngestDataProps { onFormChange: () => void; } -enum OPTION { - NEW = 'new', - EXISTING = 'existing', -} - -const options = [ - { - id: OPTION.NEW, - label: 'Create a new index', - }, - { - id: OPTION.EXISTING, - label: 'Choose existing index', - }, -]; - /** * Input component for configuring the data ingest (the OpenSearch index) */ export function IngestData(props: IngestDataProps) { - const [selectedOption, setSelectedOption] = useState