Skip to content

Commit

Permalink
feat ✨: delete modal
Browse files Browse the repository at this point in the history
  • Loading branch information
BQXBQX committed Sep 25, 2024
1 parent 466e2a2 commit be9bd35
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
15 changes: 12 additions & 3 deletions packages/studio-draw-pattern/src/components/Canvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { usePropertiesStore } from '../../stores/usePropertiesStore';
import { DrawPatternContext, DrawPatternValue } from '../DrawPattern';
import _ from 'lodash';
import { useSection } from '@graphscope/studio-components';
import { InsertRowRightOutlined } from '@ant-design/icons';
import { InsertRowRightOutlined, SearchOutlined } from '@ant-design/icons';

export const Canvas = () => {
const [descState, setDescState] = useState<string>();
Expand All @@ -42,6 +42,14 @@ export const Canvas = () => {
const nodeReturn = Array.from(nodesStore).map(node => `${node.variable}`);
const edgeReturn = Array.from(edgesStore).map(edge => `${edge.variable}`);
[...nodeReturn, ...edgeReturn].length > 0 && setRETURNs(`RETURN ${[...nodeReturn, ...edgeReturn].join(', ')}`);
onClick &&
onClick({
MATCHs,
RETURNs: `RETURN ${[...nodeReturn, ...edgeReturn].join(', ')}`,
WHEREs,
description: descState ?? '',
});
// console.log(`RETURN ${[...nodeReturn, ...edgeReturn].join(', ')}`, MATCHs, WHEREs);
}
}, [isModalOpen]);

Expand Down Expand Up @@ -145,12 +153,13 @@ export const Canvas = () => {
}}
type="primary"
style={{ position: 'absolute', bottom: '20px', right: '240px' }}
icon={<SearchOutlined />}
>
Export Your Cypher
<pre>Cypher</pre>查询
</Button>
<Modal
title="Generate Cypher Code"
open={isModalOpen}
// open={isModalOpen}
onOk={() => {
setIsModalOpen(false);
const newState: DrawPatternValue = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ export const useEncodeCypher = () => {
encodeEdges(edges, editEdgeStatement);
}, [edges]);

useEffect(() => {
console.log('下面是边界\n', edges);
}, [edges]);

const createMatchClauses = useCallback(() => {
return generateMATCH(nodes, edges);
}, [nodes, edges]);
Expand Down
12 changes: 6 additions & 6 deletions packages/studio-graph-editor/src/canvas/useInteractive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ const useInteractive: any = () => {

// handleEdgesChange && handleEdgesChange([...fakeSnapshot(edges), newEgde]);
// handleNodesChange && handleNodesChange([...fakeSnapshot(nodes), newNode]);
console.log(
'handleChange 时的 edges 和 nodes',
[...fakeSnapshot(edges), newEgde],
[...fakeSnapshot(nodes), newNode],
);
// console.log(
// 'handleChange 时的 edges 和 nodes',
// [...fakeSnapshot(edges), newEgde],
// [...fakeSnapshot(nodes), newNode],
// );

updateStore(draft => {
draft.nodes.push(newNode);
Expand Down Expand Up @@ -184,7 +184,7 @@ const useInteractive: any = () => {
}, [nodes, edges, hasLayouted]);

useEffect(() => {
console.log('监听时的 edges 和 nodes', JSON.stringify(edges), '\n', JSON.stringify(nodes));
// console.log('监听时的 edges 和 nodes', JSON.stringify(edges), '\n', JSON.stringify(nodes));
handleEdgesChange && handleEdgesChange(edges);
handleNodesChange && handleNodesChange(nodes);
}, [edges, nodes]);
Expand Down

0 comments on commit be9bd35

Please sign in to comment.