MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / Documents

Function Documents

packages/ui/src/views/docstore/index.jsx:49–489  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47})
48
49const Documents = () => {
50 const theme = useTheme()
51 const dispatch = useDispatch()
52 const navigate = useNavigate()
53 const { hasPermission } = useAuth()
54 const getAllDocumentStores = useApi(documentsApi.getAllDocumentStores)
55 const { error } = useError()
56 useNotifier()
57
58 const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
59 const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
60
61 const [isLoading, setLoading] = useState(true)
62 const [images, setImages] = useState({})
63 const [search, setSearch] = useState('')
64 const [showDialog, setShowDialog] = useState(false)
65 const [dialogProps, setDialogProps] = useState({})
66 const [docStores, setDocStores] = useState([])
67 const [view, setView] = useState(localStorage.getItem('docStoreDisplayStyle') || 'card')
68 const [actionMenuAnchorEl, setActionMenuAnchorEl] = useState(null)
69 const [selectedDocumentStore, setSelectedDocumentStore] = useState(null)
70 const [showDeleteDocStoreDialog, setShowDeleteDocStoreDialog] = useState(false)
71 const [deleteDocStoreDialogProps, setDeleteDocStoreDialogProps] = useState({})
72
73 const canRenameDocumentStore = hasPermission('documentStores:create,documentStores:update')
74 const canDeleteDocumentStore = hasPermission('documentStores:delete')
75 const canManageDocumentStore = canRenameDocumentStore || canDeleteDocumentStore
76 const isActionMenuOpen = Boolean(actionMenuAnchorEl)
77
78 const handleChange = (event, nextView) => {
79 if (nextView === null) return
80 localStorage.setItem('docStoreDisplayStyle', nextView)
81 setView(nextView)
82 }
83
84 function filterDocStores(data) {
85 return (
86 data.name.toLowerCase().indexOf(search.toLowerCase()) > -1 || data.description.toLowerCase().indexOf(search.toLowerCase()) > -1
87 )
88 }
89
90 const onSearchChange = (event) => {
91 setSearch(event.target.value)
92 }
93
94 const getDeleteErrorMessage = (error) => {
95 const responseData = error?.response?.data
96
97 if (typeof responseData === 'string' && responseData.trim()) {
98 return responseData
99 }
100
101 const responseMessage = responseData && typeof responseData === 'object' ? responseData.message || responseData.error : undefined
102 if (typeof responseMessage === 'string' && responseMessage.trim()) {
103 return responseMessage
104 }
105
106 if (typeof error?.message === 'string' && error.message.trim()) {

Callers

nothing calls this directly

Calls 9

useAuthFunction · 0.90
useErrorFunction · 0.90
useNotifierFunction · 0.85
hasPermissionFunction · 0.85
goToDocumentStoreFunction · 0.85
handleActionMenuOpenFunction · 0.85
applyFiltersFunction · 0.70
downMethod · 0.45

Tested by

no test coverage detected