2024-06-05 12:16:28 -07:00
|
|
|
import { SplitterDirection } from "Common/Splitter";
|
2021-07-13 09:08:16 +05:30
|
|
|
import * as LocalStorageUtility from "./LocalStorageUtility";
|
|
|
|
import * as SessionStorageUtility from "./SessionStorageUtility";
|
2024-01-30 16:21:29 -05:00
|
|
|
import * as StringUtility from "./StringUtility";
|
2020-05-25 21:30:55 -05:00
|
|
|
|
2021-07-13 09:08:16 +05:30
|
|
|
export { LocalStorageUtility, SessionStorageUtility };
|
2020-05-25 21:30:55 -05:00
|
|
|
export enum StorageKey {
|
|
|
|
ActualItemPerPage,
|
2024-07-01 09:33:07 -07:00
|
|
|
DataPlaneRbacEnabled,
|
2024-01-30 16:21:29 -05:00
|
|
|
RUThresholdEnabled,
|
|
|
|
RUThreshold,
|
2023-10-19 13:21:39 -04:00
|
|
|
QueryTimeoutEnabled,
|
|
|
|
QueryTimeout,
|
2025-01-02 17:22:54 -08:00
|
|
|
SelectedRegion,
|
2024-12-27 17:16:23 -08:00
|
|
|
WriteRegion,
|
2023-12-29 08:12:20 -05:00
|
|
|
RetryAttempts,
|
|
|
|
RetryInterval,
|
|
|
|
MaxWaitTimeInSeconds,
|
2023-10-19 13:21:39 -04:00
|
|
|
AutomaticallyCancelQueryAfterTimeout,
|
2023-03-30 17:53:36 -04:00
|
|
|
ContainerPaginationEnabled,
|
2024-01-09 13:32:20 -06:00
|
|
|
CopilotSampleDBEnabled,
|
2020-05-25 21:30:55 -05:00
|
|
|
CustomItemPerPage,
|
|
|
|
DatabaseAccountId,
|
|
|
|
EncryptedKeyToken,
|
|
|
|
IsCrossPartitionQueryEnabled,
|
|
|
|
MaxDegreeOfParellism,
|
|
|
|
IsGraphAutoVizDisabled,
|
|
|
|
TenantId,
|
2024-09-20 08:26:58 +02:00
|
|
|
MostRecentActivity, // deprecated
|
2020-05-25 21:30:55 -05:00
|
|
|
SetPartitionKeyUndefined,
|
2021-01-20 09:15:01 -06:00
|
|
|
GalleryCalloutDismissed,
|
2022-05-23 20:52:21 -07:00
|
|
|
VisitedAccounts,
|
2023-08-18 15:40:35 +05:30
|
|
|
PriorityLevel,
|
2024-09-11 13:26:49 +02:00
|
|
|
DocumentsTabPrefs,
|
2024-06-05 12:16:28 -07:00
|
|
|
DefaultQueryResultsView,
|
2024-08-22 07:37:15 +02:00
|
|
|
AppState,
|
2020-05-25 21:30:55 -05:00
|
|
|
}
|
2024-01-30 16:21:29 -05:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2024-06-05 12:16:28 -07:00
|
|
|
export const getDefaultQueryResultsView = (): SplitterDirection => {
|
|
|
|
const defaultQueryResultsViewRaw = LocalStorageUtility.getEntryString(StorageKey.DefaultQueryResultsView);
|
2024-08-27 14:20:34 -07:00
|
|
|
if (defaultQueryResultsViewRaw === SplitterDirection.Vertical) {
|
|
|
|
return SplitterDirection.Vertical;
|
2024-06-05 12:16:28 -07:00
|
|
|
}
|
2024-08-27 14:20:34 -07:00
|
|
|
return SplitterDirection.Horizontal;
|
2024-06-05 12:16:28 -07:00
|
|
|
};
|
|
|
|
|
2024-02-02 11:52:37 -05:00
|
|
|
export const DefaultRUThreshold = 5000;
|