diff --git a/src/createBedSet.jsx b/src/createBedSet.jsx index 36897a0..9632c74 100644 --- a/src/createBedSet.jsx +++ b/src/createBedSet.jsx @@ -4,11 +4,18 @@ import { tableIcons } from "./tableIcons"; import Spinner from "react-bootstrap/Spinner"; import { Paper } from "@material-ui/core"; import Container from "react-bootstrap/Container"; -import Row from "react-bootstrap/Row"; +import { FaTrashAlt } from "react-icons/fa"; +import { FaDownload } from "react-icons/fa"; import Header from "./header"; import VersionsSpan from "./versionsSpan"; +import axios from "axios"; +import bedhost_api_url from "./const/server"; import "./style/home.css"; +const api = axios.create({ + baseURL: bedhost_api_url, +}); + export default class CreateBedSet extends React.Component { constructor() { super(); @@ -22,9 +29,26 @@ export default class CreateBedSet extends React.Component { console.log("my bed set:", this.state.myBedSet) } - createBedSet() { + async createBedSet() { + let idx_list = [] + + idx_list.push( + this.state.myBedSet.map((bed) => { + return bed.id; + }) + ) + + idx_list = idx_list.toString() + + let md = await api.post( + "/api/bedset/create/" + + this.state.myBedSetName + + "/" + + encodeURIComponent(idx_list) + ).then(({ data }) => data) + localStorage.clear(); - console.log("my bed setname :", this.state.myBedSetName) + } handleChange(e) { @@ -32,74 +56,120 @@ export default class CreateBedSet extends React.Component { } + downloadBedSet() { + + } + render() { return (
+

Download My BED Set

+ +

+ {"Download from http with command "} + + {"wget -i .txt"} + +

+

+ {"Download from s3 with command "} + + {"cat .txt | parallel aws s3 cp {} "} + +

+
+
- - new Promise((resolve, reject) => { - setTimeout(() => { - const dataDelete = [...this.state.myBedSet]; - const index = oldData.tableData.id; - dataDelete.splice(index, 1); - this.setState({ - myBedSet: dataDelete - }, () => { - localStorage.setItem('myBedSet', JSON.stringify(this.state.myBedSet)) - }); - resolve() - }, 1000) + {this.state.myBedSet ? ( + + ({ + icon: () => , + tooltip: 'Save User', + onClick: (event, rowData) => alert("Download " + rowData.name) }), - }} - options={{ - headerStyle: { - backgroundColor: "#264653", - color: "#FFF", - fontWeight: "bold", - }, - actionsColumnIndex: -1, - actionsCellStyle: { justifyContent: "center" }, - paging: true, - search: false, - toolbar: false, - }} - components={{ - Container: (props) => , - }} - /> - - - - + { + icon: () => , + tooltip: 'Delete BED file', + onClick: (event, rowData) => + new Promise((resolve, reject) => { + setTimeout(() => { + const dataDelete = [...this.state.myBedSet]; + const index = rowData.tableData.id; + dataDelete.splice(index, 1); + this.setState({ + myBedSet: dataDelete + }, () => { + localStorage.setItem('myBedSet', JSON.stringify(this.state.myBedSet)) + }); + resolve() + }, 1000) + }), + } + ]} + options={{ + headerStyle: { + backgroundColor: "#264653", + color: "#FFF", + fontWeight: "bold", + }, + actionsColumnIndex: -1, + actionsCellStyle: { justifyContent: "center" }, + paging: true, + search: false, + toolbar: false, + }} + components={{ + Container: (props) => , + }} + /> + - + + + + + ) : ( + +

Your BED set cart is empty.

+
+ ) + }