mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-13 13:25:31 +00:00
Need to continue with clearing out selected endpoint when global is selected again. Write operations stall when read region is selected even though 403 returned when region rejects operation. Need to limit feature availablility to nosql, table, gremlin (maybe).
70 lines
2.1 KiB
TypeScript
70 lines
2.1 KiB
TypeScript
import { SplitterDirection } from "Common/Splitter";
|
|
import * as LocalStorageUtility from "./LocalStorageUtility";
|
|
import * as SessionStorageUtility from "./SessionStorageUtility";
|
|
import * as StringUtility from "./StringUtility";
|
|
|
|
export { LocalStorageUtility, SessionStorageUtility };
|
|
export enum StorageKey {
|
|
ActualItemPerPage,
|
|
DataPlaneRbacEnabled,
|
|
RUThresholdEnabled,
|
|
RUThreshold,
|
|
QueryTimeoutEnabled,
|
|
QueryTimeout,
|
|
SelectedRegion,
|
|
WriteRegion,
|
|
RetryAttempts,
|
|
RetryInterval,
|
|
MaxWaitTimeInSeconds,
|
|
AutomaticallyCancelQueryAfterTimeout,
|
|
ContainerPaginationEnabled,
|
|
CopilotSampleDBEnabled,
|
|
CustomItemPerPage,
|
|
DatabaseAccountId,
|
|
EncryptedKeyToken,
|
|
IsCrossPartitionQueryEnabled,
|
|
MaxDegreeOfParellism,
|
|
IsGraphAutoVizDisabled,
|
|
TenantId,
|
|
MostRecentActivity, // deprecated
|
|
SetPartitionKeyUndefined,
|
|
GalleryCalloutDismissed,
|
|
VisitedAccounts,
|
|
PriorityLevel,
|
|
DocumentsTabPrefs,
|
|
DefaultQueryResultsView,
|
|
AppState,
|
|
}
|
|
|
|
export const hasRUThresholdBeenConfigured = (): boolean => {
|
|
const ruThresholdEnabledLocalStorageRaw: string | null = LocalStorageUtility.getEntryString(
|
|
StorageKey.RUThresholdEnabled,
|
|
);
|
|
return ruThresholdEnabledLocalStorageRaw === "true" || ruThresholdEnabledLocalStorageRaw === "false";
|
|
};
|
|
|
|
export const ruThresholdEnabled = (): boolean => {
|
|
const ruThresholdEnabledLocalStorageRaw: string | null = LocalStorageUtility.getEntryString(
|
|
StorageKey.RUThresholdEnabled,
|
|
);
|
|
return ruThresholdEnabledLocalStorageRaw === null || StringUtility.toBoolean(ruThresholdEnabledLocalStorageRaw);
|
|
};
|
|
|
|
export const getRUThreshold = (): number => {
|
|
const ruThresholdRaw = LocalStorageUtility.getEntryNumber(StorageKey.RUThreshold);
|
|
if (ruThresholdRaw !== 0) {
|
|
return ruThresholdRaw;
|
|
}
|
|
return DefaultRUThreshold;
|
|
};
|
|
|
|
export const getDefaultQueryResultsView = (): SplitterDirection => {
|
|
const defaultQueryResultsViewRaw = LocalStorageUtility.getEntryString(StorageKey.DefaultQueryResultsView);
|
|
if (defaultQueryResultsViewRaw === SplitterDirection.Vertical) {
|
|
return SplitterDirection.Vertical;
|
|
}
|
|
return SplitterDirection.Horizontal;
|
|
};
|
|
|
|
export const DefaultRUThreshold = 5000;
|