From fe892dcc621875f9ba2db505c8da40e41e1b88cd Mon Sep 17 00:00:00 2001 From: Laurent Nguyen Date: Fri, 21 Jun 2024 09:37:34 +0200 Subject: [PATCH] Temporarily disable bulk Delete for old non-partitioned NoSQL containers (#1880) * Disable Delete button and document selection when partitionKey.systemKey = true for noSql. * Update unit tests * Always show delete button. Use single delete API for systemKey containers --- .../DocumentsTabV2/DocumentsTabV2.test.tsx | 2 +- .../Tabs/DocumentsTabV2/DocumentsTabV2.tsx | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx index 3d2b1e663..267db89b6 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.test.tsx @@ -340,7 +340,7 @@ describe("Documents tab (noSql API)", () => { isPreferredApiMongoDB: false, documentIds: [], collection: undefined, - partitionKey: undefined, + partitionKey: { kind: "Hash", paths: ["/foo"], version: 2 }, onLoadStartKey: 0, tabTitle: "", onExecutionErrorChange: (isExecutionError: boolean): void => { diff --git a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx index 60367cb66..b243968b6 100644 --- a/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx +++ b/src/Explorer/Tabs/DocumentsTabV2/DocumentsTabV2.tsx @@ -7,7 +7,10 @@ import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils"; import MongoUtility from "Common/MongoUtility"; import { StyleConstants } from "Common/StyleConstants"; import { createDocument } from "Common/dataAccess/createDocument"; -import { deleteDocuments as deleteNoSqlDocuments } from "Common/dataAccess/deleteDocument"; +import { + deleteDocument as deleteNoSqlDocument, + deleteDocuments as deleteNoSqlDocuments, +} from "Common/dataAccess/deleteDocument"; import { queryDocuments } from "Common/dataAccess/queryDocuments"; import { readDocument } from "Common/dataAccess/readDocument"; import { updateDocument } from "Common/dataAccess/updateDocument"; @@ -824,7 +827,7 @@ export const DocumentsTabComponent: React.FunctionComponent => { @@ -834,7 +837,14 @@ export const DocumentsTabComponent: React.FunctionComponent [toDeleteDocumentIds[0]]) + : deleteNoSqlDocuments(_collection, toDeleteDocumentIds) + ) .then( (deletedIds) => { TelemetryProcessor.traceSuccess( @@ -1800,7 +1810,8 @@ export const DocumentsTabComponent: React.FunctionComponent {tableItems.length > 0 && (