Skip to content

Commit

Permalink
Fix a bug in building index.
Browse files Browse the repository at this point in the history
  • Loading branch information
YuanyueLi committed Oct 2, 2023
1 parent 1eadfac commit 07d79d3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "entropy_search",
"version": "1.0.1",
"version": "1.1.0",
"description": "GUI for Entropy Search",
"author": {
"name": "Yuanyue Li"
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/Pages/Result/GetData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ const Main = () => {
onSuccess: (result, params) => {
const data = result.data;
console.log("getOneSpectrum", data)
if(data.is_error){
errorNotification.error({
message: 'Error',
description: data.status,
duration: 0,
placement: "top",
});
return;
}
setAtomGlobalSpectrum(data);
setAtomUpperSpectrum({
precursor_mz: data.precursor_mz,
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/Pages/Result/SearchResultTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
atomLowerSpectrumData
} from "../Global/Atoms";
import {useRequest} from "ahooks";
import {Parser} from "@json2csv/plainjs";

const atomSearchScore = atom([]);
const atomLibraryInfo = atom([]);
Expand Down Expand Up @@ -100,6 +101,20 @@ export default () => {
}
}, [getAtomSearchScore, stateSearchType])

const [stateTextFile, setStateTextFile] = useState(null);
useEffect(() => {
if(stateTableData && stateTableData.length > 0){
const parser = new Parser();
const csv = parser.parse(stateTableData);
const data = new Blob([csv], {type: 'text/plain'});
if (stateTextFile !== null) {
window.URL.revokeObjectURL(stateTextFile);
}
const textFile = window.URL.createObjectURL(data);
setStateTextFile(textFile);
}
},[stateTableData]);

return <>
<Row>
<Col span={24}>
Expand Down Expand Up @@ -134,5 +149,14 @@ export default () => {
columns={column} dataSource={stateTableData}/>
</Col>
</Row>
<Row justify="end">
<>
{
stateTextFile ? <>
<Button type={"dashed"} href={stateTextFile} download="result-library_matching.csv" >Export library matching results</Button>
</> : <></>
}
</>
</Row>
</>;
};

0 comments on commit 07d79d3

Please sign in to comment.