Skip to content

Commit c308a77

Browse files
committed
update readme
1 parent 41e7e9d commit c308a77

File tree

2 files changed

+12
-46
lines changed

2 files changed

+12
-46
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,16 @@ The tool mainly uses 3 resources:
3737

3838
## Usage
3939

40-
Currently the tool has 4 sections, namely Home, Viewer, Compare, Github. Out of the 4, only the viewer has been implemented. It provides following features.
40+
Currently the tool has 4 sections, namely Home, Viewer, Compare, Github. GitHub links to this repository.
4141

42+
### Viewer
4243
* An **Upload Schema** button that opens a modal to upload file from the local file system.
43-
* A **Canvas** where the schema is represented. The canvas allows one to zoom-in and zoom-out, move one node at a time and move the entire structure. There is a **reload** icon on the top right corner of the canvas that resets the graph to its original position.
44-
* A **JSON viewer** that gives the json view of the schema. This viewer allows editing of the schema which in turn updates the graph. The viewer allows 4 main funtionality.
44+
* A **Canvas** where the schema is represented. The canvas allows one to zoom-in and zoom-out, move one node at a time and move the entire structure. There is a **reload** icon on the top right corner of the canvas that resets the graph to its original position. Nodes can be clicked to show subtrees of children and participants.
45+
* A **JSON viewer** that gives the json view of the schema. This viewer allows editing of the schema which in turn updates the graph. The viewer allows 4 main funtionalities.
4546
* **Copy**: A "Copy-to-Clipboard" icon shows up on every object of the json structure which allows one to copy the entire value. For object, number and string, it copies the value assigned to the property. For arrays, it copies all the entries in the list.
4647
* **Add**: A "+" icon signifies adding an entry. Within objects, it expects a key and initialize it with "NULL" which can then be edited to the required value. In arrays, it expects a value in the form of an object or a string.
4748
* **Edit**: Selecting "notepad-with-pen" icon allows editing the value of the respective key. This option is missing in arrays.
4849
* **Delete**: Clicking on "X" icon will delete that entry in the object. Using it in array will remove the entire object and reduce the length of the list by 1.
4950

5051
For an interactive [demo](https://mac-s-g.github.io/react-json-view/demo/dist/).
51-
* A **SideBar** opens up on the left side of the canvas giving information about the selected node. This window opens only when a node is right-clicked. It gives the details about the nodes like name, id, role, entityTypes, comments, provenance, confidence etc. These information will only be visible if they are mentioned in the schema.
52+
* A **SideBar** opens up on the left side of the canvas giving information about the selected node. This window opens only when a node is right-clicked. It gives the details about the nodes like name, id, description, comments, explanation from TA1, importance etc. These information will only be visible if they are mentioned in the schema.

static/src/template/Canvas.jsx

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -89,62 +89,27 @@ class Canvas extends React.Component {
8989
componentDidMount() {
9090
console.log('mounted')
9191
this.cy.ready(() => {
92-
console.log('ready')
92+
// left-click
9393
this.cy.on('tap', event => {
94-
console.log('target:', event.target)
9594
var eventTarget = event.target;
95+
// click background, reset canvas
9696
if (eventTarget === this.cy) {
97-
console.log('tap on background');
98-
if (!isNull(this.state.currentSubtree)){
99-
this.removeSubTree(this.state.currentSubtree);
100-
}
97+
this.reloadCanvas();
98+
// click node, show subtree
10199
} else if (eventTarget.isNode()) {
102-
console.log('tap on node');
103100
let node = eventTarget.data();
104101
this.showSubTree(node);
105-
} else {
106-
console.log('tap on edge');
107-
if (!isNull(this.state.currentSubtree)){
108-
this.removeSubTree(this.state.currentSubtree);
109-
}
110102
}
111-
// if (evtTarget === cy) {
112-
// if (!isNull(this.state.currentSubtree)){
113-
// this.removeSubTree(this.state.currentSubtree);
114-
// }
115-
// }
116-
// else if (evtTarget.isNode()){
117-
// console.log('tap on Node')
118-
// let node = event.target.data();
119-
// this.showSubTree(node);
120-
// }
121-
// else{
122-
// if (!isNull(this.state.currentSubtree)){
123-
// this.removeSubTree(this.state.currentSubtree);
124-
// }
125-
// }
126103
});
127-
// this.cy.on('tap', event => {
128-
// console.log("target:", event.target, " and group:", event.target.group );
129-
// if (event.target.group && event.target.group() === 'nodes') {
130-
// let node = event.target.data();
131-
// // if (node._type === 'leaf') {
132-
// // this.cy.getElementById(node.id).unselect();
133-
// // } else {
134-
// this.showSubTree(node);
135-
// // }
136-
// } else {
137-
// if (!isNull(this.state.currentSubtree)) {
138-
// this.removeSubTree(this.state.currentSubtree);
139-
// }
140-
// }
141-
// })
142104

105+
// right-click
143106
this.cy.on('cxttap', event => {
107+
// collapse sidebar
144108
if (Object.keys(event.target.data()).length === 0) {
145109
this.cy.resize();
146110
this.runLayout();
147111
}
112+
// show information of node
148113
this.props.sidebarCallback(event.target.data());
149114
})
150115
})

0 commit comments

Comments
 (0)