diff --git a/client/src/pages/automation/project/components/DataPillPanel.tsx b/client/src/pages/automation/project/components/DataPillPanel.tsx index 12574ec465..3048ff4bdb 100644 --- a/client/src/pages/automation/project/components/DataPillPanel.tsx +++ b/client/src/pages/automation/project/components/DataPillPanel.tsx @@ -4,6 +4,7 @@ import { TooltipProvider, TooltipTrigger, } from '@/components/ui/tooltip'; +import {useGetComponentDefinitionsQuery} from '@/queries/componentDefinitions.queries'; import * as Dialog from '@radix-ui/react-dialog'; import {Cross1Icon, InfoCircledIcon} from '@radix-ui/react-icons'; import Button from 'components/Button/Button'; @@ -12,6 +13,7 @@ import {useCallback, useState} from 'react'; import {useDataPillPanelStore} from '../stores/useDataPillPanelStore'; import {useNodeDetailsDialogStore} from '../stores/useNodeDetailsDialogStore'; +import useWorkflowDefinitionStore from '../stores/useWorkflowDefinitionStore'; import DataPillPanelBody from './DataPillPanelBody'; const DataPillPanel = () => { @@ -19,7 +21,8 @@ const DataPillPanel = () => { const [dataPillFilterQuery, setDataPillFilterQuery] = useState(''); const {dataPillPanelOpen, setDataPillPanelOpen} = useDataPillPanelStore(); - const {nodeDetailsDialogOpen} = useNodeDetailsDialogStore(); + const {currentNode, nodeDetailsDialogOpen} = useNodeDetailsDialogStore(); + const {componentNames} = useWorkflowDefinitionStore(); const panelContainerRef = useCallback( (panelContainer: HTMLDivElement) => @@ -29,9 +32,28 @@ const DataPillPanel = () => { [] ); + const currentNodeIndex = componentNames.indexOf(currentNode.name); + + const previousComponentNames = + componentNames.length > 1 + ? componentNames.slice(0, currentNodeIndex) + : []; + + const {data: previousComponents} = useGetComponentDefinitionsQuery( + { + include: previousComponentNames, + }, + !!previousComponentNames.length + ); + return ( setDataPillPanelOpen(!dataPillPanelOpen)} modal={false} > @@ -91,6 +113,7 @@ const DataPillPanel = () => { diff --git a/client/src/pages/automation/project/components/DataPillPanelBody.tsx b/client/src/pages/automation/project/components/DataPillPanelBody.tsx index d6ae53764e..b212d9fa2e 100644 --- a/client/src/pages/automation/project/components/DataPillPanelBody.tsx +++ b/client/src/pages/automation/project/components/DataPillPanelBody.tsx @@ -1,6 +1,6 @@ import {ComponentDefinitionModel} from '@/middleware/helios/execution/models'; +import {ComponentDefinitionBasicModel} from '@/middleware/hermes/configuration'; import {useGetActionDefinitionsQuery} from '@/queries/actionDefinitions.queries'; -import {useGetComponentDefinitionsQuery} from '@/queries/componentDefinitions.queries'; import {PropertyType} from '@/types/projectTypes'; import { Accordion, @@ -11,7 +11,6 @@ import { import {ChevronDownIcon} from 'lucide-react'; import InlineSVG from 'react-inlinesvg'; -import {useNodeDetailsDialogStore} from '../stores/useNodeDetailsDialogStore'; import useWorkflowDefinitionStore from '../stores/useWorkflowDefinitionStore'; import getFilteredProperties from '../utils/getFilteredProperties'; import DataPill from './DataPill'; @@ -19,33 +18,19 @@ import DataPill from './DataPill'; const DataPillPanelBody = ({ containerHeight, dataPillFilterQuery, + previousComponents, }: { containerHeight: number; dataPillFilterQuery: string; + previousComponents: ComponentDefinitionBasicModel[]; }) => { - const {componentActions, componentNames} = useWorkflowDefinitionStore(); - - const {currentNode} = useNodeDetailsDialogStore(); + const {componentActions} = useWorkflowDefinitionStore(); const taskTypes = componentActions?.map( (componentAction) => `${componentAction.componentName}/1/${componentAction.actionName}` ); - const currentNodeIndex = componentNames.indexOf(currentNode.name); - - const previousComponentNames = - componentNames.length > 1 - ? componentNames.slice(0, currentNodeIndex) - : componentNames; - - const {data: previousComponents} = useGetComponentDefinitionsQuery( - { - include: previousComponentNames, - }, - !!componentNames.length - ); - const {data: actionData} = useGetActionDefinitionsQuery( {taskTypes}, !!componentActions?.length diff --git a/client/src/pages/automation/project/components/NodeDetailsDialog.tsx b/client/src/pages/automation/project/components/NodeDetailsDialog.tsx index 201aa3a858..bd13ccfda7 100644 --- a/client/src/pages/automation/project/components/NodeDetailsDialog.tsx +++ b/client/src/pages/automation/project/components/NodeDetailsDialog.tsx @@ -109,13 +109,13 @@ const NodeDetailsDialog = () => { const previousComponentNames = componentNames.length > 1 ? componentNames.slice(0, currentNodeIndex) - : componentNames; + : []; const {data: previousComponents} = useGetComponentDefinitionsQuery( { include: previousComponentNames, }, - !!componentNames.length + !!previousComponentNames.length ); const {data: actionData} = useGetActionDefinitionsQuery( @@ -279,25 +279,29 @@ const NodeDetailsDialog = () => { {currentComponent ? (
-