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

Function addNewDataset

packages/ui/src/views/datasets/AddEditDatasetDialog.jsx:84–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

82 }, [show, dispatch])
83
84 const addNewDataset = async () => {
85 try {
86 const obj = {
87 name: datasetName,
88 description: datasetDescription
89 }
90 if (selectedFile) {
91 obj.firstRowHeaders = firstRowHeaders
92 obj.csvFile = selectedFile
93 }
94 const createResp = await datasetApi.createDataset(obj)
95 if (createResp.data) {
96 enqueueSnackbar({
97 message: 'New Dataset added',
98 options: {
99 key: new Date().getTime() + Math.random(),
100 variant: 'success',
101 action: (key) => (
102 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
103 <IconX />
104 </Button>
105 )
106 }
107 })
108 onConfirm(createResp.data.id)
109 }
110 } catch (error) {
111 enqueueSnackbar({
112 message: `Failed to add new Dataset: ${
113 typeof error.response.data === 'object' ? error.response.data.message : error.response.data
114 }`,
115 options: {
116 key: new Date().getTime() + Math.random(),
117 variant: 'error',
118 persist: true,
119 action: (key) => (
120 <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}>
121 <IconX />
122 </Button>
123 )
124 }
125 })
126 onCancel()
127 }
128 }
129
130 const saveDataset = async () => {
131 try {

Callers 1

AddEditDatasetDialogFunction · 0.85

Calls 5

enqueueSnackbarFunction · 0.90
closeSnackbarFunction · 0.90
onCancelFunction · 0.85
onConfirmFunction · 0.70
getTimeMethod · 0.45

Tested by

no test coverage detected