This is an automated email from the ASF dual-hosted git repository.

hbshin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/age-viewer.git


The following commit(s) were added to refs/heads/main by this push:
     new 66e5097  delete node/edge using icon (#60)
66e5097 is described below

commit 66e50970071dc57c1a01574fcbcc4b665524ff66
Author: MJinH <[email protected]>
AuthorDate: Wed Dec 28 21:05:03 2022 -0800

    delete node/edge using icon (#60)
    
    * delete node without query
    
    * fix conflic code
    
    * Fix conflic resolve error
    
    Co-authored-by: [email protected] <[email protected]>
    Co-authored-by: Hanbyeol Shin /  David Shin / 신한별 
<[email protected]>
---
 backend/src/services/databaseService.js            |  2 +-
 .../cytoscape/CypherResultCytoscapeChart.jsx       | 29 +++++++++++-----------
 .../components/sidebar/containers/SidebarHome.js   |  1 -
 .../sidebar/presentations/SidebarHome.jsx          |  2 --
 4 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/backend/src/services/databaseService.js 
b/backend/src/services/databaseService.js
index 7e35048..df680ea 100644
--- a/backend/src/services/databaseService.js
+++ b/backend/src/services/databaseService.js
@@ -108,7 +108,7 @@ class DatabaseService {
         let queryResult = await graphRepository.execute(query);
 
         return queryResult.rows;
-    }*/
+    }
     
     async readMetaData(graphName){
         let gr = this._graphRepository;
diff --git a/frontend/src/components/cytoscape/CypherResultCytoscapeChart.jsx 
b/frontend/src/components/cytoscape/CypherResultCytoscapeChart.jsx
index 0f15d52..a68c35b 100644
--- a/frontend/src/components/cytoscape/CypherResultCytoscapeChart.jsx
+++ b/frontend/src/components/cytoscape/CypherResultCytoscapeChart.jsx
@@ -34,7 +34,7 @@ import {
   faLockOpen,
   faProjectDiagram,
   faWindowClose,
-  faHighlighter,
+  faTrash,
 } from '@fortawesome/free-solid-svg-icons';
 import cxtmenu from '../../lib/cytoscape-cxtmenu';
 import { initLocation, seletableLayouts } from './CytoscapeLayouts';
@@ -215,22 +215,23 @@ const CypherResultCytoscapeCharts = ({
 
           {
             content: ReactDOMServer.renderToString(
-              (<FontAwesomeIcon icon={faHighlighter} size="lg" />),
+              (<FontAwesomeIcon icon={faTrash} size="lg" />),
             ),
             select(ele) {
-              if (ele.style().borderColor === 'rgb(232,228,6)') {
-                let border;
-                elements.nodes.forEach((e) => {
-                  if (e.data.id === ele.id()) border = e.data.borderColor;
+              fetch('/api/v1/cypher',
+                {
+                  method: 'POST',
+                  headers: {
+                    Accept: 'application/json',
+                    'Content-Type': 'application/json',
+                  },
+                  body: JSON.stringify({ cmd: `SELECT * FROM 
cypher('${graph}', $$ MATCH (S) WHERE id(S) = ${ele.id()} DETACH DELETE S $$) 
as (S agtype);` }),
+                })
+                .then((res) => {
+                  if (res.ok) {
+                    ele.remove();
+                  }
                 });
-                ele.style('borderColor', border);
-                ele.style('borderWidth', '3px');
-                ele.style('borderOpacity', '0.6');
-              } else {
-                ele.style('borderColor', '#e8e406');
-                ele.style('borderWidth', '10px');
-                ele.style('borderOpacity', '1');
-              }
             },
           },
         ],
diff --git a/frontend/src/components/sidebar/containers/SidebarHome.js 
b/frontend/src/components/sidebar/containers/SidebarHome.js
index 0445c29..5336079 100644
--- a/frontend/src/components/sidebar/containers/SidebarHome.js
+++ b/frontend/src/components/sidebar/containers/SidebarHome.js
@@ -36,7 +36,6 @@ const mapStateToProps = (state) => {
     status: state.metadata.status,
     role: currentGraphData.role,
     command: state.editor.command,
-    currentGraph: state.metadata.currentGraph,
     isLabel: state.layout.isLabel,
   };
 };
diff --git a/frontend/src/components/sidebar/presentations/SidebarHome.jsx 
b/frontend/src/components/sidebar/presentations/SidebarHome.jsx
index 39e0b1e..d080cba 100644
--- a/frontend/src/components/sidebar/presentations/SidebarHome.jsx
+++ b/frontend/src/components/sidebar/presentations/SidebarHome.jsx
@@ -363,7 +363,6 @@ const SidebarHome = ({
   getMetaData,
   changeCurrentGraph,
   changeGraph,
-  currentGraph,
   isLabel,
 }) => {
   const dispatch = useDispatch();
@@ -504,7 +503,6 @@ SidebarHome.propTypes = {
   currentGraph: PropTypes.string.isRequired,
   graphs: PropTypes.arrayOf(PropTypes.arrayOf(PropTypes.string)).isRequired,
   changeGraph: PropTypes.func.isRequired,
-  currentGraph: PropTypes.string.isRequired,
   isLabel: PropTypes.bool.isRequired,
 };
 

Reply via email to