Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #120 from PDOK/PickerBug
Browse files Browse the repository at this point in the history
Picker bug
  • Loading branch information
StanRonzhin authored Nov 22, 2017
2 parents df72336 + d55d376 commit a86ecc8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
20 changes: 16 additions & 4 deletions src/DataClassifyDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ class DataClassifyDialog extends Component {
lovAvailable: true,
};
}
onVocabPicked = (_, index) => {
this.setState({
vocabPickerIndex: index,
});
};

searchVocabulary = (e) => {
const query = this.state.searchText;
const tempState = this.state;
Expand Down Expand Up @@ -74,6 +80,9 @@ class DataClassifyDialog extends Component {
};
}
this.props.finishCallBack(result, this.state.baseUri);
this.resetDialog();
};
resetDialog = () => {
this.setState({
searchText: '',
stepIndex: 0,
Expand Down Expand Up @@ -138,7 +147,7 @@ class DataClassifyDialog extends Component {
name="Base-uri:"
type="url"
hintText="type a base URI here"
onChange={(_, string) => this.setState({ baseURI: string })}
onChange={(_, string) => this.setState({ baseUri: string })}
/>
</div>

Expand Down Expand Up @@ -176,15 +185,18 @@ class DataClassifyDialog extends Component {
<FlatButton
label={(this.state.stepIndex === 0) ? 'Next' : 'Finish'}
primary
onClick={(this.state.stepIndex === 0) ?
this.setState({ stepIndex: 1 }) : this.handlePick}
onClick={() => ((this.state.stepIndex === 0) ?
this.setState({ stepIndex: 1 }) : this.handlePick())}
disabled={(this.state.stepIndex === 0 || this.state.vocabDownText) ?
false : !!(this.state.results.length === 0 || this.state.vocabDownText)}
/>,
<FlatButton
label="Cancel"
primary={false}
onClick={this.props.closeCallBack}
onClick={() => {
this.resetDialog();
this.props.closeCallBack();
}}
/>,
];
return (
Expand Down
8 changes: 0 additions & 8 deletions src/DataClassifyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ class DataClassifyView extends Component {
this.props.setBaseUri(index, text);
};

onVocabPicked = (_, index) => {
const dialog = this.state.dialog;
dialog.vocabPickerIndex = index;
this.setState({
dialog,
});
};

onChange = (_, string) => {
const dialog = this.state.dialog;
dialog.searchText = string;
Expand Down
7 changes: 7 additions & 0 deletions src/DataLinkDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class DataLinkDialog extends Component {
onChange = (object, string) => {
this.setState({ searchText: string });
};

onVocabPicked = (_, index) => {
this.setState({
vocabPickerIndex: index,
});
};

handlePick = () => {
let result;
let name;
Expand Down
8 changes: 0 additions & 8 deletions src/DataLinkView.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,6 @@ class DataLinkView extends Component {
selected: {},
});
};
onVocabPicked = (_, index) => {
const dialog = this.state.dialog;
dialog.vocabPickerIndex = index;
this.setState({
dialog,
});
};


// Helper to find the index of a given node
getNodeIndex(searchNode) {
Expand Down

0 comments on commit a86ecc8

Please sign in to comment.