mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-31 15:09:29 +01:00
Defensively set feature flags from window.parent (#594)
This doesn't really fix the fact that portal feature flags are not being set, but it does re-enable feature flags in hosted mode.
This commit is contained in:
parent
a9ed187213
commit
813dbfee5b
@ -23,11 +23,18 @@ export type Features = {
|
|||||||
readonly ttl90Days: boolean;
|
readonly ttl90Days: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function extractFeatures(params?: URLSearchParams): Features {
|
export function extractFeatures(given = new URLSearchParams()): Features {
|
||||||
params = params || new URLSearchParams(window.location.search);
|
|
||||||
const downcased = new URLSearchParams();
|
const downcased = new URLSearchParams();
|
||||||
params.forEach((value, key) => downcased.append(key.toLocaleLowerCase(), value));
|
const set = (value: string, key: string) => downcased.set(key.toLowerCase(), value);
|
||||||
const get = (key: string) => downcased.get("feature." + key.toLocaleLowerCase()) ?? undefined;
|
const get = (key: string) => downcased.get("feature." + key) ?? undefined;
|
||||||
|
|
||||||
|
try {
|
||||||
|
new URLSearchParams(window.parent.location.search).forEach(set);
|
||||||
|
} catch {
|
||||||
|
//
|
||||||
|
} finally {
|
||||||
|
given.forEach(set);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
canExceedMaximumValue: "true" === get("canexceedmaximumvalue"),
|
canExceedMaximumValue: "true" === get("canexceedmaximumvalue"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user