-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(flags): Add FeatureFlagStatusIndicator to detail view for flags #26412
Merged
Merged
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
c9c0e69
(WIP) feat(flags): add GET feature_flags/:id/status for getting stale…
havenbarnes 8cabf20
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 6393b43
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes ebb3d79
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes d5d7fe5
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 54315d7
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes e831e92
finished + tested
havenbarnes c9de2fd
cleanup
havenbarnes f7bacde
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 865673c
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 91cb491
Fix linter
havenbarnes 6724a4e
cleanup
havenbarnes 4969eb9
tweak
havenbarnes 25e2abf
Merge branch 'master' into detect-stale-flags
havenbarnes 5f73662
Merge branch 'master' into detect-stale-flags
havenbarnes 5554015
Merge branch 'master' into detect-stale-flags
havenbarnes c9340ba
Merge branch 'master' into detect-stale-flags
havenbarnes 20b15ad
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes cfd96e8
adjust a little after chatting with Dylan
havenbarnes 799cba3
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 548d1ce
feat(flags): Add FeatureFlagStatusBanner to detail view for flags
havenbarnes be3c96f
tweak
havenbarnes 836185c
Merge branch 'master' into detect-stale-flags
havenbarnes 6f5cfb3
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes acbe9a5
tweak
havenbarnes d32b0b0
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 4873a02
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 5c618dc
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes c9418aa
Update posthog/models/feature_flag/flag_status.py
havenbarnes 3dccf1d
Update posthog/models/feature_flag/flag_status.py
havenbarnes fda646e
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes 9062d8c
Merge branch 'master' into detect-stale-flags
dmarticus 51bc657
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 76360f9
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes f785cb7
tweak select clause
havenbarnes 1c7f2bb
fix copy
havenbarnes 864dd33
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 2aa65be
update tests
havenbarnes 23320f0
Update query snapshots
github-actions[bot] 3b6a43a
Merge branch 'master' into detect-stale-flags
havenbarnes 2e5f51d
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes e5a35bf
Merge branch 'stale-flag-ui' of https://github.com/PostHog/posthog in…
havenbarnes e6727a7
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes d2d42b2
tweak
havenbarnes 92150a6
Merge branch 'master' of https://github.com/PostHog/posthog into stal…
havenbarnes 20a349e
Update query snapshots
github-actions[bot] a197ca5
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes af637e5
Merge branch 'master' into detect-stale-flags
havenbarnes 5334c34
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes 550870c
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 10061d1
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes 90c0f19
Update query snapshots
github-actions[bot] 8ceafd9
Merge branch 'detect-stale-flags' into stale-flag-ui
havenbarnes c89d215
Merge branch 'master' into detect-stale-flags
havenbarnes da4fa13
Merge branch 'master' of https://github.com/PostHog/posthog into stal…
havenbarnes 34a9001
Merge branch 'stale-flag-ui' of https://github.com/PostHog/posthog in…
havenbarnes d0fd266
fix storybook test
havenbarnes 930a4e0
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 09b600f
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes c1633fa
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 1e99459
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes b8ff72c
Merge branch 'master' into detect-stale-flags
havenbarnes c93f1a3
Use proper term "rolled out" instead of "enabled"
havenbarnes f4767ed
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 5308ac5
Merge branch 'master' of https://github.com/PostHog/posthog into stal…
havenbarnes f7010cc
Merge branch 'master' into detect-stale-flags
havenbarnes 077a7a8
Merge branch 'master' of https://github.com/PostHog/posthog into stal…
havenbarnes f382fc2
re-work to use a Tag with tooltip
havenbarnes fe22911
Merge branch 'master' into detect-stale-flags
havenbarnes c754314
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes 519e013
Update UI snapshots for `chromium` (2)
github-actions[bot] 87cd011
Merge branch 'master' of https://github.com/PostHog/posthog into stal…
havenbarnes cf5db3d
Merge branch 'stale-flag-ui' of https://github.com/PostHog/posthog in…
havenbarnes 5893965
tweak
havenbarnes 96dae51
Merge branch 'master' into stale-flag-ui
havenbarnes bb7b012
Update UI snapshots for `chromium` (2)
github-actions[bot] 15958bd
Update UI snapshots for `chromium` (2)
github-actions[bot] 225270d
Merge branch 'master' into stale-flag-ui
havenbarnes efc864e
Merge branch 'master' into stale-flag-ui
havenbarnes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file modified
BIN
+42 Bytes
(100%)
frontend/__snapshots__/scenes-app-insights--funnel-top-to-bottom-edit--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
40 changes: 40 additions & 0 deletions
40
frontend/src/scenes/feature-flags/FeatureFlagStatusIndicator.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,40 @@ | ||
import { LemonTag } from 'lib/lemon-ui/LemonTag' | ||
import { Tooltip } from 'lib/lemon-ui/Tooltip' | ||
|
||
import { FeatureFlagStatus, FeatureFlagStatusResponse } from '~/types' | ||
|
||
export function FeatureFlagStatusIndicator({ | ||
flagStatus, | ||
}: { | ||
flagStatus: FeatureFlagStatusResponse | null | ||
}): JSX.Element | null { | ||
if ( | ||
!flagStatus || | ||
[FeatureFlagStatus.ACTIVE, FeatureFlagStatus.DELETED, FeatureFlagStatus.UNKNOWN].includes(flagStatus.status) | ||
) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Tooltip | ||
title={ | ||
<> | ||
<div className="text-sm">{flagStatus.reason}</div> | ||
<div className="text-xs"> | ||
{flagStatus.status === FeatureFlagStatus.STALE && | ||
'Make sure to remove any references to this flag in your code before deleting it.'} | ||
{flagStatus.status === FeatureFlagStatus.INACTIVE && | ||
'It is probably not being used in your code, but be sure to remove any references to this flag before deleting it.'} | ||
</div> | ||
</> | ||
} | ||
placement="right" | ||
> | ||
<span> | ||
<LemonTag type="warning" className="uppercase cursor-default"> | ||
{flagStatus.status} | ||
</LemonTag> | ||
</span> | ||
</Tooltip> | ||
) | ||
} |
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
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
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
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
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 |
---|---|---|
|
@@ -85,7 +85,7 @@ def is_flag_fully_rolled_out(self, flag: FeatureFlag) -> tuple[bool, FeatureFlag | |
) | ||
if multivariate and is_multivariate_flag_fully_rolled_out: | ||
return True, f'This flag will always use the variant "{fully_rolled_out_variant_name}"' | ||
elif self.is_boolean_flag_fully_rolled_out(flag): | ||
elif not multivariate and self.is_boolean_flag_fully_rolled_out(flag): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Meant to push this to #26340, caught an edge case (the new test checks for this) |
||
return True, 'This boolean flag will always evaluate to "true"' | ||
|
||
return False, "" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
how is
inactive
differentiated fromdisabled
in this case? Are all disabled flags also inactive? If so, I feel like we shouldn't show an indicator if that's the case – I only care about a flag being inactive/stale if I have the flag enabled in my app.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.
If a flag is
disabled
(to be precise,flag.active = false
), then the endpoint currently would only determine it to beinactive
if there have been no recent evaluations.active = false
does not imply inactive or stale.I did this intentionally; a good example of why this feels correct to me is if a flag exists in staging and production projects but is only enabled in staging, you don't want to make the flag show up as stale in the prod project, unless it isn't being evaluated at all which would indicate that you aren't actually referencing the flag in code at all then (in this case we would call it "inactive", because we don't actually know for sure it is "stale", we only know it is unused).