mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-05-15 01:37:37 +01:00
fb250259ed
* perf: remove deprecated copilot feature, add ARM timeouts, fix race conditions - Remove entire QueryCopilot feature (~50 files deleted, ~30 files cleaned) - Remove CopilotConfigured and SampleDataLoaded metric phases - Fix DatabaseTreeRendered 76% stuck rate (remove one-shot guard in useMetricPhases) - Add 8s default timeout to ARM requests (AbortController-based) - Fix MSAL token forceRefresh (true -> false, use cache) - Add concurrency limit of 5 to collection loading in Explorer - Remove orphaned SampleDataClient.ts and queryCopilotSampleData.json - Clean up dead sampleDataConnectionInfo field from UserContext * Clean up copilot and optimize initialization * Clean up copilot and optimize initialization
82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import { MongoGuidRepresentation } from "Common/Constants";
|
|
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,
|
|
RetryAttempts,
|
|
RetryInterval,
|
|
MaxWaitTimeInSeconds,
|
|
AutomaticallyCancelQueryAfterTimeout,
|
|
ContainerPaginationEnabled,
|
|
CustomItemPerPage,
|
|
DatabaseAccountId,
|
|
EncryptedKeyToken,
|
|
IsCrossPartitionQueryEnabled,
|
|
QueryControlEnabled,
|
|
MaxDegreeOfParellism,
|
|
IsGraphAutoVizDisabled,
|
|
TenantId,
|
|
MostRecentActivity, // deprecated
|
|
SetPartitionKeyUndefined,
|
|
GalleryCalloutDismissed,
|
|
VisitedAccounts,
|
|
PriorityLevel,
|
|
DocumentsTabPrefs,
|
|
DefaultQueryResultsView,
|
|
AppState,
|
|
MongoGuidRepresentation,
|
|
IgnorePartitionKeyOnDocumentUpdate,
|
|
PinnedDatabases,
|
|
DatabaseSortOrder,
|
|
}
|
|
|
|
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 getMongoGuidRepresentation = (): MongoGuidRepresentation => {
|
|
const mongoGuidRepresentation: string | null = LocalStorageUtility.getEntryString(StorageKey.MongoGuidRepresentation);
|
|
if (mongoGuidRepresentation) {
|
|
return mongoGuidRepresentation as MongoGuidRepresentation;
|
|
}
|
|
|
|
return MongoGuidRepresentation.CSharpLegacy;
|
|
};
|
|
|
|
export const DefaultRUThreshold = 5000;
|