M: Improve OSS -> RSForm navigation and fix term graph

This commit is contained in:
Ivan 2024-08-19 19:53:51 +03:00
parent 0c10162718
commit f6cbe78f4b
3 changed files with 8 additions and 7 deletions

View File

@ -123,7 +123,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
}, [controller, getPositions, setIsModified]); }, [controller, getPositions, setIsModified]);
const handleCreateOperation = useCallback( const handleCreateOperation = useCallback(
(inputs: OperationID[]) => () => { (inputs: OperationID[]) => {
if (!controller.schema) { if (!controller.schema) {
return; return;
} }
@ -315,13 +315,13 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
if (!controller.isMutable) { if (!controller.isMutable) {
return; return;
} }
if ((event.ctrlKey || event.metaKey) && event.key === 's') { if ((event.ctrlKey || event.metaKey) && event.code === 'KeyS') {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
handleSavePositions(); handleSavePositions();
return; return;
} }
if ((event.ctrlKey || event.metaKey) && event.key === 'q') { if ((event.ctrlKey || event.metaKey) && event.code === 'KeyQ') {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
handleCreateOperation(controller.selected); handleCreateOperation(controller.selected);
@ -389,7 +389,7 @@ function OssFlow({ isModified, setIsModified }: OssFlowProps) {
edgeAnimate={edgeAnimate} edgeAnimate={edgeAnimate}
edgeStraight={edgeStraight} edgeStraight={edgeStraight}
onFitView={handleFitView} onFitView={handleFitView}
onCreate={handleCreateOperation(controller.selected)} onCreate={() => handleCreateOperation(controller.selected)}
onDelete={handleDeleteSelected} onDelete={handleDeleteSelected}
onEdit={() => handleEditOperation(controller.selected[0])} onEdit={() => handleEditOperation(controller.selected[0])}
onExecute={handleExecuteSelected} onExecute={handleExecuteSelected}

View File

@ -33,6 +33,8 @@ import { UserID, UserLevel } from '@/models/user';
import { PARAMETER } from '@/utils/constants'; import { PARAMETER } from '@/utils/constants';
import { errors, information } from '@/utils/labels'; import { errors, information } from '@/utils/labels';
import { RSTabID } from '../RSFormPage/RSTabs';
export interface ICreateOperationPrompt { export interface ICreateOperationPrompt {
x: number; x: number;
y: number; y: number;
@ -206,7 +208,7 @@ export const OssEditState = ({ selected, setSelected, children }: OssEditStatePr
if (!node?.result) { if (!node?.result) {
return; return;
} }
router.push(urls.schema(node.result)); router.push(urls.schema_props({ id: node.result, tab: RSTabID.CST_LIST }));
}, },
[router, model] [router, model]
); );

View File

@ -99,8 +99,7 @@ function TermGraph({
); );
useLayoutEffect(() => { useLayoutEffect(() => {
graphRef.current?.resetControls(true); graphRef.current?.fitNodesInView([], { animated: true });
graphRef.current?.centerGraph();
}, [toggleResetView, graphRef]); }, [toggleResetView, graphRef]);
useLayoutEffect(() => { useLayoutEffect(() => {