Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/ui/src/ui-component/cards/DocumentStoreCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const CardWrapper = styled(MainCard)(({ theme }) => ({

// ===========================|| DOC STORE CARD ||=========================== //

const DocumentStoreCard = ({ data, images, onClick }) => {
const DocumentStoreCard = ({ data, images, onClick, hasActions }) => {
const theme = useTheme()
const customization = useSelector((state) => state.customization)

Expand All @@ -48,7 +48,8 @@ const DocumentStoreCard = ({ data, images, onClick }) => {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
overflow: 'hidden'
overflow: 'hidden',
paddingRight: hasActions ? '30px' : 0
}}
>
<Typography
Expand Down Expand Up @@ -186,7 +187,8 @@ const DocumentStoreCard = ({ data, images, onClick }) => {
DocumentStoreCard.propTypes = {
data: PropTypes.object,
images: PropTypes.array,
onClick: PropTypes.func
onClick: PropTypes.func,
hasActions: PropTypes.bool
}

export default DocumentStoreCard
45 changes: 43 additions & 2 deletions packages/ui/src/ui-component/table/DocumentStoreTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useSelector } from 'react-redux'
import { styled } from '@mui/material/styles'
import {
Box,
IconButton,
Paper,
Skeleton,
Table,
Expand All @@ -18,6 +19,7 @@ import {
} from '@mui/material'
import { tableCellClasses } from '@mui/material/TableCell'
import DocumentStoreStatus from '@/views/docstore/DocumentStoreStatus'
import { IconDotsVertical } from '@tabler/icons-react'

const StyledTableCell = styled(TableCell)(({ theme }) => ({
borderColor: theme.palette.grey[900] + 25,
Expand All @@ -38,7 +40,7 @@ const StyledTableRow = styled(TableRow)(() => ({
}
}))

export const DocumentStoreTable = ({ data, isLoading, onRowClick, images }) => {
export const DocumentStoreTable = ({ data, isLoading, onRowClick, images, showActions, onActionMenuClick }) => {
const theme = useTheme()
const customization = useSelector((state) => state.customization)

Expand Down Expand Up @@ -88,6 +90,11 @@ export const DocumentStoreTable = ({ data, isLoading, onRowClick, images }) => {
<StyledTableCell>Total characters</StyledTableCell>
<StyledTableCell>Total chunks</StyledTableCell>
<StyledTableCell>Loader Types</StyledTableCell>
{showActions && (
<StyledTableCell align='right' sx={{ width: 44, pr: 1 }}>
&nbsp;
</StyledTableCell>
)}
</TableRow>
</TableHead>
<TableBody>
Expand Down Expand Up @@ -115,6 +122,11 @@ export const DocumentStoreTable = ({ data, isLoading, onRowClick, images }) => {
<StyledTableCell>
<Skeleton variant='text' />
</StyledTableCell>
{showActions && (
<StyledTableCell>
<Skeleton variant='text' />
</StyledTableCell>
)}
</StyledTableRow>
<StyledTableRow>
<StyledTableCell>
Expand All @@ -138,6 +150,11 @@ export const DocumentStoreTable = ({ data, isLoading, onRowClick, images }) => {
<StyledTableCell>
<Skeleton variant='text' />
</StyledTableCell>
{showActions && (
<StyledTableCell>
<Skeleton variant='text' />
</StyledTableCell>
)}
</StyledTableRow>
</>
) : (
Expand Down Expand Up @@ -233,6 +250,28 @@ export const DocumentStoreTable = ({ data, isLoading, onRowClick, images }) => {
</Box>
)}
</StyledTableCell>
{showActions && (
<StyledTableCell align='right' sx={{ width: 44, mr: 1 }}>
<IconButton
size='small'
aria-label='Document store options'
sx={{
p: 0.5,
backgroundColor: theme.palette.background.paper,
border: `1px solid ${theme.palette.grey[900]}25`,
'&:hover': {
backgroundColor: theme.palette.action.hover
}
}}
onClick={(event) => {
event.stopPropagation()
onActionMenuClick(event, row)
}}
>
<IconDotsVertical size={18} />
</IconButton>
</StyledTableCell>
)}
</StyledTableRow>
)
})}
Expand All @@ -249,7 +288,9 @@ DocumentStoreTable.propTypes = {
data: PropTypes.array,
isLoading: PropTypes.bool,
images: PropTypes.object,
onRowClick: PropTypes.func
onRowClick: PropTypes.func,
showActions: PropTypes.bool,
onActionMenuClick: PropTypes.func
}

DocumentStoreTable.displayName = 'DocumentStoreTable'
12 changes: 10 additions & 2 deletions packages/ui/src/views/docstore/AddDocStoreDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ const AddDocStoreDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
)
}
})
onConfirm(createResp.data.id)
onConfirm(createResp.data.id, {
...(createResp.data || {}),
name: documentStoreName,
description: documentStoreDesc
})
}
} catch (error) {
enqueueSnackbar({
Expand Down Expand Up @@ -128,7 +132,11 @@ const AddDocStoreDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
)
}
})
onConfirm(saveResp.data.id)
onConfirm(saveResp.data.id, {
...(saveResp.data || {}),
name: documentStoreName,
description: documentStoreDesc
})
}
} catch (error) {
enqueueSnackbar({
Expand Down
Loading