MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / LoaderRow

Function LoaderRow

packages/ui/src/views/docstore/DocumentStoreDetail.jsx:802–956  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

800}
801
802function LoaderRow(props) {
803 const [anchorEl, setAnchorEl] = useState(null)
804 const open = Boolean(anchorEl)
805
806 const handleClick = (event) => {
807 event.preventDefault()
808 event.stopPropagation()
809 setAnchorEl(event.currentTarget)
810 }
811
812 const handleClose = () => {
813 setAnchorEl(null)
814 }
815
816 const formatSources = (files, source, loaderName) => {
817 let sourceName = ''
818
819 // Prefer files.name when files array exists and has items
820 if (files && Array.isArray(files) && files.length > 0) {
821 sourceName = files.map((file) => file.name).join(', ')
822 } else if (source && typeof source === 'string' && source.includes('base64')) {
823 // Fallback to original source logic
824 sourceName = getFileName(source)
825 } else if (source && typeof source === 'string' && source.startsWith('[') && source.endsWith(']')) {
826 sourceName = JSON.parse(source).join(', ')
827 } else if (source) {
828 sourceName = source
829 }
830
831 // Return format: "LoaderName (sourceName)" or just "LoaderName" if no source
832 if (!sourceName) {
833 return loaderName || 'No source'
834 }
835 return loaderName ? `${loaderName} (${sourceName})` : sourceName
836 }
837
838 return (
839 <>
840 <TableRow hover key={props.index} sx={{ '&:last-child td, &:last-child th': { border: 0 }, cursor: 'pointer' }}>
841 <StyledTableCell onClick={props.onViewChunksClick} scope='row' style={{ width: '5%' }}>
842 <div
843 style={{
844 display: 'flex',
845 width: '20px',
846 height: '20px',
847 backgroundColor: props.loader?.status === 'SYNC' ? '#00e676' : '#ffe57f',
848 borderRadius: '50%'
849 }}
850 ></div>
851 </StyledTableCell>
852 <StyledTableCell onClick={props.onViewChunksClick} scope='row'>
853 {props.loader.loaderName}
854 </StyledTableCell>
855 <StyledTableCell onClick={props.onViewChunksClick}>{props.loader.splitterName ?? 'None'}</StyledTableCell>
856 <StyledTableCell onClick={props.onViewChunksClick}>
857 {formatSources(props.loader.files, props.loader.source)}
858 </StyledTableCell>
859 <StyledTableCell onClick={props.onViewChunksClick}>

Callers

nothing calls this directly

Calls 3

formatSourcesFunction · 0.85
handleClickFunction · 0.70
handleCloseFunction · 0.70

Tested by

no test coverage detected