Skip to content

Commit

Permalink
add expand button
Browse files Browse the repository at this point in the history
  • Loading branch information
victordibia committed Sep 5, 2020
1 parent 3b18af2 commit ff13b21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions neuralqa/server/ui/src/components/expandview/ExpandView.jsx
Expand Up @@ -17,7 +17,13 @@ class ExpandView extends Component {
};
}

componentDidUpdate(prevProps, prevState) {}
componentDidUpdate(prevProps, prevState) {
if (this.props.data !== prevProps.data) {
console.log("things have changed");
this.removeAllLines();
this.drawLines();
}
}

updateGraph(data) {}

Expand Down Expand Up @@ -78,8 +84,11 @@ class ExpandView extends Component {

this.blueColor = "#0062ff";
this.greyColor = "#c4c3c3";
this.drawLines();
}

for (const ex of this.data.expansions) {
drawLines() {
for (const ex of this.props.data.expansions) {
if (ex.expansion) {
for (let i = 0; i < ex.expansion.length; i++) {
const startId = "term" + ex.token_index;
Expand All @@ -97,7 +106,7 @@ class ExpandView extends Component {
}

render() {
const expansionTermsList = this.data.expansions.map(
const expansionTermsList = this.props.data.expansions.map(
(expansionData, index) => {
const terms = (expansionData.expansion || []).map((data, index) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion neuralqa/server/ui/src/components/queryview/QueryView.jsx
Expand Up @@ -320,7 +320,7 @@ class QueryView extends Component {
console.log(data);
// let explanationHolder = this.state.explanations;
// explanationHolder[selectedAnswerId] = data;
this.setState({ expansion: data });
this.setState({ expansions: data });
// console.log(data);
// setTimeout(() => {
// this.setState({ answerIsLoading: false });
Expand Down

0 comments on commit ff13b21

Please sign in to comment.