|
@@ -14,16 +14,29 @@ const DropCollectionDialog: FC<DropCollectionProps> = props => {
|
|
|
const { t: dialogTrans } = useTranslation('dialog');
|
|
|
|
|
|
const handleDelete = async () => {
|
|
|
+ const res = [];
|
|
|
for (const item of collections) {
|
|
|
- await dropCollection(item.collection_name);
|
|
|
+ res.push(await dropCollection(item.collection_name));
|
|
|
}
|
|
|
|
|
|
- // show success message
|
|
|
- openSnackBar(
|
|
|
- successTrans('delete', {
|
|
|
- name: collectionTrans('collection'),
|
|
|
- })
|
|
|
- );
|
|
|
+ if (res.some(item => item.error_code !== 'Success')) {
|
|
|
+ // show error message
|
|
|
+ openSnackBar(
|
|
|
+ res
|
|
|
+ .filter(item => item.error_code !== 'Success')
|
|
|
+ .map(item => item.reason)
|
|
|
+ .join(', '),
|
|
|
+ 'error'
|
|
|
+ );
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ // show success message
|
|
|
+ openSnackBar(
|
|
|
+ successTrans('delete', {
|
|
|
+ name: collectionTrans('collection'),
|
|
|
+ })
|
|
|
+ );
|
|
|
+ }
|
|
|
|
|
|
handleCloseDialog();
|
|
|
onDelete && (await onDelete());
|