Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add warning hints on potential misconfiguration (#2948)
## About the changes Add warnings when we detect something might be wrong with the customer configuration, in particular with regard to variants configuration ## Rationale Moving from variants per feature to variants per environment will allow users to have fine-grained permissions and more control over variants on different environments: #2254 But because this requires an additional step of copying variants to other environments, we identified the potential risk of users forgetting to follow this step. To keep them informed about this, we're introducing a warning sign after a toggle is enabled when we detect that: 1. The environment is enabled without variants 2. Other enabled environments have variants This situation would be a problem if you rely on `getVariant` method from the SDK, because without variants you'll receive the default variant. Probably, not what you'd expect after enabling the toggle, but there are situations where this might be correct. Because of the latter, we thought that adding a warning and letting the user handle the situation was the best solution. ## UI sketches ![image (6)](https://user-images.githubusercontent.com/455064/213676353-112639f0-7781-42c0-8c9d-8c7eba316bae.png) ![Screenshot from 2023-01-19 08-55-10](https://user-images.githubusercontent.com/455064/213664639-7b11ff4b-048a-4a36-aa71-7df2f889adff.png) Co-authored-by: Nuno Góis <github@nunogois.com>
- Loading branch information
Showing
11 changed files
with
165 additions
and
48 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
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
33 changes: 33 additions & 0 deletions
33
frontend/src/component/feature/FeatureView/FeatureVariants/VariantsTooltipWarning.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,33 @@ | ||
import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip'; | ||
import { WarningAmber } from '@mui/icons-material'; | ||
import { styled } from '@mui/material'; | ||
|
||
const StyledWarningAmber = styled(WarningAmber)(({ theme }) => ({ | ||
color: theme.palette.warning.main, | ||
fontSize: theme.fontSizes.bodySize, | ||
})); | ||
|
||
const VariantsWarningTooltip = () => { | ||
return ( | ||
<HtmlTooltip | ||
arrow | ||
title={ | ||
<> | ||
This environment has no variants enabled. If you check this | ||
feature's variants in this environment, you will get the{' '} | ||
<a | ||
href="https://docs.getunleash.io/reference/feature-toggle-variants#the-disabled-variant" | ||
target="_blank" | ||
> | ||
disabled variant | ||
</a> | ||
. | ||
</> | ||
} | ||
> | ||
<StyledWarningAmber /> | ||
</HtmlTooltip> | ||
); | ||
}; | ||
|
||
export default VariantsWarningTooltip; |
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
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