()
| 128 | } |
| 129 | |
| 130 | const saveDataset = async () => { |
| 131 | try { |
| 132 | const saveObj = { |
| 133 | name: datasetName, |
| 134 | description: datasetDescription |
| 135 | } |
| 136 | |
| 137 | const saveResp = await datasetApi.updateDataset(dataset.id, saveObj) |
| 138 | if (saveResp.data) { |
| 139 | enqueueSnackbar({ |
| 140 | message: 'Dataset saved', |
| 141 | options: { |
| 142 | key: new Date().getTime() + Math.random(), |
| 143 | variant: 'success', |
| 144 | action: (key) => ( |
| 145 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 146 | <IconX /> |
| 147 | </Button> |
| 148 | ) |
| 149 | } |
| 150 | }) |
| 151 | onConfirm(saveResp.data.id) |
| 152 | } |
| 153 | } catch (error) { |
| 154 | enqueueSnackbar({ |
| 155 | message: `Failed to save Dataset: ${ |
| 156 | typeof error.response.data === 'object' ? error.response.data.message : error.response.data |
| 157 | }`, |
| 158 | options: { |
| 159 | key: new Date().getTime() + Math.random(), |
| 160 | variant: 'error', |
| 161 | persist: true, |
| 162 | action: (key) => ( |
| 163 | <Button style={{ color: 'white' }} onClick={() => closeSnackbar(key)}> |
| 164 | <IconX /> |
| 165 | </Button> |
| 166 | ) |
| 167 | } |
| 168 | }) |
| 169 | onCancel() |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | const component = show ? ( |
| 174 | <Dialog |
no test coverage detected