mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 02:11:29 +00:00
Update region selection to include global endpoint and generate a unique list of read and write endpoints.
Need to continue with clearing out selected endpoint when global is selected again. Write operations stall when read region is selected even though 403 returned when region rejects operation. Need to limit feature availablility to nosql, table, gremlin (maybe).
This commit is contained in:
@@ -232,6 +232,10 @@ export class SavedQueries {
|
||||
public static readonly PartitionKeyProperty: string = "id";
|
||||
}
|
||||
|
||||
export class RegionSelectionOptions {
|
||||
public static readonly Global: string = "Global";
|
||||
}
|
||||
|
||||
export class DocumentsGridMetrics {
|
||||
public static DocumentsPerPage: number = 100;
|
||||
public static IndividualRowHeight: number = 34;
|
||||
|
||||
@@ -119,7 +119,11 @@ export const endpoint = () => {
|
||||
const location = _global.parent ? _global.parent.location : _global.location;
|
||||
return configContext.EMULATOR_ENDPOINT || location.origin;
|
||||
}
|
||||
return userContext.endpoint || userContext?.databaseAccount?.properties?.documentEndpoint;
|
||||
return (
|
||||
userContext.endpoint ||
|
||||
userContext.selectedRegionalEndpoint ||
|
||||
userContext?.databaseAccount?.properties?.documentEndpoint
|
||||
);
|
||||
};
|
||||
|
||||
export async function getTokenFromAuthService(
|
||||
@@ -253,13 +257,15 @@ export function client(): Cosmos.CosmosClient {
|
||||
|
||||
const currentWriteRegion = await client.getWriteEndpoint();
|
||||
console.log(`Current write endpoint: ${JSON.stringify(currentWriteRegion)}`);
|
||||
console.log(`Current userContext endpoint: ${JSON.stringify(userContext?.endpoint)}`);
|
||||
console.log(
|
||||
`Current userContext.selectedRegionalEndpoint: ${JSON.stringify(userContext?.selectedRegionalEndpoint)}`,
|
||||
);
|
||||
}
|
||||
|
||||
const options: Cosmos.CosmosClientOptions = {
|
||||
endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
||||
// endpoint: endpoint() || "https://cosmos.azure.com", // CosmosClient gets upset if we pass a bad URL. This should never actually get called
|
||||
// endpoint: "https://test-craig-nosql-westus3.documents.azure.com:443/",
|
||||
// endpoint: "https://test-craig-nosql-eastus2.documents.azure.com:443/",
|
||||
endpoint: "https://test-craig-nosql-eastus2.documents.azure.com:443/",
|
||||
key: userContext.dataPlaneRbacEnabled ? "" : userContext.masterKey,
|
||||
tokenProvider,
|
||||
userAgentSuffix: "Azure Portal",
|
||||
|
||||
Reference in New Issue
Block a user