Enable the "Enable notebooks" button (#734)
* enable notebooks initial commit * use only first write location * addressed PR comments * Minor edits
This commit is contained in:
parent
b7579d5c8b
commit
1fdb339fbf
|
@ -1643,7 +1643,9 @@ export default class Explorer {
|
|||
}
|
||||
|
||||
const databaseAccount = this.databaseAccount();
|
||||
const databaseAccountLocation = databaseAccount && databaseAccount.location.toLowerCase();
|
||||
const firstWriteLocation =
|
||||
databaseAccount?.properties?.writeLocations &&
|
||||
databaseAccount?.properties?.writeLocations[0]?.locationName.toLowerCase();
|
||||
const disallowedLocationsUri = `${configContext.BACKEND_ENDPOINT}/api/disallowedLocations`;
|
||||
const authorizationHeader = getAuthorizationHeader();
|
||||
try {
|
||||
|
@ -1668,9 +1670,9 @@ export default class Explorer {
|
|||
this.isNotebooksEnabledForAccount(true);
|
||||
return;
|
||||
}
|
||||
const isAccountInAllowedLocation = !disallowedLocations.some(
|
||||
(disallowedLocation) => disallowedLocation === databaseAccountLocation
|
||||
);
|
||||
|
||||
// firstWriteLocation should not be disallowed
|
||||
const isAccountInAllowedLocation = firstWriteLocation && disallowedLocations.indexOf(firstWriteLocation) === -1;
|
||||
this.isNotebooksEnabledForAccount(isAccountInAllowedLocation);
|
||||
} catch (error) {
|
||||
Logger.logError(getErrorMessage(error), "Explorer/isNotebooksEnabledForAccount");
|
||||
|
|
Loading…
Reference in New Issue