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

Function EvalDatasetRows

packages/ui/src/views/datasets/DatasetItems.jsx:52–507  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50// ==============================|| Dataset Items ||============================== //
51
52const EvalDatasetRows = () => {
53 const theme = useTheme()
54 const customization = useSelector((state) => state.customization)
55 const dispatch = useDispatch()
56 useNotifier()
57 const { error } = useError()
58
59 const [showRowDialog, setShowRowDialog] = useState(false)
60 const [showUploadDialog, setShowUploadDialog] = useState(false)
61 const [rowDialogProps, setRowDialogProps] = useState({})
62 const [showDatasetDialog, setShowDatasetDialog] = useState(false)
63 const [datasetDialogProps, setDatasetDialogProps] = useState({})
64
65 const [dataset, setDataset] = useState([])
66 const [isLoading, setLoading] = useState(true)
67 const [selected, setSelected] = useState([])
68
69 const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
70 const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
71
72 const { confirm } = useConfirm()
73
74 const getDatasetRows = useApi(datasetsApi.getDataset)
75 const reorderDatasetRowApi = useApi(datasetsApi.reorderDatasetRow)
76
77 const URLpath = document.location.pathname.toString().split('/')
78 const datasetId = URLpath[URLpath.length - 1] === 'dataset_rows' ? '' : URLpath[URLpath.length - 1]
79
80 const { hasPermission } = useAuth()
81
82 const draggingItem = useRef()
83 const dragOverItem = useRef()
84 const [Draggable, setDraggable] = useState(false)
85 const [startDragPos, setStartDragPos] = useState(-1)
86 const [endDragPos, setEndDragPos] = useState(-1)
87
88 /* Table Pagination */
89 const [currentPage, setCurrentPage] = useState(1)
90 const [pageLimit, setPageLimit] = useState(DEFAULT_ITEMS_PER_PAGE)
91 const [total, setTotal] = useState(0)
92 const onChange = (page, pageLimit) => {
93 setCurrentPage(page)
94 setPageLimit(pageLimit)
95 refresh(page, pageLimit)
96 }
97
98 const refresh = (page, limit) => {
99 setLoading(true)
100 const params = {
101 page: page || currentPage,
102 limit: limit || pageLimit
103 }
104 getDatasetRows.request(datasetId, params)
105 }
106
107 const handleDragStart = (e, position) => {
108 draggingItem.current = position
109 setStartDragPos(position)

Callers

nothing calls this directly

Calls 11

useErrorFunction · 0.90
useAuthFunction · 0.90
useNotifierFunction · 0.85
useConfirmFunction · 0.85
hasPermissionFunction · 0.85
handleDragEnterFunction · 0.85
handleDragEndFunction · 0.85
refreshFunction · 0.70
handleDragStartFunction · 0.70
handleSelectFunction · 0.70
editFunction · 0.70

Tested by

no test coverage detected