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;
|
|
|
|
readonly enableSDKoperations: boolean;
|
|
|
|
readonly enableSpark: boolean;
|
|
|
|
readonly enableTtl: boolean;
|
|
|
|
readonly executeSproc: boolean;
|
|
|
|
readonly hostedDataExplorer: boolean;
|
|
|
|
readonly livyEndpoint?: string;
|
|
|
|
readonly notebookBasePath?: string;
|
|
|
|
readonly notebookServerToken?: string;
|
|
|
|
readonly notebookServerUrl?: string;
|
|
|
|
readonly selfServeType?: string;
|
|
|
|
readonly showMinRUSurvey: boolean;
|
|
|
|
readonly ttl90Days: boolean;
|
|
|
|
};
|
|
|
|
|
2021-03-30 14:01:30 -07:00
|
|
|
export function extractFeatures(given = new URLSearchParams()): 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);
|
|
|
|
const get = (key: string) => downcased.get("feature." + key) ?? undefined;
|
|
|
|
|
|
|
|
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"),
|
|
|
|
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"),
|
|
|
|
executeSproc: "true" === get("dataexplorerexecutesproc"),
|
|
|
|
hostedDataExplorer: "true" === get("hosteddataexplorerenabled"),
|
|
|
|
livyEndpoint: get("livyendpoint"),
|
|
|
|
notebookBasePath: get("notebookbasepath"),
|
|
|
|
notebookServerToken: get("notebookservertoken"),
|
|
|
|
notebookServerUrl: get("notebookserverurl"),
|
|
|
|
selfServeType: get("selfservetype"),
|
|
|
|
showMinRUSurvey: "true" === get("showminrusurvey"),
|
|
|
|
ttl90Days: "true" === get("ttl90days"),
|
|
|
|
};
|
2021-01-19 16:31:55 -06:00
|
|
|
}
|