mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-07-01 01:24:35 +01:00
Enable notebooks should use account regions
This commit is contained in:
parent
3530633fa2
commit
b52f425b4c
@ -2006,7 +2006,11 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const databaseAccount = this.databaseAccount();
|
const databaseAccount = this.databaseAccount();
|
||||||
const databaseAccountLocation = databaseAccount && databaseAccount.location.toLowerCase();
|
const databaseAccountLocations = databaseAccount && [
|
||||||
|
databaseAccount?.location.toLowerCase(),
|
||||||
|
...databaseAccount?.properties?.readLocations?.map(location => location?.locationName?.toLowerCase()),
|
||||||
|
...databaseAccount?.properties?.writeLocations?.map(location => location?.locationName?.toLowerCase())
|
||||||
|
];
|
||||||
const disallowedLocationsUri = `${configContext.BACKEND_ENDPOINT}/api/disallowedLocations`;
|
const disallowedLocationsUri = `${configContext.BACKEND_ENDPOINT}/api/disallowedLocations`;
|
||||||
const authorizationHeader = getAuthorizationHeader();
|
const authorizationHeader = getAuthorizationHeader();
|
||||||
try {
|
try {
|
||||||
@ -2031,9 +2035,15 @@ export default class Explorer {
|
|||||||
this.isNotebooksEnabledForAccount(true);
|
this.isNotebooksEnabledForAccount(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const isAccountInAllowedLocation = !disallowedLocations.some(
|
const isAccountInAllowedLocation = databaseAccountLocations?.some(
|
||||||
(disallowedLocation) => disallowedLocation === databaseAccountLocation
|
(accountLocation) => {
|
||||||
);
|
if (!accountLocation) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !disallowedLocations.some(disallowedLocation => disallowedLocation === accountLocation); // not a disallowed location
|
||||||
|
}
|
||||||
|
) || false;
|
||||||
this.isNotebooksEnabledForAccount(isAccountInAllowedLocation);
|
this.isNotebooksEnabledForAccount(isAccountInAllowedLocation);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.logError(getErrorMessage(error), "Explorer/isNotebooksEnabledForAccount");
|
Logger.logError(getErrorMessage(error), "Explorer/isNotebooksEnabledForAccount");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user