File tree Expand file tree Collapse file tree 4 files changed +41
-12
lines changed
src/features/nodes/components Expand file tree Collapse file tree 4 files changed +41
-12
lines changed Original file line number Diff line number Diff line change 674674 "showProgressImages" : " Show Progress Images" ,
675675 "hideProgressImages" : " Hide Progress Images" ,
676676 "swapSizes" : " Swap Sizes"
677+ },
678+ "nodes" : {
679+ "reloadSchema" : " Reload Schema"
677680 }
678681}
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ import {
77 OnConnectEnd ,
88 OnConnectStart ,
99 OnEdgesChange ,
10+ OnInit ,
1011 OnNodesChange ,
1112 ReactFlow ,
13+ ReactFlowInstance ,
1214} from 'reactflow' ;
1315import {
1416 connectionEnded ,
@@ -67,6 +69,12 @@ export const Flow = () => {
6769 dispatch ( connectionEnded ( ) ) ;
6870 } , [ dispatch ] ) ;
6971
72+ const onInit : OnInit = useCallback ( ( v : ReactFlowInstance ) => {
73+ if ( v ) {
74+ v . fitView ( ) ;
75+ }
76+ } , [ ] ) ;
77+
7078 return (
7179 < ReactFlow
7280 nodeTypes = { nodeTypes }
@@ -77,6 +85,7 @@ export const Flow = () => {
7785 onConnectStart = { onConnectStart }
7886 onConnect = { onConnect }
7987 onConnectEnd = { onConnectEnd }
88+ onInit = { onInit }
8089 defaultEdgeOptions = { {
8190 style : { strokeWidth : 2 } ,
8291 } }
Original file line number Diff line number Diff line change 11import { HStack } from '@chakra-ui/react' ;
2- import { useAppDispatch } from 'app/store/storeHooks' ;
3- import IAIButton from 'common/components/IAIButton' ;
4- import { memo , useCallback } from 'react' ;
2+ import { memo } from 'react' ;
53import { Panel } from 'reactflow' ;
6- import { receivedOpenAPISchema } from 'services/api/thunks/schema' ;
7- import NodeInvokeButton from '../ui/NodeInvokeButton' ;
4+
85import CancelButton from 'features/parameters/components/ProcessButtons/CancelButton' ;
6+ import NodeInvokeButton from '../ui/NodeInvokeButton' ;
7+ import ReloadSchemaButton from '../ui/ReloadSchemaButton' ;
98
109const TopCenterPanel = ( ) => {
11- const dispatch = useAppDispatch ( ) ;
12-
13- const handleReloadSchema = useCallback ( ( ) => {
14- dispatch ( receivedOpenAPISchema ( ) ) ;
15- } , [ dispatch ] ) ;
16-
1710 return (
1811 < Panel position = "top-center" >
1912 < HStack >
2013 < NodeInvokeButton />
2114 < CancelButton />
22- < IAIButton onClick = { handleReloadSchema } > Reload Schema </ IAIButton >
15+ < ReloadSchemaButton / >
2316 </ HStack >
2417 </ Panel >
2518 ) ;
Original file line number Diff line number Diff line change 1+ import { useAppDispatch } from 'app/store/storeHooks' ;
2+ import IAIIconButton from 'common/components/IAIIconButton' ;
3+ import { useCallback } from 'react' ;
4+ import { useTranslation } from 'react-i18next' ;
5+ import { FaSyncAlt } from 'react-icons/fa' ;
6+ import { receivedOpenAPISchema } from 'services/api/thunks/schema' ;
7+
8+ export default function ReloadSchemaButton ( ) {
9+ const { t } = useTranslation ( ) ;
10+ const dispatch = useAppDispatch ( ) ;
11+
12+ const handleReloadSchema = useCallback ( ( ) => {
13+ dispatch ( receivedOpenAPISchema ( ) ) ;
14+ } , [ dispatch ] ) ;
15+
16+ return (
17+ < IAIIconButton
18+ icon = { < FaSyncAlt /> }
19+ tooltip = { t ( 'nodes.reloadSchema' ) }
20+ aria-label = { t ( 'nodes.reloadSchema' ) }
21+ onClick = { handleReloadSchema }
22+ />
23+ ) ;
24+ }
You can’t perform that action at this time.
0 commit comments