feat: allow specifying app level feature flags

application feature flags can be defined in the application
creation. see docs/plugins/feature-flags.md for reference.

closes #15553

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2023-01-04 15:41:46 +02:00
parent dcf3b33189
commit bca8e8b393
11 changed files with 67 additions and 8 deletions
@@ -30,6 +30,15 @@ type Props = {
toggleHandler: Function;
};
const getSecondaryText = (flag: FeatureFlag) => {
if (flag.description) {
return flag.description;
}
return flag.pluginId
? `Registered in ${flag.pluginId} plugin`
: 'Registered in the application';
};
export const FlagItem = ({ flag, enabled, toggleHandler }: Props) => (
<ListItem divider button onClick={() => toggleHandler(flag.name)}>
<ListItemIcon>
@@ -37,9 +46,6 @@ export const FlagItem = ({ flag, enabled, toggleHandler }: Props) => (
<Switch color="primary" checked={enabled} name={flag.name} />
</Tooltip>
</ListItemIcon>
<ListItemText
primary={flag.name}
secondary={`Registered in ${flag.pluginId} plugin`}
/>
<ListItemText primary={flag.name} secondary={getSecondaryText(flag)} />
</ListItem>
);