2021-03-22 12:04:06 -07:00
|
|
|
export type Features = {
|
2022-02-25 18:21:58 -08:00
|
|
|
// set only via feature flags
|
2021-03-22 12:04:06 -07:00
|
|
|
readonly canExceedMaximumValue: boolean;
|
|
|
|
readonly cosmosdb: boolean;
|
|
|
|
readonly enableChangeFeedPolicy: boolean;
|
|
|
|
readonly enableFixedCollectionWithSharedThroughput: boolean;
|
|
|
|
readonly enableKOPanel: boolean;
|
|
|
|
readonly enableNotebooks: boolean;
|
|
|
|
readonly enableReactPane: boolean;
|
|
|
|
readonly enableRightPanelV2: boolean;
|
|
|
|
readonly enableSchema: boolean;
|
|
|
|
readonly enableSDKoperations: boolean;
|
|
|
|
readonly enableSpark: boolean;
|
|
|
|
readonly enableTtl: boolean;
|
|
|
|
readonly executeSproc: boolean;
|
2021-05-18 18:59:09 -04:00
|
|
|
readonly enableAadDataPlane: boolean;
|
2021-07-30 16:23:36 -07:00
|
|
|
readonly enableKoResourceTree: boolean;
|
2021-03-22 12:04:06 -07:00
|
|
|
readonly hostedDataExplorer: boolean;
|
2021-04-19 17:38:53 -07:00
|
|
|
readonly junoEndpoint?: string;
|
2021-09-30 12:53:33 -04:00
|
|
|
readonly phoenixEndpoint?: string;
|
2021-03-22 12:04:06 -07:00
|
|
|
readonly notebookBasePath?: string;
|
|
|
|
readonly notebookServerToken?: string;
|
|
|
|
readonly notebookServerUrl?: string;
|
2021-04-12 08:59:18 -07:00
|
|
|
readonly sandboxNotebookOutputs: boolean;
|
2021-03-22 12:04:06 -07:00
|
|
|
readonly selfServeType?: string;
|
2021-04-12 13:10:31 -07:00
|
|
|
readonly pr?: string;
|
2021-03-22 12:04:06 -07:00
|
|
|
readonly showMinRUSurvey: boolean;
|
|
|
|
readonly ttl90Days: boolean;
|
2021-09-14 12:28:33 -04:00
|
|
|
readonly mongoProxyEndpoint?: string;
|
|
|
|
readonly mongoProxyAPIs?: string;
|
2021-10-30 19:45:16 -07:00
|
|
|
readonly enableThroughputCap: boolean;
|
2023-01-23 09:09:29 -06:00
|
|
|
readonly enableHierarchicalKeys: boolean;
|
2023-04-04 10:28:42 -07:00
|
|
|
readonly enableLegacyMongoShellV1: boolean;
|
2023-04-06 10:13:05 -07:00
|
|
|
readonly enableLegacyMongoShellV1Debug: boolean;
|
2023-04-04 10:28:42 -07:00
|
|
|
readonly enableLegacyMongoShellV2: boolean;
|
2023-04-06 10:13:05 -07:00
|
|
|
readonly enableLegacyMongoShellV2Debug: boolean;
|
|
|
|
readonly loadLegacyMongoShellFromBE: boolean;
|
2023-06-06 11:43:53 -07:00
|
|
|
readonly enableCopilot: boolean;
|
2023-08-15 10:01:07 +02:00
|
|
|
readonly copilotVersion?: string;
|
2023-09-01 02:01:11 +02:00
|
|
|
readonly disableCopilotPhoenixGateaway: boolean;
|
2023-08-21 16:16:32 +02:00
|
|
|
readonly enableCopilotFullSchema: boolean;
|
2023-09-18 11:30:17 +02:00
|
|
|
readonly copilotChatFixedMonacoEditorHeight: boolean;
|
2023-10-05 02:48:54 +05:30
|
|
|
readonly enablePriorityBasedExecution: boolean;
|
2022-02-25 18:21:58 -08:00
|
|
|
|
|
|
|
// can be set via both flight and feature flag
|
|
|
|
autoscaleDefault: boolean;
|
|
|
|
partitionKeyDefault: boolean;
|
|
|
|
partitionKeyDefault2: boolean;
|
2022-03-01 13:38:30 -05:00
|
|
|
phoenixNotebooks?: boolean;
|
|
|
|
phoenixFeatures?: boolean;
|
2022-02-25 18:21:58 -08:00
|
|
|
notebooksDownBanner: boolean;
|
2022-05-04 03:50:44 +05:30
|
|
|
publicGallery?: boolean;
|
2021-03-22 12:04:06 -07:00
|
|
|
};
|
|
|
|
|
2021-04-12 15:07:37 -07:00
|
|
|
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
|
2021-03-22 12:04:06 -07:00
|
|
|
const downcased = new URLSearchParams();
|
2022-02-25 18:21:58 -08:00
|
|
|
const set = (value: string, key: string) => {
|
|
|
|
downcased.set(key.toLowerCase(), value);
|
|
|
|
};
|
2021-04-19 17:38:53 -07:00
|
|
|
const get = (key: string, defaultValue?: string) =>
|
|
|
|
downcased.get("feature." + key) ?? downcased.get(key) ?? defaultValue;
|
2021-03-30 14:01:30 -07:00
|
|
|
|
|
|
|
try {
|
|
|
|
new URLSearchParams(window.parent.location.search).forEach(set);
|
|
|
|
} catch {
|
|
|
|
//
|
|
|
|
} finally {
|
|
|
|
given.forEach(set);
|
|
|
|
}
|
2021-03-22 12:04:06 -07:00
|
|
|
|
|
|
|
return {
|
|
|
|
canExceedMaximumValue: "true" === get("canexceedmaximumvalue"),
|
|
|
|
cosmosdb: "true" === get("cosmosdb"),
|
2021-05-18 18:59:09 -04:00
|
|
|
enableAadDataPlane: "true" === get("enableaaddataplane"),
|
2021-03-22 12:04:06 -07:00
|
|
|
enableChangeFeedPolicy: "true" === get("enablechangefeedpolicy"),
|
|
|
|
enableFixedCollectionWithSharedThroughput: "true" === get("enablefixedcollectionwithsharedthroughput"),
|
|
|
|
enableKOPanel: "true" === get("enablekopanel"),
|
|
|
|
enableNotebooks: "true" === get("enablenotebooks"),
|
|
|
|
enableReactPane: "true" === get("enablereactpane"),
|
|
|
|
enableRightPanelV2: "true" === get("enablerightpanelv2"),
|
|
|
|
enableSchema: "true" === get("enableschema"),
|
|
|
|
enableSDKoperations: "true" === get("enablesdkoperations"),
|
|
|
|
enableSpark: "true" === get("enablespark"),
|
|
|
|
enableTtl: "true" === get("enablettl"),
|
2021-07-30 16:23:36 -07:00
|
|
|
enableKoResourceTree: "true" === get("enablekoresourcetree"),
|
2021-03-22 12:04:06 -07:00
|
|
|
executeSproc: "true" === get("dataexplorerexecutesproc"),
|
|
|
|
hostedDataExplorer: "true" === get("hosteddataexplorerenabled"),
|
2021-09-13 16:25:21 -04:00
|
|
|
mongoProxyEndpoint: get("mongoproxyendpoint"),
|
|
|
|
mongoProxyAPIs: get("mongoproxyapis"),
|
2021-04-19 17:38:53 -07:00
|
|
|
junoEndpoint: get("junoendpoint"),
|
2021-09-30 12:53:33 -04:00
|
|
|
phoenixEndpoint: get("phoenixendpoint"),
|
2021-03-22 12:04:06 -07:00
|
|
|
notebookBasePath: get("notebookbasepath"),
|
|
|
|
notebookServerToken: get("notebookservertoken"),
|
|
|
|
notebookServerUrl: get("notebookserverurl"),
|
2021-04-14 11:06:44 -07:00
|
|
|
sandboxNotebookOutputs: "true" === get("sandboxnotebookoutputs", "true"),
|
2021-03-22 12:04:06 -07:00
|
|
|
selfServeType: get("selfservetype"),
|
2021-04-12 13:10:31 -07:00
|
|
|
pr: get("pr"),
|
2021-03-22 12:04:06 -07:00
|
|
|
showMinRUSurvey: "true" === get("showminrusurvey"),
|
|
|
|
ttl90Days: "true" === get("ttl90days"),
|
2021-05-19 18:58:44 -05:00
|
|
|
autoscaleDefault: "true" === get("autoscaledefault"),
|
2021-07-14 12:10:45 -07:00
|
|
|
partitionKeyDefault: "true" === get("partitionkeytest"),
|
2021-07-29 06:48:03 -07:00
|
|
|
partitionKeyDefault2: "true" === get("pkpartitionkeytest"),
|
2021-10-22 00:57:52 -07:00
|
|
|
notebooksDownBanner: "true" === get("notebooksDownBanner"),
|
2021-10-30 19:45:16 -07:00
|
|
|
enableThroughputCap: "true" === get("enablethroughputcap"),
|
2023-01-23 09:09:29 -06:00
|
|
|
enableHierarchicalKeys: "true" === get("enablehierarchicalkeys"),
|
2023-04-04 10:28:42 -07:00
|
|
|
enableLegacyMongoShellV1: "true" === get("enablelegacymongoshellv1"),
|
2023-04-06 10:13:05 -07:00
|
|
|
enableLegacyMongoShellV1Debug: "true" === get("enablelegacymongoshellv1debug"),
|
2023-04-04 10:28:42 -07:00
|
|
|
enableLegacyMongoShellV2: "true" === get("enablelegacymongoshellv2"),
|
2023-04-06 10:13:05 -07:00
|
|
|
enableLegacyMongoShellV2Debug: "true" === get("enablelegacymongoshellv2debug"),
|
|
|
|
loadLegacyMongoShellFromBE: "true" === get("loadlegacymongoshellfrombe"),
|
2023-09-12 15:40:26 -07:00
|
|
|
enableCopilot: "true" === get("enablecopilot", "true"),
|
2023-08-21 16:29:00 +02:00
|
|
|
copilotVersion: get("copilotversion") ?? "v1.0",
|
2023-09-01 02:01:11 +02:00
|
|
|
disableCopilotPhoenixGateaway: "true" === get("disablecopilotphoenixgateaway"),
|
2023-09-12 15:40:26 -07:00
|
|
|
enableCopilotFullSchema: "true" === get("enablecopilotfullschema", "true"),
|
2023-09-18 11:30:17 +02:00
|
|
|
copilotChatFixedMonacoEditorHeight: "true" === get("copilotchatfixedmonacoeditorheight"),
|
2023-10-05 02:48:54 +05:30
|
|
|
enablePriorityBasedExecution: "true" === get("enableprioritybasedexecution"),
|
2021-03-22 12:04:06 -07:00
|
|
|
};
|
2021-01-19 16:31:55 -06:00
|
|
|
}
|
2021-09-13 16:25:21 -04:00
|
|
|
|
2021-09-21 21:28:03 +05:30
|
|
|
export function hasFlag(flags: string | undefined, desiredFlag: string | undefined): boolean {
|
2021-09-13 16:25:21 -04:00
|
|
|
if (!flags || !desiredFlag) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const features = flags.split("|");
|
|
|
|
return features.find((feature) => feature === desiredFlag) ? true : false;
|
|
|
|
}
|