Skip to content

Commit

Permalink
fix: access key loading
Browse files Browse the repository at this point in the history
  • Loading branch information
lulu-tro committed Jun 17, 2024
1 parent 62e23de commit 6ba9a36
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
9 changes: 8 additions & 1 deletion src/components/Tables/S3ApiTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ export default function S3ApiTable({ color }) {
const [globalS3Obj, setGlobalS3Obj] = useState(null);
const history = useHistory();
const [bucketList, setBucketList] = useState(null);
const [loading, setLoading] = useState(false);
const [accessKeyList, setAccessKeyList] = useState([]);
const [curAccessData, setAccessData] = useState(null);
const handleNewBucket = () => {
Emitter.emit('openS3NewBucketModal', { globalS3, callbackFn: reFetchBucketList })
}

const fetchBucketList = async (params) => {
if(!params)return;
try {
globalS3 = null;
globalS3 = new S3Client({
Expand All @@ -57,6 +59,8 @@ export default function S3ApiTable({ color }) {

} catch (e) {
console.log("error", e)
setLoading(false)

}

}
Expand All @@ -73,6 +77,7 @@ export default function S3ApiTable({ color }) {
}, [curAccessData]);

const reFetchBucketList = async () => {
setLoading(true)
try {
const input = {};
const command = new ListBucketsCommand(input);
Expand All @@ -97,8 +102,10 @@ export default function S3ApiTable({ color }) {
const list = sortListByDate(bucketList, 'CreationDate')
setBucketList(() => [...list])
}
setLoading(false)
} catch (e) {
console.log("error", e)
setLoading(false)
}

}
Expand Down Expand Up @@ -226,7 +233,7 @@ export default function S3ApiTable({ color }) {
})}
</tbody>
</table>
{!bucketList && (
{loading && (
<div className="w-full flex justify-center pt-4">
<img
alt="loading"
Expand Down
1 change: 0 additions & 1 deletion src/components/Tables/S3BucketsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export default function S3BucketsTable({ color, bucketName, accessKeyId, secretA
})

Contents.map((item, index) => {

item.Name = item.Key.slice(prefixLen);
item.Type = 2;
item.CID = CIDList[index];
Expand Down
4 changes: 2 additions & 2 deletions src/utils/BTFSUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@ export function ceilLatency(str) {
let unit = str.replace(/[^a-zA-Z]/g, '');
return numInt + ' ' + unit;
} else {
return 'n/a'
return '--'
}
} catch (e) {
console.log(e);
return 'n/a'
return '--'
}
}

Expand Down

0 comments on commit 6ba9a36

Please sign in to comment.