mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-26 12:21:23 +00:00
Compare commits
6 Commits
new-access
...
release/mo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12442fadfb | ||
|
|
17754cba05 | ||
|
|
b07fa89a23 | ||
|
|
28db549fa1 | ||
|
|
fe892dcc62 | ||
|
|
380caba5f5 |
@@ -109,14 +109,14 @@ let configContext: Readonly<ConfigContext> = {
|
|||||||
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Prod,
|
PORTAL_BACKEND_ENDPOINT: PortalBackendEndpoints.Prod,
|
||||||
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
MONGO_PROXY_ENDPOINT: MongoProxyEndpoints.Prod,
|
||||||
NEW_MONGO_APIS: [
|
NEW_MONGO_APIS: [
|
||||||
"resourcelist",
|
// "resourcelist",
|
||||||
"queryDocuments",
|
// "queryDocuments",
|
||||||
"createDocument",
|
// "createDocument",
|
||||||
"readDocument",
|
// "readDocument",
|
||||||
"updateDocument",
|
// "updateDocument",
|
||||||
"deleteDocument",
|
// "deleteDocument",
|
||||||
"createCollectionWithProxy",
|
// "createCollectionWithProxy",
|
||||||
"legacyMongoShell",
|
// "legacyMongoShell",
|
||||||
],
|
],
|
||||||
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
MONGO_PROXY_OUTBOUND_IPS_ALLOWLISTED: false,
|
||||||
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
CASSANDRA_PROXY_ENDPOINT: CassandraProxyEndpoints.Prod,
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
export interface QueryRequestOptions {
|
export interface QueryRequestOptions {
|
||||||
$skipToken?: string;
|
$skipToken?: string;
|
||||||
$top?: number;
|
$top?: number;
|
||||||
subscriptions: string[];
|
$allowPartialScopes: boolean;
|
||||||
|
subscriptions?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface QueryResponse {
|
export interface QueryResponse {
|
||||||
|
|||||||
@@ -363,18 +363,24 @@ export class CassandraAPIDataClient extends TableDataClient {
|
|||||||
entitiesToDelete: Entities.ITableEntity[],
|
entitiesToDelete: Entities.ITableEntity[],
|
||||||
): Promise<any> {
|
): Promise<any> {
|
||||||
const query = `DELETE FROM ${collection.databaseId}.${collection.id()} WHERE `;
|
const query = `DELETE FROM ${collection.databaseId}.${collection.id()} WHERE `;
|
||||||
const partitionKeyProperty = this.getCassandraPartitionKeyProperty(collection);
|
const partitionKeys: CassandraTableKey[] = collection.cassandraKeys.partitionKeys;
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
entitiesToDelete.map(async (currEntityToDelete: Entities.ITableEntity) => {
|
entitiesToDelete.map(async (currEntityToDelete: Entities.ITableEntity) => {
|
||||||
const clearMessage = NotificationConsoleUtils.logConsoleProgress(`Deleting row ${currEntityToDelete.RowKey._}`);
|
const clearMessage = NotificationConsoleUtils.logConsoleProgress(`Deleting row ${currEntityToDelete.RowKey._}`);
|
||||||
const partitionKeyValue = currEntityToDelete[partitionKeyProperty];
|
|
||||||
const currQuery =
|
|
||||||
query +
|
|
||||||
(this.isStringType(partitionKeyValue.$)
|
|
||||||
? `${partitionKeyProperty} = '${partitionKeyValue._}'`
|
|
||||||
: `${partitionKeyProperty} = ${partitionKeyValue._}`);
|
|
||||||
|
|
||||||
|
let currQuery = query;
|
||||||
|
for (let partitionKeyIndex = 0; partitionKeyIndex < partitionKeys.length; partitionKeyIndex++) {
|
||||||
|
const partitionKey: CassandraTableKey = partitionKeys[partitionKeyIndex];
|
||||||
|
const partitionKeyValue: Entities.ITableEntityAttribute = currEntityToDelete[partitionKey.property];
|
||||||
|
currQuery =
|
||||||
|
currQuery +
|
||||||
|
(this.isStringType(partitionKeyValue.$)
|
||||||
|
? `${partitionKey.property} = '${partitionKeyValue._}'`
|
||||||
|
: `${partitionKey.property} = ${partitionKeyValue._}`);
|
||||||
|
if (partitionKeyIndex < partitionKeys.length - 1) {
|
||||||
|
currQuery = `${currQuery} AND `;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
await this.queryDocuments(collection, currQuery);
|
await this.queryDocuments(collection, currQuery);
|
||||||
NotificationConsoleUtils.logConsoleInfo(`Successfully deleted row ${currEntityToDelete.RowKey._}`);
|
NotificationConsoleUtils.logConsoleInfo(`Successfully deleted row ${currEntityToDelete.RowKey._}`);
|
||||||
|
|||||||
@@ -340,7 +340,7 @@ describe("Documents tab (noSql API)", () => {
|
|||||||
isPreferredApiMongoDB: false,
|
isPreferredApiMongoDB: false,
|
||||||
documentIds: [],
|
documentIds: [],
|
||||||
collection: undefined,
|
collection: undefined,
|
||||||
partitionKey: undefined,
|
partitionKey: { kind: "Hash", paths: ["/foo"], version: 2 },
|
||||||
onLoadStartKey: 0,
|
onLoadStartKey: 0,
|
||||||
tabTitle: "",
|
tabTitle: "",
|
||||||
onExecutionErrorChange: (isExecutionError: boolean): void => {
|
onExecutionErrorChange: (isExecutionError: boolean): void => {
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ import { getErrorMessage, getErrorStack } from "Common/ErrorHandlingUtils";
|
|||||||
import MongoUtility from "Common/MongoUtility";
|
import MongoUtility from "Common/MongoUtility";
|
||||||
import { StyleConstants } from "Common/StyleConstants";
|
import { StyleConstants } from "Common/StyleConstants";
|
||||||
import { createDocument } from "Common/dataAccess/createDocument";
|
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 { queryDocuments } from "Common/dataAccess/queryDocuments";
|
||||||
import { readDocument } from "Common/dataAccess/readDocument";
|
import { readDocument } from "Common/dataAccess/readDocument";
|
||||||
import { updateDocument } from "Common/dataAccess/updateDocument";
|
import { updateDocument } from "Common/dataAccess/updateDocument";
|
||||||
@@ -824,7 +827,7 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
}, [initialDocumentContent, selectedDocumentContentBaseline, setSelectedDocumentContent]);
|
}, [initialDocumentContent, selectedDocumentContentBaseline, setSelectedDocumentContent]);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation using bulk delete
|
* Implementation using bulk delete NoSQL API
|
||||||
*/
|
*/
|
||||||
let _deleteDocuments = useCallback(
|
let _deleteDocuments = useCallback(
|
||||||
async (toDeleteDocumentIds: DocumentId[]): Promise<DocumentId[]> => {
|
async (toDeleteDocumentIds: DocumentId[]): Promise<DocumentId[]> => {
|
||||||
@@ -834,7 +837,14 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
tabTitle,
|
tabTitle,
|
||||||
});
|
});
|
||||||
setIsExecuting(true);
|
setIsExecuting(true);
|
||||||
return deleteNoSqlDocuments(_collection, toDeleteDocumentIds)
|
|
||||||
|
// TODO: Once JS SDK Bug fix for bulk deleting legacy containers (whose systemKey==1) is released:
|
||||||
|
// Remove the check for systemKey, remove call to deleteNoSqlDocument(). deleteNoSqlDocuments() should always be called.
|
||||||
|
return (
|
||||||
|
partitionKey.systemKey
|
||||||
|
? deleteNoSqlDocument(_collection, toDeleteDocumentIds[0]).then(() => [toDeleteDocumentIds[0]])
|
||||||
|
: deleteNoSqlDocuments(_collection, toDeleteDocumentIds)
|
||||||
|
)
|
||||||
.then(
|
.then(
|
||||||
(deletedIds) => {
|
(deletedIds) => {
|
||||||
TelemetryProcessor.traceSuccess(
|
TelemetryProcessor.traceSuccess(
|
||||||
@@ -1800,7 +1810,8 @@ export const DocumentsTabComponent: React.FunctionComponent<IDocumentsTabCompone
|
|||||||
size={tableContainerSizePx}
|
size={tableContainerSizePx}
|
||||||
columnHeaders={columnHeaders}
|
columnHeaders={columnHeaders}
|
||||||
isSelectionDisabled={
|
isSelectionDisabled={
|
||||||
configContext.platform === Platform.Fabric && userContext.fabricContext?.isReadOnly
|
(partitionKey.systemKey && !isPreferredApiMongoDB) ||
|
||||||
|
(configContext.platform === Platform.Fabric && userContext.fabricContext?.isReadOnly)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
{tableItems.length > 0 && (
|
{tableItems.length > 0 && (
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ export default class MongoShellTabComponent extends Component<
|
|||||||
data: {
|
data: {
|
||||||
resourceId: resourceId,
|
resourceId: resourceId,
|
||||||
accountName: accountName,
|
accountName: accountName,
|
||||||
mongoEndpoint: mongoEndpoint,
|
mongoEndpoint: this._useMongoProxyEndpoint ? documentEndpoint : mongoEndpoint,
|
||||||
authorization: authorization,
|
authorization: authorization,
|
||||||
databaseId: databaseId,
|
databaseId: databaseId,
|
||||||
collectionId: collectionId,
|
collectionId: collectionId,
|
||||||
|
|||||||
@@ -52,11 +52,17 @@ export async function fetchDatabaseAccountsFromGraph(
|
|||||||
const body = {
|
const body = {
|
||||||
query: databaseAccountsQuery,
|
query: databaseAccountsQuery,
|
||||||
subscriptions: [subscriptionId],
|
subscriptions: [subscriptionId],
|
||||||
...(skipToken && {
|
...(skipToken
|
||||||
options: {
|
? {
|
||||||
$skipToken: skipToken,
|
options: {
|
||||||
} as QueryRequestOptions,
|
$skipToken: skipToken,
|
||||||
}),
|
} as QueryRequestOptions,
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
options: {
|
||||||
|
$top: 150,
|
||||||
|
} as QueryRequestOptions,
|
||||||
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(managementResourceGraphAPIURL, {
|
const response = await fetch(managementResourceGraphAPIURL, {
|
||||||
|
|||||||
@@ -51,11 +51,13 @@ export async function fetchSubscriptionsFromGraph(accessToken: string): Promise<
|
|||||||
do {
|
do {
|
||||||
const body = {
|
const body = {
|
||||||
query: subscriptionsQuery,
|
query: subscriptionsQuery,
|
||||||
...(skipToken && {
|
options: {
|
||||||
options: {
|
$allowPartialScopes: true,
|
||||||
|
$top: 150,
|
||||||
|
...(skipToken && {
|
||||||
$skipToken: skipToken,
|
$skipToken: skipToken,
|
||||||
} as QueryRequestOptions,
|
}),
|
||||||
}),
|
} as QueryRequestOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
const response = await fetch(managementResourceGraphAPIURL, {
|
const response = await fetch(managementResourceGraphAPIURL, {
|
||||||
|
|||||||
Reference in New Issue
Block a user