MCPcopy
hub / github.com/FlowiseAI/Flowise / EvalsEvaluation

Function EvalsEvaluation

packages/ui/src/views/evaluations/index.jsx:64–506  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62import empty_evalSVG from '@/assets/images/empty_evals.svg'
63
64const EvalsEvaluation = () => {
65 const theme = useTheme()
66 const customization = useSelector((state) => state.customization)
67 const { confirm } = useConfirm()
68 const dispatch = useDispatch()
69 useNotifier()
70 const { error } = useError()
71
72 const enqueueSnackbar = (...args) => dispatch(enqueueSnackbarAction(...args))
73 const closeSnackbar = (...args) => dispatch(closeSnackbarAction(...args))
74
75 const createNewEvaluation = useApi(evaluationApi.createEvaluation)
76 const getAllEvaluations = useApi(evaluationApi.getAllEvaluations)
77
78 const [showNewEvaluationDialog, setShowNewEvaluationDialog] = useState(false)
79 const [dialogProps, setDialogProps] = useState({})
80 const [rows, setRows] = useState([])
81 const [loading, setLoading] = useState(false)
82 const [isTableLoading, setTableLoading] = useState(false)
83 const [selected, setSelected] = useState([])
84 const [autoRefresh, setAutoRefresh] = useState(false)
85
86 /* Table Pagination */
87 const [currentPage, setCurrentPage] = useState(1)
88 const [pageLimit, setPageLimit] = useState(DEFAULT_ITEMS_PER_PAGE)
89 const [total, setTotal] = useState(0)
90 const onChange = (page, pageLimit) => {
91 setCurrentPage(page)
92 setPageLimit(pageLimit)
93 refresh(page, pageLimit)
94 }
95
96 const refresh = (page, limit) => {
97 const params = {
98 page: page || currentPage,
99 limit: limit || pageLimit
100 }
101 getAllEvaluations.request(params)
102 }
103
104 const onSelectAllClick = (event) => {
105 if (event.target.checked) {
106 const newSelected = rows.filter((item) => item?.latestEval).map((n) => n.id)
107 setSelected(newSelected)
108 return
109 }
110 setSelected([])
111 }
112
113 const handleSelect = (event, id) => {
114 const selectedIndex = selected.indexOf(id)
115 let newSelected = []
116
117 if (selectedIndex === -1) {
118 newSelected = newSelected.concat(selected, id)
119 } else if (selectedIndex === 0) {
120 newSelected = newSelected.concat(selected.slice(1))
121 } else if (selectedIndex === selected.length - 1) {

Callers

nothing calls this directly

Calls 8

useErrorFunction · 0.90
enqueueSnackbarFunction · 0.90
closeSnackbarFunction · 0.90
useConfirmFunction · 0.85
useNotifierFunction · 0.85
refreshFunction · 0.70
parseMethod · 0.65
getTimeMethod · 0.45

Tested by

no test coverage detected