mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-01-19 07:20:21 +00:00
Add logic to reset regional endpoint when global is selected.
This commit is contained in:
parent
dbfbceb03e
commit
29e5f16065
@ -120,8 +120,8 @@ export const endpoint = () => {
|
|||||||
return configContext.EMULATOR_ENDPOINT || location.origin;
|
return configContext.EMULATOR_ENDPOINT || location.origin;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
userContext.endpoint ||
|
|
||||||
userContext.selectedRegionalEndpoint ||
|
userContext.selectedRegionalEndpoint ||
|
||||||
|
userContext.endpoint ||
|
||||||
userContext?.databaseAccount?.properties?.documentEndpoint
|
userContext?.databaseAccount?.properties?.documentEndpoint
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -308,11 +308,21 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Check if region selection has been updated. Update database account in user context accordingly.
|
// TODO: Check if region selection has been updated. Update database account in user context accordingly.
|
||||||
updateUserContext({
|
// If global is selected, then remove the region selection from local storage.
|
||||||
selectedRegionalEndpoint: regionOptions.find((option) => option.key === selectedRegion)?.data?.endpoint,
|
if (selectedRegion !== LocalStorageUtility.getEntryString(StorageKey.SelectedRegion)) {
|
||||||
refreshCosmosClient: true,
|
LocalStorageUtility.setEntryString(StorageKey.SelectedRegion, selectedRegion);
|
||||||
});
|
let selectedRegionalEndpoint: string | undefined;
|
||||||
// TODO: If Global selected, then clear out region selection, but keep change variable enabled.
|
if (selectedRegion === Constants.RegionSelectionOptions.Global) {
|
||||||
|
selectedRegionalEndpoint = undefined;
|
||||||
|
} else {
|
||||||
|
selectedRegionalEndpoint = regionOptions.find((option) => option.key === selectedRegion)?.data?.endpoint;
|
||||||
|
}
|
||||||
|
updateUserContext({
|
||||||
|
selectedRegionalEndpoint: selectedRegionalEndpoint,
|
||||||
|
refreshCosmosClient: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
console.log(
|
console.log(
|
||||||
`userContext?.databaseAccount?.properties?.documentEndpoint details: ${JSON.stringify(
|
`userContext?.databaseAccount?.properties?.documentEndpoint details: ${JSON.stringify(
|
||||||
userContext?.databaseAccount?.properties?.documentEndpoint,
|
userContext?.databaseAccount?.properties?.documentEndpoint,
|
||||||
@ -321,7 +331,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
|
|
||||||
LocalStorageUtility.setEntryBoolean(StorageKey.RUThresholdEnabled, ruThresholdEnabled);
|
LocalStorageUtility.setEntryBoolean(StorageKey.RUThresholdEnabled, ruThresholdEnabled);
|
||||||
LocalStorageUtility.setEntryBoolean(StorageKey.QueryTimeoutEnabled, queryTimeoutEnabled);
|
LocalStorageUtility.setEntryBoolean(StorageKey.QueryTimeoutEnabled, queryTimeoutEnabled);
|
||||||
LocalStorageUtility.setEntryString(StorageKey.SelectedRegion, selectedRegion);
|
|
||||||
LocalStorageUtility.setEntryNumber(StorageKey.RetryAttempts, retryAttempts);
|
LocalStorageUtility.setEntryNumber(StorageKey.RetryAttempts, retryAttempts);
|
||||||
LocalStorageUtility.setEntryNumber(StorageKey.RetryInterval, retryInterval);
|
LocalStorageUtility.setEntryNumber(StorageKey.RetryInterval, retryInterval);
|
||||||
LocalStorageUtility.setEntryNumber(StorageKey.MaxWaitTimeInSeconds, MaxWaitTimeInSeconds);
|
LocalStorageUtility.setEntryNumber(StorageKey.MaxWaitTimeInSeconds, MaxWaitTimeInSeconds);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user