From c4b8b48f87f8c5f8d5de606ec82c3125bb24c129 Mon Sep 17 00:00:00 2001 From: Matthias Wehnert Date: Thu, 11 Apr 2024 16:03:55 +0200 Subject: [PATCH 1/2] fix: add required remoteConfig prop to abbyMock for Storybook --- packages/devtools/src/Devtools.stories.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/devtools/src/Devtools.stories.ts b/packages/devtools/src/Devtools.stories.ts index 0261bb2d..f5be31b5 100644 --- a/packages/devtools/src/Devtools.stories.ts +++ b/packages/devtools/src/Devtools.stories.ts @@ -12,6 +12,11 @@ const abbyMock = { "flag-1": true, "flag-2": false, }, + remoteConfig: { + "config-1": "string-value", + "config-2": 42, + "config-3": {type: "object/json"} + }, tests: { "test-1": { selectedVariant: "A", variants: ["A", "B"] }, "test-2": { selectedVariant: "B", variants: ["A", "B"] }, From e49032702d359e97c0d1e3525ee183638bed6fa7 Mon Sep 17 00:00:00 2001 From: Matthias Wehnert Date: Thu, 11 Apr 2024 17:20:00 +0200 Subject: [PATCH 2/2] fix: limit height of devtools and enable scrolling --- packages/devtools/src/Devtools.svelte | 124 ++++++++++++++++---------- 1 file changed, 76 insertions(+), 48 deletions(-) diff --git a/packages/devtools/src/Devtools.svelte b/packages/devtools/src/Devtools.svelte index c07f96d7..0e73e4c6 100644 --- a/packages/devtools/src/Devtools.svelte +++ b/packages/devtools/src/Devtools.svelte @@ -93,61 +93,63 @@ >
-

Flags:

- {#each Object.entries(flags) as [flagName, flagValue]} - { - window.postMessage({ type: "abby:update-flag", flagName, newValue }, "*"); - abby.updateFlag(flagName, newValue); - }} - /> - {/each} -
-

Remote Config:

- {#each Object.entries(remoteConfig) as [remoteConfigName, remoteConfigValue]} - {#if typeof remoteConfigValue === "string" || typeof remoteConfigValue === "number"} - +

Flags:

+ {#each Object.entries(flags) as [flagName, flagValue]} + { - window.postMessage({ type: "abby:update-flag", remoteConfigName, newValue }, "*"); - abby.updateRemoteConfig(remoteConfigName, newValue); + window.postMessage({ type: "abby:update-flag", flagName, newValue }, "*"); + abby.updateFlag(flagName, newValue); }} /> - {:else if typeof remoteConfigValue === "object"} -
-

{remoteConfigName}

- +

Remote Config:

+ {#each Object.entries(remoteConfig) as [remoteConfigName, remoteConfigValue]} + {#if typeof remoteConfigValue === "string" || typeof remoteConfigValue === "number"} + { window.postMessage({ type: "abby:update-flag", remoteConfigName, newValue }, "*"); abby.updateRemoteConfig(remoteConfigName, newValue); }} /> -
- {/if} - {/each} -
-

A/B Tests:

- {#each Object.entries(tests) as [testName, { selectedVariant, variants }]} - ({ + label: v, + value: v, + }))} + onChange={(newValue) => { + window.postMessage({ type: "abby:select-variant", testName, newValue }, "*"); + abby.updateLocalVariant(testName, newValue); + }} + /> + {/each} + {:else}