@@ -9,7 +9,6 @@ import {DFlowReactiveService} from "../d-flow";
99import { Flow , NodeFunction } from "@code0-tech/sagittarius-graphql-types" ;
1010import { Tooltip , TooltipArrow , TooltipContent , TooltipPortal , TooltipTrigger } from "../tooltip/Tooltip" ;
1111import { Text } from "../text/Text" ;
12- import { Badge } from "../badge/Badge" ;
1312import { DFlowSuggestionMenu } from "../d-flow-suggestion/DFlowSuggestionMenu" ;
1413import { useSuggestions } from "../d-flow-suggestion/DFlowSuggestion.hook" ;
1514
@@ -31,30 +30,30 @@ export const DFlowPanelControl: React.FC<DFlowPanelControlProps> = (props) => {
3130
3231 //memoized values
3332 const activeTab = React . useMemo ( ( ) => {
34- return fileTabsStore . find ( ( t : any ) => ( t as any ) . active )
33+ return fileTabsService . values ( ) . find ( ( t : any ) => ( t as any ) . active )
3534 } , [ fileTabsStore , fileTabsService ] )
3635
3736 const result = useSuggestions ( flowId , activeTab ?. content ?. props ?. node ?. id as NodeFunction [ 'id' ] | undefined )
3837
3938 //callbacks
4039 const deleteActiveNode = React . useCallback ( ( ) => {
4140 if ( ! activeTab ) return
42- if ( ! ( activeTab . content . props . flowId as Flow [ 'id' ] ) ) return
41+ if ( ! ( activeTab ? .content ? .props ? .flowId as Flow [ 'id' ] ) ) return
4342 // @ts -ignore
4443 startTransition ( async ( ) => {
45- const linkedNodes = flowService . getLinkedNodesById ( flowId , activeTab . content . props . node . id )
44+ const linkedNodes = flowService . getLinkedNodesById ( flowId , activeTab ? .content ? .props ? .node . id )
4645 linkedNodes . forEach ( node => {
4746 if ( node . id ) fileTabsService . deleteById ( node . id )
4847 } )
4948
50- await flowService . deleteNodeById ( ( activeTab . content . props . flowId as Flow [ 'id' ] ) , ( activeTab . content . props . node . id as NodeFunction [ 'id' ] ) )
49+ await flowService . deleteNodeById ( ( activeTab ? .content ? .props ? .flowId as Flow [ 'id' ] ) , ( activeTab ? .content ? .props ? .node . id as NodeFunction [ 'id' ] ) )
5150 } )
5251 } , [ activeTab , flowService , flowStore ] )
5352
5453 const addNodeToFlow = React . useCallback ( ( suggestion : any ) => {
55- if ( flowId && suggestion . value . __typename === "NodeFunction" && "node" in activeTab . content . props ) {
54+ if ( flowId && suggestion . value . __typename === "NodeFunction" && "node" in activeTab ! . content ? .props ) {
5655 startTransition ( async ( ) => {
57- await flowService . addNextNodeById ( flowId , ( activeTab . content . props . node . id as NodeFunction [ 'id' ] ) ?? undefined , suggestion . value )
56+ await flowService . addNextNodeById ( flowId , ( activeTab ? .content ? .props . node . id as NodeFunction [ 'id' ] ) ?? undefined , suggestion . value )
5857 } )
5958 } else {
6059 startTransition ( async ( ) => {
@@ -65,32 +64,37 @@ export const DFlowPanelControl: React.FC<DFlowPanelControlProps> = (props) => {
6564
6665 return < Panel position = { "bottom-center" } >
6766 < ButtonGroup >
67+ { /*<Tooltip>*/ }
68+ { /* <TooltipTrigger asChild>*/ }
69+ { /* <Button paddingSize={"xxs"}*/ }
70+ { /* variant={"filled"}*/ }
71+ { /* color={"primary"}>*/ }
72+ { /* Execute flow*/ }
73+ { /* </Button>*/ }
74+ { /* </TooltipTrigger>*/ }
75+ { /* <TooltipPortal>*/ }
76+ { /* <TooltipContent maw={"300px"}>*/ }
77+ { /* <Text>*/ }
78+ { /* To execute this flow you can call the following endpoint {" "} <br/>*/ }
79+ { /* <Badge>*/ }
80+ { /* <Text>POST</Text>*/ }
81+ { /* </Badge>*/ }
82+ { /* <Badge color={"info"} border>*/ }
83+ { /* <Text style={{color: "inherit"}}>localhost:6212/72hsa13/users/get</Text>*/ }
84+ { /* </Badge>*/ }
85+ { /* </Text>*/ }
86+ { /* <TooltipArrow/>*/ }
87+ { /* </TooltipContent>*/ }
88+ { /* </TooltipPortal>*/ }
89+ { /*</Tooltip>*/ }
6890 < Tooltip >
6991 < TooltipTrigger asChild >
70- < Button color = { "info" } paddingSize = { "xxs" } variant = { "none" } aria-selected = { true } >
71- Execute flow
72- </ Button >
73- </ TooltipTrigger >
74- < TooltipPortal >
75- < TooltipContent maw = { "300px" } >
76- < Text >
77- To execute this flow you can call the following endpoint { " " } < br />
78- < Badge >
79- < Text > POST</ Text >
80- </ Badge >
81- < Badge color = { "info" } border >
82- < Text style = { { color : "inherit" } } > localhost:6212/72hsa13/users/get</ Text >
83- </ Badge >
84- </ Text >
85- < TooltipArrow />
86- </ TooltipContent >
87- </ TooltipPortal >
88- </ Tooltip >
89- < Tooltip >
90- < TooltipTrigger asChild >
91- < Button disabled = { ! activeTab || ! ( activeTab . content . props . flowId as Flow [ 'id' ] ) } onClick = { deleteActiveNode } paddingSize = { "xxs" } variant = { "none" }
92- color = { "primary" } >
93- < IconTrash size = { 16 } />
92+ < Button disabled = { ! activeTab || ! ( activeTab ?. content ?. props . flowId as Flow [ 'id' ] ) }
93+ onClick = { deleteActiveNode }
94+ paddingSize = { "xxs" }
95+ variant = { "filled" }
96+ color = { "error" } >
97+ < Text > Delete node</ Text >
9498 </ Button >
9599 </ TooltipTrigger >
96100 < TooltipPortal >
@@ -103,10 +107,11 @@ export const DFlowPanelControl: React.FC<DFlowPanelControlProps> = (props) => {
103107 < DFlowSuggestionMenu suggestions = { result }
104108 onSuggestionSelect = { addNodeToFlow }
105109 triggerContent = {
106- < Button disabled = { ! activeTab } paddingSize = { "xxs" } variant = { "none" }
107- color = { "primary" } >
108- < IconPlus size = { 16 } />
109- Next node
110+ < Button disabled = { ! activeTab }
111+ paddingSize = { "xxs" }
112+ variant = { "filled" }
113+ color = { "secondary" } >
114+ < Text > Add next node</ Text >
110115 </ Button >
111116 } />
112117 </ ButtonGroup >
0 commit comments