diff --git a/apps/dcellar-web-ui/src/components/common/DCTable/index.tsx b/apps/dcellar-web-ui/src/components/common/DCTable/index.tsx
index 06b449f5..8c6e16f8 100644
--- a/apps/dcellar-web-ui/src/components/common/DCTable/index.tsx
+++ b/apps/dcellar-web-ui/src/components/common/DCTable/index.tsx
@@ -176,7 +176,7 @@ export const UploadStatus = ({ object, size }: { object: string; size: number })
]
.filter((item) => !!item)
.join('/');
- return objectInList === object;
+ return objectInList === object && q.status !== 'ERROR';
});
if (!file) return Created on Chain;
diff --git a/apps/dcellar-web-ui/src/facade/account.ts b/apps/dcellar-web-ui/src/facade/account.ts
index 128bf779..a4a961ab 100644
--- a/apps/dcellar-web-ui/src/facade/account.ts
+++ b/apps/dcellar-web-ui/src/facade/account.ts
@@ -41,7 +41,7 @@ export const getAccountBalance = async ({
export type CreateTmpAccountParams = {
address: string;
bucketName: string;
- amount: number;
+ amount: ReturnType;
connector: Connector;
actionType?: 'delete' | 'create';
};
@@ -74,7 +74,7 @@ export const createTempAccount = async ({
granter: address,
grantee: wallet.address,
allowedMessages: grantAllowedMessage,
- amount: parseEther(amount <= 0 ? '0.1' : String(amount)).toString(),
+ amount: parseEther(amount.lte(0) ? '0.1' : String(amount)).toString(),
denom: 'BNB',
expirationTime: toTimestamp(expirationDate),
})
diff --git a/apps/dcellar-web-ui/src/modules/object/components/BatchDeleteObjectOperation.tsx b/apps/dcellar-web-ui/src/modules/object/components/BatchDeleteObjectOperation.tsx
index 38a8dfa4..bcacc3c1 100644
--- a/apps/dcellar-web-ui/src/modules/object/components/BatchDeleteObjectOperation.tsx
+++ b/apps/dcellar-web-ui/src/modules/object/components/BatchDeleteObjectOperation.tsx
@@ -19,7 +19,12 @@ import {
setupAccountRecords,
} from '@/store/slices/accounts';
import { TBucket } from '@/store/slices/bucket';
-import { selectGnfdGasFeesConfig, setSignatureAction } from '@/store/slices/global';
+import {
+ selectGnfdGasFeesConfig,
+ selectUploadQueue,
+ setSignatureAction,
+ UploadObject,
+} from '@/store/slices/global';
import { setDeletedObject, setObjectSelectedKeys } from '@/store/slices/object';
import { BN } from '@/utils/math';
import { getStoreNetflowRate } from '@/utils/payment';
@@ -34,7 +39,7 @@ import { ColoredWaitingIcon } from '@node-real/icons';
import { Flex, ModalBody, ModalFooter, ModalHeader, Text, toast } from '@node-real/uikit';
import { useAsyncEffect } from 'ahooks';
import { parseEther } from 'ethers/lib/utils.js';
-import { round } from 'lodash-es';
+import { find, round } from 'lodash-es';
import { memo, useMemo, useState } from 'react';
import { useAccount } from 'wagmi';
@@ -60,6 +65,7 @@ export const BatchDeleteObjectOperation = memo(
const bankBalance = useAppSelector((root) => root.accounts.bankOrWalletBalance);
const gnfdGasFeesConfig = useAppSelector(selectGnfdGasFeesConfig);
+ const uploadQueue = useAppSelector(selectUploadQueue(loginAccount));
const { crudTimestamp } = useAppSelector(selectAccount(bucket?.PaymentAddress));
const availableBalance = useAppSelector(selectAvailableBalance(bucket?.PaymentAddress));
const [loading, setLoading] = useState(false);
@@ -126,10 +132,12 @@ export const BatchDeleteObjectOperation = memo(
desc: WALLET_CONFIRM,
}),
);
+
const [tempAccount, err] = await createTempAccount({
address: loginAccount,
bucketName: currentBucketName,
- amount: parseEther(round(Number(availableBalance), 6).toString()).toNumber(),
+ // fix toNumber overflow fault
+ amount: parseEther(round(Number(availableBalance), 6).toString()),
connector: connector!,
actionType: 'delete',
});
@@ -149,7 +157,20 @@ export const BatchDeleteObjectOperation = memo(
connector: connector!,
privateKey,
};
- const [txRes, error] = await (ObjectStatus === 1
+
+ const file = find(uploadQueue, (q) => {
+ const objectInList = [
+ ...q.prefixFolders,
+ q.waitObject.relativePath || '',
+ q.waitObject.name,
+ ]
+ .filter((item) => !!item)
+ .join('/');
+
+ return objectInList === objectName && q.status !== 'ERROR';
+ });
+
+ const [txRes, error] = await (ObjectStatus === 1 || (ObjectStatus !== 1 && !file)
? deleteObject(payload)
: cancelCreateObject(payload));
if (error && error !== E_OBJECT_NOT_EXISTS) {
diff --git a/apps/dcellar-web-ui/src/modules/object/components/ObjectList.tsx b/apps/dcellar-web-ui/src/modules/object/components/ObjectList.tsx
index 6082ac5d..1becbc93 100644
--- a/apps/dcellar-web-ui/src/modules/object/components/ObjectList.tsx
+++ b/apps/dcellar-web-ui/src/modules/object/components/ObjectList.tsx
@@ -58,7 +58,6 @@ import { find, uniq, without, xor } from 'lodash-es';
import { memo, useCallback } from 'react';
import { OBJECT_ERROR_TYPES, ObjectErrorType } from '../ObjectError';
import Link from 'next/link';
-// import { ManageObjectTagsDrawer } from './ManageObjectTagsDrawer';
export type ObjectActionValueType =
| 'marketplace'
@@ -348,17 +347,18 @@ export const ObjectList = memo(function ObjectList({ shareMode
const file = find(
uploadQueue,
(q) =>
- [...q.prefixFolders, q.waitObject.name].join('/') === record.objectName &&
- q.status !== 'ERROR',
+ [...q.prefixFolders, q.waitObject.relativePath || '', q.waitObject.name]
+ .filter((item) => !!item)
+ .join('/') === record.objectName && q.status !== 'ERROR',
);
// if is uploading, can not cancel;
if (file && ['SIGN', 'SIGNED', 'UPLOAD'].includes(file.status)) {
pruneActions = pickAction(pruneActions, ['detail']);
- } else if (file && ['SEAL'].includes(file.status)) {
- pruneActions = removeAction(pruneActions, ['cancel', 'share']);
+ } else if (file && ['SEAL', 'SEALING'].includes(file.status)) {
+ pruneActions = removeAction(pruneActions, ['cancel', 'share', 'delete']);
} else {
// if not sealed, only support 'cancel' 'detail'
- pruneActions = pickAction(pruneActions, ['cancel', 'detail']);
+ pruneActions = pickAction(pruneActions, ['detail', 'delete']);
}
}
@@ -402,10 +402,25 @@ export const ObjectList = memo(function ObjectList({ shareMode
selectedRowKeys: objectSelectedKeys,
onSelect: onSelectChange,
onSelectAll: onSelectAllChange,
- getCheckboxProps: (record: ObjectEntity) => ({
- disabled: record.folder || record.objectStatus !== 1, // Column configuration not to be checked
- name: record.name,
- }),
+ getCheckboxProps: (record: ObjectEntity) => {
+ const file = find(uploadQueue, (q) => {
+ const objectInList = [
+ ...q.prefixFolders,
+ q.waitObject.relativePath || '',
+ q.waitObject.name,
+ ]
+ .filter((item) => !!item)
+ .join('/');
+
+ return objectInList === record.objectName && q.status !== 'ERROR';
+ });
+
+ return {
+ // folder or upload failed
+ disabled: record.folder || (record.objectStatus !== 1 && !!file), // Column configuration not to be checked
+ name: record.name,
+ };
+ },
};
const errorHandler = (type: string) => {
@@ -464,8 +479,6 @@ export const ObjectList = memo(function ObjectList({ shareMode
address: loginAccount,
};
- // const operator = primarySpInfo.operatorAddress;
- // const { seedString } = await dispatch(getSpOffChainData(loginAccount, operator));
const [success, opsError] = await downloadObject(params, seedString);
if (opsError) return errorHandler(opsError);
dispatch(setupBucketQuota(currentBucketName));
diff --git a/apps/dcellar-web-ui/src/modules/upload/UploadObjectsOperation.tsx b/apps/dcellar-web-ui/src/modules/upload/UploadObjectsOperation.tsx
index 92f5fc7d..2d9cd24b 100644
--- a/apps/dcellar-web-ui/src/modules/upload/UploadObjectsOperation.tsx
+++ b/apps/dcellar-web-ui/src/modules/upload/UploadObjectsOperation.tsx
@@ -336,7 +336,7 @@ export const UploadObjectsOperation = memo(
const [tempAccount, error] = await createTempAccount({
address: loginAccount,
bucketName: currentBucketName,
- amount: parseEther(String(safeAmount)).toNumber(),
+ amount: parseEther(String(safeAmount)),
connector: connector!,
});
if (!tempAccount) {