mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-10-13 15:28:05 +01:00
58 lines
1.7 KiB
TypeScript
58 lines
1.7 KiB
TypeScript
import * as LocalStorageUtility from "./LocalStorageUtility";
|
|
import * as SessionStorageUtility from "./SessionStorageUtility";
|
|
import * as StringUtility from "./StringUtility";
|
|
|
|
export { LocalStorageUtility, SessionStorageUtility };
|
|
export enum StorageKey {
|
|
ActualItemPerPage,
|
|
DataPlaneRbacEnabled,
|
|
DataPlaneRbacDisabled,
|
|
isDataPlaneRbacAutomatic,
|
|
RUThresholdEnabled,
|
|
RUThreshold,
|
|
QueryTimeoutEnabled,
|
|
QueryTimeout,
|
|
RetryAttempts,
|
|
RetryInterval,
|
|
MaxWaitTimeInSeconds,
|
|
AutomaticallyCancelQueryAfterTimeout,
|
|
ContainerPaginationEnabled,
|
|
CopilotSampleDBEnabled,
|
|
CustomItemPerPage,
|
|
DatabaseAccountId,
|
|
EncryptedKeyToken,
|
|
IsCrossPartitionQueryEnabled,
|
|
MaxDegreeOfParellism,
|
|
IsGraphAutoVizDisabled,
|
|
TenantId,
|
|
MostRecentActivity,
|
|
SetPartitionKeyUndefined,
|
|
GalleryCalloutDismissed,
|
|
VisitedAccounts,
|
|
PriorityLevel,
|
|
}
|
|
|
|
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 DefaultRUThreshold = 5000;
|