-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to override feature flags with environment variable F…
…EATURE_FLAGS (#1372) * Add env variable FEATURE_FLAGS for overriding flags with env Add feature flags parameter to playwright test fixtures doc:ljs Add env overriding of feature flags in LLM changesets Fix FeatureFlagsButton LLD Fix FeatureFlagsButton remove console log Refactor feature flag settings on LLD Add null to JSONValue type Refactor FeatureFlagsSettings (split in components) Move LLD's FeatureFlagEdit to own component Apply switch toggle directly rather than just modifying the input Remove useless badly typed tryParse * Fix styling of LLD feature flags settings, trim input & hide programatically set flag keys * LLM feature flag settings: trim add flag input & hide programatically set flag keys * Add hint on how to use the "add missing flag name" input * Fix bad "value" prop in inputs
- Loading branch information
1 parent
5909e9d
commit b53d648
Showing
20 changed files
with
1,669 additions
and
560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
Feature flags: take into account env variable FEATURE_FLAGS to override feature flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
Feature flags: take into account env variable FEATURE_FLAGS to override feature flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@ledgerhq/live-common": patch | ||
"@ledgerhq/types-live": patch | ||
--- | ||
|
||
Add FEATURE_FLAGS env variable to override feature flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
248 changes: 0 additions & 248 deletions
248
...dger-live-desktop/src/renderer/screens/settings/sections/Developer/FeatureFlagsButton.tsx
This file was deleted.
Oops, something went wrong.
74 changes: 74 additions & 0 deletions
74
.../renderer/screens/settings/sections/Developer/FeatureFlagsSettings/FeatureFlagDetails.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React, { useCallback } from "react"; | ||
import ButtonV2 from "~/renderer/components/Button"; | ||
import { useFeatureFlags } from "@ledgerhq/live-common/featureFlags/index"; | ||
import { Text, Flex, Tag } from "@ledgerhq/react-ui"; | ||
import { FeatureId } from "@ledgerhq/types-live"; | ||
import { withV2StyleProvider } from "~/renderer/styles/StyleProvider"; | ||
import Box from "~/renderer/components/Box"; | ||
import FeatureFlagEdit from "./FeatureFlagEdit"; | ||
|
||
const OldButton = withV2StyleProvider(ButtonV2); | ||
|
||
type Props = { | ||
flagName: FeatureId; | ||
focused?: boolean; | ||
setFocusedName: (arg0: string | undefined) => void; | ||
}; | ||
|
||
const FeatureFlagDetails: React.FC<Props> = props => { | ||
const { flagName, focused, setFocusedName } = props; | ||
const { getFeature } = useFeatureFlags(); | ||
const flagValue = getFeature(flagName as FeatureId); | ||
|
||
const { | ||
overriddenByEnv, | ||
overridesRemote, | ||
enabledOverriddenForCurrentLanguage, | ||
enabledOverriddenForCurrentDesktopVersion, | ||
} = flagValue || {}; | ||
|
||
const handleClick = useCallback(() => { | ||
focused ? setFocusedName(undefined) : setFocusedName(flagName); | ||
}, [focused, flagName, setFocusedName]); | ||
|
||
if (!flagValue) return null; | ||
|
||
return ( | ||
<> | ||
<OldButton flexDirection="row" py={1} onClick={handleClick}> | ||
<Flex flex={1} mr={3} alignItems="center"> | ||
<Box | ||
bg={flagValue?.enabled ? "success.c100" : "error.c100"} | ||
height={10} | ||
width={10} | ||
mr={2} | ||
borderRadius={999} | ||
/> | ||
<Text mr={1}>{flagName}</Text> | ||
{overriddenByEnv ? ( | ||
<Tag active mx={1} type="opacity" size="small"> | ||
overridden by env | ||
</Tag> | ||
) : overridesRemote ? ( | ||
<Tag active mx={1} type="opacity" size="small"> | ||
overridden locally | ||
</Tag> | ||
) : null} | ||
{enabledOverriddenForCurrentLanguage ? ( | ||
<Tag active mx={1} type="outlinedOpacity" size="small"> | ||
disabled for current language | ||
</Tag> | ||
) : null} | ||
{enabledOverriddenForCurrentDesktopVersion ? ( | ||
<Tag active mx={1} type="outlinedOpacity" size="small"> | ||
disabled for current version | ||
</Tag> | ||
) : null} | ||
</Flex> | ||
</OldButton> | ||
{focused ? <FeatureFlagEdit flagName={flagName} flagValue={flagValue} /> : null} | ||
</> | ||
); | ||
}; | ||
|
||
export default FeatureFlagDetails; |
Oops, something went wrong.
b53d648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 16min 40s ✅ 2 txs ❌ 6 txs ($78.47) for [Bot] Ethereum on Staging
❌ 6 mutation errors
Details of the 8 mutations
Spec BSC (10)
Spec Polygon (10)
Spec Ethereum (failed)
Spec Ethereum Classic (6)
Spec Ethereum Goerli (10)
Details of the 8 uncovered mutations
Spec BSC (1)
Spec Polygon (1)
Spec Ethereum (6)
Portfolio ($78.47) – Details of the 5 currencies
Performance ⏲ 16min 40s
Time spent for each spec: (total across mutations)
b53d648
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⏲ 5min 37s ✅ 34 txs ❌ 3 txs ($103.62) for [Bot] Bitcoin on Staging
❌ 3 mutation errors
Details of the 37 mutations
Spec Bitcoin (5)
Spec Bitcoin Testnet (10)
Spec Bitcoin Cash (7)
Spec Bitcoin Gold (6)
Spec Dash (7)
Spec Digibyte (8)
Spec DogeCoin (7)
Spec Komodo (5)
Spec Litecoin (7)
Spec Peercoin (5)
Spec PivX (5)
Spec Qtum (6)
Spec Vertcoin (7)
Spec Viacoin (5)
Spec ZCash (5)
Spec Horizen (5)
Spec Decred (failed)
Details of the 31 uncovered mutations
Spec Bitcoin (4)
Spec Bitcoin Testnet (4)
Spec Bitcoin Cash (1)
Spec Bitcoin Gold (1)
Spec Dash (1)
Spec Komodo (1)
Spec Litecoin (1)
Spec Peercoin (1)
Spec PivX (2)
Spec Qtum (2)
Spec Viacoin (2)
Spec ZCash (4)
Spec Horizen (3)
Spec Decred (4)
Portfolio ($103.62) – Details of the 17 currencies
Performance ⏲ 5min 37s
Time spent for each spec: (total across mutations)