From f33ebb078b6003af24ad6a569ce3c90e6e5d6b07 Mon Sep 17 00:00:00 2001 From: pricelessrabbit Date: Sat, 22 Jun 2024 19:53:43 +0200 Subject: [PATCH] added fe implementation for bucket purge --- frontend/docs/entities/kv-bucket/purge.md | 21 ++ frontend/package.json.md5 | 2 +- frontend/src/api/buckets.ts | 2 +- .../stacks/buckets/list/ListView.tsx | 5 + frontend/src/mocks/ajax/handlers/bucket.ts | 2 +- frontend/src/stores/stacks/buckets/index.ts | 284 ++++++++++-------- 6 files changed, 181 insertions(+), 135 deletions(-) create mode 100644 frontend/docs/entities/kv-bucket/purge.md diff --git a/frontend/docs/entities/kv-bucket/purge.md b/frontend/docs/entities/kv-bucket/purge.md new file mode 100644 index 00000000..620dce17 --- /dev/null +++ b/frontend/docs/entities/kv-bucket/purge.md @@ -0,0 +1,21 @@ + +## PURGE DELETED KEYS +purge all the bucket keys already marked as deleted + + +### URL +``` +DELETE /api/connection/:connection_id/kv/:bucket/purge_deleted +``` +- `connection_id` +uuid of the connection to get the bucket from +- `bucket` +name of the bucket + + +### BODY +`null` + + +### RESPONSE +204 diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index f01f2648..ff996cdc 100644 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -792c39dbe5875ea4aebf6aaeb14763c3 \ No newline at end of file +5c50c55ed1d570e6761fe26bdee5a402 \ No newline at end of file diff --git a/frontend/src/api/buckets.ts b/frontend/src/api/buckets.ts index 6813c223..5862bc7b 100644 --- a/frontend/src/api/buckets.ts +++ b/frontend/src/api/buckets.ts @@ -27,7 +27,7 @@ function create(connectionId: string, bucket: BucketConfig, opt?: CallOptions): /** PURGE DELETED keys from bucket */ function purgeDeleted(connectionId: string, bucketName: string, opt?: CallOptions): Promise { - return ajax.post(`connection/${connectionId}/kv/${bucketName}/purge`, null, opt) + return ajax.post(`connection/${connectionId}/kv/${bucketName}/purge_deleted`, null, opt) } diff --git a/frontend/src/components/stacks/buckets/list/ListView.tsx b/frontend/src/components/stacks/buckets/list/ListView.tsx index 326ee8d4..946176a7 100644 --- a/frontend/src/components/stacks/buckets/list/ListView.tsx +++ b/frontend/src/components/stacks/buckets/list/ListView.tsx @@ -34,6 +34,7 @@ const BucketsListView: FunctionComponent = ({ const handleSelect = (bucket: BucketState) => bucketsSo.select(bucket.bucket) const handleNew = () => bucketsSo.create() const handleDelete = () => bucketsSo.delete() + const handlePurge = () => bucketsSo.purgeDeleted() // RENDER const buckets = bucketsSo.getFiltered() ?? [] @@ -52,6 +53,10 @@ const BucketsListView: FunctionComponent = ({ value={bucketsSa.textSearch} onChange={text => bucketsSo.setTextSearch(text)} /> + {!!selected &&