mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-21 01:34:24 +00:00
feat: add Breadcrumbs
This commit is contained in:
parent
fbbbb5f037
commit
77e9e80102
@ -1,13 +1,21 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useSearchParams } from 'next/navigation'
|
import { useSearchParams, useRouter } from 'next/navigation'
|
||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { useColorScheme, Table, Stack } from '@/lib/mui'
|
import {
|
||||||
|
useColorScheme,
|
||||||
|
Table,
|
||||||
|
Stack,
|
||||||
|
Typography,
|
||||||
|
Breadcrumbs,
|
||||||
|
Link
|
||||||
|
} from '@/lib/mui'
|
||||||
import { Popover, Pagination } from 'antd'
|
import { Popover, Pagination } from 'antd'
|
||||||
import { fetchBaseURL } from '@/app/datastores/constants'
|
import { fetchBaseURL } from '@/app/datastores/constants'
|
||||||
const page_size = 20
|
const page_size = 20
|
||||||
|
|
||||||
const ChunkList = () => {
|
const ChunkList = () => {
|
||||||
|
const router = useRouter()
|
||||||
const { mode } = useColorScheme()
|
const { mode } = useColorScheme()
|
||||||
const spaceName = useSearchParams().get('spacename')
|
const spaceName = useSearchParams().get('spacename')
|
||||||
const documentId = useSearchParams().get('documentid')
|
const documentId = useSearchParams().get('documentid')
|
||||||
@ -40,6 +48,39 @@ const ChunkList = () => {
|
|||||||
fetchChunks()
|
fetchChunks()
|
||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
|
<div className="p-4">
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="flex-start"
|
||||||
|
alignItems="center"
|
||||||
|
sx={{ marginBottom: '20px' }}
|
||||||
|
>
|
||||||
|
<Breadcrumbs aria-label="breadcrumbs">
|
||||||
|
<Link
|
||||||
|
onClick={() => {
|
||||||
|
router.push('/datastores')
|
||||||
|
}}
|
||||||
|
key="Knowledge Space"
|
||||||
|
underline="hover"
|
||||||
|
color="neutral"
|
||||||
|
fontSize="inherit"
|
||||||
|
>
|
||||||
|
Knowledge Space
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
onClick={() => {
|
||||||
|
router.push(`/datastores/documents?name=${spaceName}`)
|
||||||
|
}}
|
||||||
|
key="Knowledge Space"
|
||||||
|
underline="hover"
|
||||||
|
color="neutral"
|
||||||
|
fontSize="inherit"
|
||||||
|
>
|
||||||
|
Documents
|
||||||
|
</Link>
|
||||||
|
<Typography fontSize="inherit">Chunks</Typography>
|
||||||
|
</Breadcrumbs>
|
||||||
|
</Stack>
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
{chunkList.length ? (
|
{chunkList.length ? (
|
||||||
<>
|
<>
|
||||||
@ -80,7 +121,11 @@ const ChunkList = () => {
|
|||||||
<td>
|
<td>
|
||||||
{
|
{
|
||||||
<Popover
|
<Popover
|
||||||
content={JSON.stringify(row.meta_info || '{}', null, 2)}
|
content={JSON.stringify(
|
||||||
|
row.meta_info || '{}',
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)}
|
||||||
trigger="hover"
|
trigger="hover"
|
||||||
>
|
>
|
||||||
{row.meta_info.length > 10
|
{row.meta_info.length > 10
|
||||||
@ -135,6 +180,7 @@ const ChunkList = () => {
|
|||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import {
|
|||||||
Chip,
|
Chip,
|
||||||
Switch,
|
Switch,
|
||||||
Typography,
|
Typography,
|
||||||
|
Breadcrumbs,
|
||||||
|
Link,
|
||||||
styled
|
styled
|
||||||
} from '@/lib/mui'
|
} from '@/lib/mui'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
@ -115,20 +117,33 @@ const Documents = () => {
|
|||||||
}, [])
|
}, [])
|
||||||
return (
|
return (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
<Sheet
|
<Stack
|
||||||
sx={{
|
direction="row"
|
||||||
display: 'flex',
|
justifyContent="space-between"
|
||||||
flexDirection: 'row-reverse'
|
alignItems="center"
|
||||||
}}
|
sx={{ marginBottom: '20px' }}
|
||||||
>
|
>
|
||||||
|
<Breadcrumbs aria-label="breadcrumbs">
|
||||||
|
<Link
|
||||||
|
onClick={() => {
|
||||||
|
router.push('/datastores')
|
||||||
|
}}
|
||||||
|
key="Knowledge Space"
|
||||||
|
underline="hover"
|
||||||
|
color="neutral"
|
||||||
|
fontSize="inherit"
|
||||||
|
>
|
||||||
|
Knowledge Space
|
||||||
|
</Link>
|
||||||
|
<Typography fontSize="inherit">Documents</Typography>
|
||||||
|
</Breadcrumbs>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={() => setIsAddDocumentModalShow(true)}
|
onClick={() => setIsAddDocumentModalShow(true)}
|
||||||
sx={{ marginBottom: '20px' }}
|
|
||||||
>
|
>
|
||||||
+ Add Datasource
|
+ Add Datasource
|
||||||
</Button>
|
</Button>
|
||||||
</Sheet>
|
</Stack>
|
||||||
{documents.length ? (
|
{documents.length ? (
|
||||||
<>
|
<>
|
||||||
<Table
|
<Table
|
||||||
@ -442,6 +457,17 @@ const Documents = () => {
|
|||||||
Synch:
|
Synch:
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="flex-start"
|
||||||
|
alignItems="center"
|
||||||
|
sx={{ marginBottom: '20px' }}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ marginRight: '20px' }}
|
||||||
|
onClick={() => setActiveStep(0)}
|
||||||
|
>{'< Back'}</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@ -469,7 +495,8 @@ const Documents = () => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
data.success && fetch(
|
data.success &&
|
||||||
|
fetch(
|
||||||
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -523,7 +550,8 @@ const Documents = () => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
data.success && fetch(
|
data.success &&
|
||||||
|
fetch(
|
||||||
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -581,7 +609,8 @@ const Documents = () => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
data.success && fetch(
|
data.success &&
|
||||||
|
fetch(
|
||||||
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
`${fetchBaseURL}/knowledge/${spaceName}/document/sync`,
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@ -623,6 +652,7 @@ const Documents = () => {
|
|||||||
>
|
>
|
||||||
Finish
|
Finish
|
||||||
</Button>
|
</Button>
|
||||||
|
</Stack>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Sheet>
|
</Sheet>
|
||||||
|
@ -144,7 +144,7 @@ const Index = () => {
|
|||||||
},
|
},
|
||||||
'& tbody tr a': {
|
'& tbody tr a': {
|
||||||
color: 'rgb(13, 96, 217)'
|
color: 'rgb(13, 96, 217)'
|
||||||
},
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<thead>
|
<thead>
|
||||||
@ -387,6 +387,17 @@ const Index = () => {
|
|||||||
Synch:
|
Synch:
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
<Stack
|
||||||
|
direction="row"
|
||||||
|
justifyContent="flex-start"
|
||||||
|
alignItems="center"
|
||||||
|
sx={{ marginBottom: '20px' }}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
sx={{ marginRight: '20px' }}
|
||||||
|
onClick={() => setActiveStep(1)}
|
||||||
|
>{'< Back'}</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
@ -511,6 +522,7 @@ const Index = () => {
|
|||||||
>
|
>
|
||||||
Finish
|
Finish
|
||||||
</Button>
|
</Button>
|
||||||
|
</Stack>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Sheet>
|
</Sheet>
|
||||||
|
Loading…
Reference in New Issue
Block a user