From f6cbe78f4b6e17b9e8c37e431c6ac9e0bb8af9be Mon Sep 17 00:00:00 2001 From: Ivan <8611739+IRBorisov@users.noreply.github.com> Date: Mon, 19 Aug 2024 19:53:51 +0300 Subject: [PATCH] M: Improve OSS -> RSForm navigation and fix term graph --- .../frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx | 8 ++++---- rsconcept/frontend/src/pages/OssPage/OssEditContext.tsx | 4 +++- .../src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx b/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx index e315ce16..dc57ee11 100644 --- a/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx +++ b/rsconcept/frontend/src/pages/OssPage/EditorOssGraph/OssFlow.tsx @@ -123,7 +123,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) { }, [controller, getPositions, setIsModified]); const handleCreateOperation = useCallback( - (inputs: OperationID[]) => () => { + (inputs: OperationID[]) => { if (!controller.schema) { return; } @@ -315,13 +315,13 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) { if (!controller.isMutable) { return; } - if ((event.ctrlKey || event.metaKey) && event.key === 's') { + if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') { event.preventDefault(); event.stopPropagation(); handleSavePositions(); return; } - if ((event.ctrlKey || event.metaKey) && event.key === 'q') { + if ((event.ctrlKey || event.metaKey) && event.code === 'KeyQ') { event.preventDefault(); event.stopPropagation(); handleCreateOperation(controller.selected); @@ -389,7 +389,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) { edgeAnimate={edgeAnimate} edgeStraight={edgeStraight} onFitView={handleFitView} - onCreate={handleCreateOperation(controller.selected)} + onCreate={() => handleCreateOperation(controller.selected)} onDelete={handleDeleteSelected} onEdit={() => handleEditOperation(controller.selected[0])} onExecute={handleExecuteSelected} diff --git a/rsconcept/frontend/src/pages/OssPage/OssEditContext.tsx b/rsconcept/frontend/src/pages/OssPage/OssEditContext.tsx index a4ae2e37..36053407 100644 --- a/rsconcept/frontend/src/pages/OssPage/OssEditContext.tsx +++ b/rsconcept/frontend/src/pages/OssPage/OssEditContext.tsx @@ -33,6 +33,8 @@ import { UserID, UserLevel } from '@/models/user'; import { PARAMETER } from '@/utils/constants'; import { errors, information } from '@/utils/labels'; +import { RSTabID } from '../RSFormPage/RSTabs'; + export interface ICreateOperationPrompt { x: number; y: number; @@ -206,7 +208,7 @@ export const OssEditState = ({ selected, setSelected, children }: OssEditStatePr if (!node?.result) { return; } - router.push(urls.schema(node.result)); + router.push(urls.schema_props({ id: node.result, tab: RSTabID.CST_LIST })); }, [router, model] ); diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx index e68b8dca..a8864189 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorTermGraph/TermGraph.tsx @@ -99,8 +99,7 @@ function TermGraph({ ); useLayoutEffect(() => { - graphRef.current?.resetControls(true); - graphRef.current?.centerGraph(); + graphRef.current?.fitNodesInView([], { animated: true }); }, [toggleResetView, graphRef]); useLayoutEffect(() => {