2021-03-22 12:04:06 -07:00
|
|
|
export type Features = {
|
|
|
|
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;
|
2021-05-19 18:58:44 -05:00
|
|
|
autoscaleDefault: boolean;
|
2021-07-14 12:10:45 -07:00
|
|
|
partitionKeyDefault: boolean;
|
2021-07-29 06:48:03 -07:00
|
|
|
partitionKeyDefault2: boolean;
|
2021-09-04 02:04:26 -04:00
|
|
|
phoenix: boolean;
|
2021-03-22 12:04:06 -07:00
|
|
|
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-03-22 12:04:06 -07:00
|
|
|
readonly livyEndpoint?: string;
|
|
|
|
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-13 16:25:21 -04:00
|
|
|
readonly mongoProxyEndpoint: string;
|
|
|
|
readonly mongoProxyAPIs: string;
|
2021-08-13 18:33:58 -07:00
|
|
|
readonly notebooksTemporarilyDown: 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();
|
2021-03-30 14:01:30 -07: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-03-22 12:04:06 -07:00
|
|
|
livyEndpoint: get("livyendpoint"),
|
|
|
|
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-08-16 18:57:41 -07:00
|
|
|
notebooksTemporarilyDown: "true" === get("notebookstemporarilydown", "true"),
|
2021-09-04 02:04:26 -04:00
|
|
|
phoenix: "true" === get("phoenix"),
|
2021-03-22 12:04:06 -07:00
|
|
|
};
|
2021-01-19 16:31:55 -06:00
|
|
|
}
|
2021-09-13 16:25:21 -04:00
|
|
|
|
|
|
|
export function hasFlag(flags: string, desiredFlag: string): boolean {
|
|
|
|
if (!flags || !desiredFlag) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const features = flags.split("|");
|
|
|
|
return features.find((feature) => feature === desiredFlag) ? true : false;
|
|
|
|
}
|