Commit 8de60e01 authored by jasonych99's avatar jasonych99
Browse files

FE: integrate prediction nmr

parent 799ed658
......@@ -169,13 +169,13 @@ export default class ReactionDetails extends Component {
sampleShowOrNew({ params: { sampleID: product.id} });
}
handleProductChange(product) {
handleProductChange(product, cb) {
let {reaction} = this.state
reaction.updateMaterial(product)
reaction.changed = true
this.setState({ reaction })
this.setState({ reaction }, cb)
}
productLink(product) {
......@@ -199,7 +199,7 @@ export default class ReactionDetails extends Component {
const tabs = products.map((product, key) => {
const title = this.productLink(product);
const setState = () => this.handleProductChange(product);
const handleSampleChanged = () => this.handleProductChange(product);
const handleSampleChanged = (_, cb) => this.handleProductChange(product, cb);
return (
<Tab
......
......@@ -126,10 +126,10 @@ export default class SampleDetails extends React.Component {
});
}
handleSampleChanged(sample) {
handleSampleChanged(sample, cb) {
this.setState({
sample
});
sample,
}, cb);
}
handleAmountChanged(amount) {
......
......@@ -100,7 +100,9 @@ class ViewSpectra extends React.Component {
];
});
});
handleSampleChanged(sample);
const cb = () => this.savePeaks(peaks, layout, shift);
handleSampleChanged(sample, cb);
}
savePeaks(peaks, layout, shift) {
......@@ -162,6 +164,11 @@ class ViewSpectra extends React.Component {
input, xLabel, yLabel, peakObjs, isExist,
} = FN.buildData(jcamp.file);
const operations = [
{ name: 'write & save', value: this.writePeaks },
{ name: 'save only', value: this.savePeaks },
].filter(r => r.value);
return (
<Modal.Body>
{
......@@ -172,8 +179,7 @@ class ViewSpectra extends React.Component {
xLabel={xLabel}
yLabel={yLabel}
peakObjs={peakObjs}
writePeaks={this.writePeaks}
savePeaks={this.savePeaks}
operations={operations}
/>
}
</Modal.Body>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment