From 4d3a5b0d0ee6df8d86192ae3c83b915b9638efd6 Mon Sep 17 00:00:00 2001 From: Intern01 Date: Wed, 18 Jul 2018 15:23:11 +0700 Subject: [PATCH 01/33] Get all class for add node selector --- graph-editor/src/actions/databaseAction.js | 8 +++++- graph-editor/src/components/Canvas.js | 5 +++- graph-editor/src/components/Console.js | 1 + graph-editor/src/containers/App.js | 6 ++++- .../src/reducers/graphCanvasReducer.js | 16 ++++++++++- graph-editor/src/sagas/index.js | 27 ++++++++++++------- 6 files changed, 50 insertions(+), 13 deletions(-) diff --git a/graph-editor/src/actions/databaseAction.js b/graph-editor/src/actions/databaseAction.js index 4e1b98b8..53f126ad 100644 --- a/graph-editor/src/actions/databaseAction.js +++ b/graph-editor/src/actions/databaseAction.js @@ -25,11 +25,17 @@ const getSrcDstEdge = edgeID => ({ payload: edgeID }); +const sendAllNodeClassToGraphCanvasReducer = allClass => ({ + type: "GET_ALL_CLASS", + payload: allClass +}); + export { executeConsole, addVertexConsole, getAllClassFromDatabase, sendAllClassFromDatabaseToState, addEdgeConsole, - getSrcDstEdge + getSrcDstEdge, + sendAllNodeClassToGraphCanvasReducer }; diff --git a/graph-editor/src/components/Canvas.js b/graph-editor/src/components/Canvas.js index 856dbee7..31fa7238 100644 --- a/graph-editor/src/components/Canvas.js +++ b/graph-editor/src/components/Canvas.js @@ -277,7 +277,10 @@ class Canvas extends Component { render() { const { state, scale, data } = this.props; - const graphOptions = Object.assign({width: '100%', height: '100%', autoResize: true}, state.options) + const graphOptions = Object.assign( + { width: "100%", height: "100%", autoResize: true }, + state.options + ); let commandBox; if (scale.nodeMenu === true) { commandBox = ( diff --git a/graph-editor/src/components/Console.js b/graph-editor/src/components/Console.js index 24db468e..511e9f8d 100644 --- a/graph-editor/src/components/Console.js +++ b/graph-editor/src/components/Console.js @@ -59,6 +59,7 @@ class Console extends Component { > Compile + {/* */} ); } diff --git a/graph-editor/src/containers/App.js b/graph-editor/src/containers/App.js index a1546236..355c265e 100644 --- a/graph-editor/src/containers/App.js +++ b/graph-editor/src/containers/App.js @@ -217,9 +217,13 @@ class App extends Component { group: selectGroup }); }; + + // .graphSetting.graphCanvas.classes selectBoxList = graph => { let arr = []; - const list = Object.keys(graph.options.groups); + // console.log(graph.classes); + // const list =Object.keys(graph.classes) + const list = graph.classes; for (let ele in list) { arr.push(