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)
|
? LocalStorageUtility.getEntryString(StorageKey.ReadRegion)
|
||||||
: userContext?.databaseAccount?.properties?.readLocations?.[0]?.locationName,
|
: 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>(
|
const [retryAttempts, setRetryAttempts] = useState<number>(
|
||||||
LocalStorageUtility.hasItem(StorageKey.RetryAttempts)
|
LocalStorageUtility.hasItem(StorageKey.RetryAttempts)
|
||||||
? LocalStorageUtility.getEntryNumber(StorageKey.RetryAttempts)
|
? LocalStorageUtility.getEntryNumber(StorageKey.RetryAttempts)
|
||||||
@ -197,10 +192,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
key: location.locationName,
|
key: location.locationName,
|
||||||
text: location.locationName,
|
text: location.locationName,
|
||||||
}));
|
}));
|
||||||
const writeRegionOptions = userContext?.databaseAccount?.properties?.writeLocations?.map((location) => ({
|
|
||||||
key: location.locationName,
|
|
||||||
text: location.locationName,
|
|
||||||
}));
|
|
||||||
const shouldShowCopilotSampleDBOption =
|
const shouldShowCopilotSampleDBOption =
|
||||||
userContext.apiType === "SQL" &&
|
userContext.apiType === "SQL" &&
|
||||||
useQueryCopilot.getState().copilotEnabled &&
|
useQueryCopilot.getState().copilotEnabled &&
|
||||||
@ -289,7 +280,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.ReadRegion, readRegion);
|
LocalStorageUtility.setEntryString(StorageKey.ReadRegion, readRegion);
|
||||||
LocalStorageUtility.setEntryString(StorageKey.WriteRegion, writeRegion);
|
|
||||||
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);
|
||||||
@ -442,11 +432,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
setReadRegion(option.text);
|
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 handleOnQueryRetryAttemptsSpinButtonChange = (ev: React.MouseEvent<HTMLElement>, newValue?: string): void => {
|
||||||
const retryAttempts = Number(newValue);
|
const retryAttempts = Number(newValue);
|
||||||
if (!isNaN(retryAttempts)) {
|
if (!isNaN(retryAttempts)) {
|
||||||
@ -711,12 +696,12 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
<AccordionPanel>
|
<AccordionPanel>
|
||||||
<div className={styles.settingsSectionContainer}>
|
<div className={styles.settingsSectionContainer}>
|
||||||
<div className={styles.settingsSectionDescription}>
|
<div className={styles.settingsSectionDescription}>
|
||||||
Select region for read and write operations.
|
Changes region the Cosmos Client uses to access account.
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span className={styles.subHeader}>Read Region</span>
|
<span className={styles.subHeader}>Select Region</span>
|
||||||
<InfoTooltip className={styles.headerIcon}>
|
<InfoTooltip className={styles.headerIcon}>
|
||||||
Changes the account endpoint used to perform read operations.
|
Changes the account endpoint used to perform client operations.
|
||||||
</InfoTooltip>
|
</InfoTooltip>
|
||||||
</div>
|
</div>
|
||||||
<Dropdown
|
<Dropdown
|
||||||
@ -725,17 +710,6 @@ export const SettingsPane: FunctionComponent<{ explorer: Explorer }> = ({
|
|||||||
options={readRegionOptions}
|
options={readRegionOptions}
|
||||||
styles={{ root: { marginBottom: "10px" } }}
|
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>
|
</div>
|
||||||
</AccordionPanel>
|
</AccordionPanel>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user