mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-06 18:07:11 +00:00
Change to only selecting region for cosmos client. Not setting up separate read and write clients.
This commit is contained in:
parent
17b0c59f5b
commit
bc92cb91eb
@ -150,11 +150,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
? LocalStorageUtility.getEntryString(StorageKey.ReadRegion)
|
||||
: userContext?.databaseAccount?.properties?.readLocations?.[0]?.locationName,
|
||||
);
|
||||
const [writeRegion, setWriteRegion] = useState<string>(
|
||||
LocalStorageUtility.hasItem(StorageKey.WriteRegion)
|
||||
? LocalStorageUtility.getEntryString(StorageKey.WriteRegion)
|
||||
: userContext?.databaseAccount?.properties?.writeLocations?.[0]?.locationName,
|
||||
);
|
||||
const [retryAttempts, setRetryAttempts] = useState<number>(
|
||||
LocalStorageUtility.hasItem(StorageKey.RetryAttempts)
|
||||
? LocalStorageUtility.getEntryNumber(StorageKey.RetryAttempts)
|
||||
@ -197,10 +192,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
key: location.locationName,
|
||||
text: location.locationName,
|
||||
}));
|
||||
const writeRegionOptions = userContext?.databaseAccount?.properties?.writeLocations?.map((location) => ({
|
||||
key: location.locationName,
|
||||
text: location.locationName,
|
||||
}));
|
||||
const shouldShowCopilotSampleDBOption =
|
||||
userContext.apiType === "SQL" &&
|
||||
useQueryCopilot.getState().copilotEnabled &&
|
||||
@ -289,7 +280,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
LocalStorageUtility.setEntryBoolean(StorageKey.RUThresholdEnabled, ruThresholdEnabled);
|
||||
LocalStorageUtility.setEntryBoolean(StorageKey.QueryTimeoutEnabled, queryTimeoutEnabled);
|
||||
LocalStorageUtility.setEntryString(StorageKey.ReadRegion, readRegion);
|
||||
LocalStorageUtility.setEntryString(StorageKey.WriteRegion, writeRegion);
|
||||
LocalStorageUtility.setEntryNumber(StorageKey.RetryAttempts, retryAttempts);
|
||||
LocalStorageUtility.setEntryNumber(StorageKey.RetryInterval, retryInterval);
|
||||
LocalStorageUtility.setEntryNumber(StorageKey.MaxWaitTimeInSeconds, MaxWaitTimeInSeconds);
|
||||
@ -442,11 +432,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
setReadRegion(option.text);
|
||||
};
|
||||
|
||||
const handleOnWriteRegionOptionChange = (ev: React.FormEvent<HTMLInputElement>, option: IDropdownOption): void => {
|
||||
// TODO: Region Validation?
|
||||
setWriteRegion(option.text);
|
||||
};
|
||||
|
||||
const handleOnQueryRetryAttemptsSpinButtonChange = (ev: React.MouseEvent<HTMLElement>, newValue?: string): void => {
|
||||
const retryAttempts = Number(newValue);
|
||||
if (!isNaN(retryAttempts)) {
|
||||
@ -711,12 +696,12 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
<AccordionPanel>
|
||||
<div className={styles.settingsSectionContainer}>
|
||||
<div className={styles.settingsSectionDescription}>
|
||||
Select region for read and write operations.
|
||||
Changes region the Cosmos Client uses to access account.
|
||||
</div>
|
||||
<div>
|
||||
<span className={styles.subHeader}>Read Region</span>
|
||||
<span className={styles.subHeader}>Select Region</span>
|
||||
<InfoTooltip className={styles.headerIcon}>
|
||||
Changes the account endpoint used to perform read operations.
|
||||
Changes the account endpoint used to perform client operations.
|
||||
</InfoTooltip>
|
||||
</div>
|
||||
<Dropdown
|
||||
@ -725,17 +710,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
||||
options={readRegionOptions}
|
||||
styles={{ root: { marginBottom: "10px" } }}
|
||||
/>
|
||||
<div>
|
||||
<span className={styles.subHeader}>Write Region</span>
|
||||
<InfoTooltip className={styles.headerIcon}>
|
||||
Changes the account endpoint used to perform write operations.
|
||||
</InfoTooltip>
|
||||
</div>
|
||||
<Dropdown
|
||||
placeholder={writeRegion}
|
||||
onChange={handleOnWriteRegionOptionChange}
|
||||
options={writeRegionOptions}
|
||||
/>
|
||||
</div>
|
||||
</AccordionPanel>
|
||||
</AccordionItem>
|
||||
|
Loading…
x
Reference in New Issue
Block a user