mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 02:11:29 +00:00
RU Threshold (#1728)
* ru threshold beta * use new ru threshold package * fix typo * fix merge issue * fix package-lock.json * fix test * fixed settings pane test * fixed merge issue * sync with main * fixed settings pane check * fix checks * fixed aria-label error * fixed aria-label error * fixed aria-label error * fixed aria-label error * remove learn more --------- Co-authored-by: Asier Isayas <aisayas@microsoft.com>
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import * as LocalStorageUtility from "./LocalStorageUtility";
|
||||
import * as SessionStorageUtility from "./SessionStorageUtility";
|
||||
import * as StringUtility from "./StringUtility";
|
||||
|
||||
export { LocalStorageUtility, SessionStorageUtility };
|
||||
export enum StorageKey {
|
||||
ActualItemPerPage,
|
||||
RUThresholdEnabled,
|
||||
RUThreshold,
|
||||
QueryTimeoutEnabled,
|
||||
QueryTimeout,
|
||||
RetryAttempts,
|
||||
@@ -25,3 +28,27 @@ export enum StorageKey {
|
||||
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 = 100;
|
||||
|
||||
Reference in New Issue
Block a user