added table to bucket select
This commit is contained in:
parent
fcb34aeacc
commit
fd688021ea
@ -1,13 +1,18 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { Link } from "react-router-dom"
|
import { useHistory } from "react-router-dom"
|
||||||
import { useListBucktesQuery } from "../generated/graphql"
|
import { useListBucktesQuery } from "../generated/graphql"
|
||||||
import Breadcrum from "./Breadcrum"
|
import Breadcrum from "./Breadcrum"
|
||||||
import MoreMenu from "./MoreMenu"
|
import MoreMenu from "./MoreMenu"
|
||||||
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
|
||||||
|
import Table, { Data } from "./Table"
|
||||||
|
|
||||||
const BucketSelect: React.FC = () => {
|
const BucketSelect: React.FC = () => {
|
||||||
|
const history = useHistory()
|
||||||
const {data: buckets, loading} = useListBucktesQuery()
|
const {data: buckets, loading} = useListBucktesQuery()
|
||||||
|
const tableData: Data = {
|
||||||
|
headers:[{name:"Bucket"}],
|
||||||
|
body:(!buckets?[]:buckets.buckets.map(e=>{return {cells:[{name:e||""}],onClick:()=>{history.push(`/f/${e}`)}}}))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
@ -17,13 +22,7 @@ const BucketSelect: React.FC = () => {
|
|||||||
<MoreMenu />
|
<MoreMenu />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<Table data={tableData}/>
|
||||||
{buckets?.buckets.map((e)=>
|
|
||||||
<li key={e}>
|
|
||||||
<Link to={`/f/${e}/`} >{e}</Link>
|
|
||||||
</li>
|
|
||||||
)}
|
|
||||||
</ul>
|
|
||||||
{loading &&
|
{loading &&
|
||||||
<div className="flex justify-center mt-4">
|
<div className="flex justify-center mt-4">
|
||||||
<Spinner className="animate-spin h-6 w-6 dark:text-white" />
|
<Spinner className="animate-spin h-6 w-6 dark:text-white" />
|
||||||
|
Loading…
Reference in New Issue
Block a user