mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
fix/breadcrumb (#533)
* fix: remove features2 from breadcrumb * fix: strategy names Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
This commit is contained in:
parent
0d13681fd6
commit
165170cd5c
@ -22,7 +22,8 @@ const BreadcrumbNav = () => {
|
|||||||
item !== 'metrics' &&
|
item !== 'metrics' &&
|
||||||
item !== 'copy' &&
|
item !== 'copy' &&
|
||||||
item !== 'strategies' &&
|
item !== 'strategies' &&
|
||||||
item !== 'features'
|
item !== 'features' &&
|
||||||
|
item !== 'features2'
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -5,7 +5,7 @@ import { IFeatureViewParams } from '../../../../../../../../interfaces/params';
|
|||||||
import { IFeatureStrategy } from '../../../../../../../../interfaces/strategy';
|
import { IFeatureStrategy } from '../../../../../../../../interfaces/strategy';
|
||||||
import {
|
import {
|
||||||
getFeatureStrategyIcon,
|
getFeatureStrategyIcon,
|
||||||
getHumanReadbleStrategyName,
|
getHumanReadableStrategyName,
|
||||||
} from '../../../../../../../../utils/strategy-names';
|
} from '../../../../../../../../utils/strategy-names';
|
||||||
import PermissionIconButton from '../../../../../../../common/PermissionIconButton/PermissionIconButton';
|
import PermissionIconButton from '../../../../../../../common/PermissionIconButton/PermissionIconButton';
|
||||||
import { UPDATE_FEATURE } from '../../../../../../../providers/AccessProvider/permissions';
|
import { UPDATE_FEATURE } from '../../../../../../../providers/AccessProvider/permissions';
|
||||||
@ -33,7 +33,7 @@ const FeatureOverviewEnvironmentStrategy = ({
|
|||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.header}>
|
<div className={styles.header}>
|
||||||
<Icon className={styles.icon} />
|
<Icon className={styles.icon} />
|
||||||
{getHumanReadbleStrategyName(strategy.name)}
|
{getHumanReadableStrategyName(strategy.name)}
|
||||||
<div className={styles.editStrategy}>
|
<div className={styles.editStrategy}>
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
permission={UPDATE_FEATURE}
|
permission={UPDATE_FEATURE}
|
||||||
|
@ -12,7 +12,7 @@ import { ADD_NEW_STRATEGY_CARD_BUTTON_ID } from '../../../../../../testIds';
|
|||||||
import { getStrategyObject } from '../../../../../../utils/get-strategy-object';
|
import { getStrategyObject } from '../../../../../../utils/get-strategy-object';
|
||||||
import {
|
import {
|
||||||
getFeatureStrategyIcon,
|
getFeatureStrategyIcon,
|
||||||
getHumanReadbleStrategyName,
|
getHumanReadableStrategyName,
|
||||||
} from '../../../../../../utils/strategy-names';
|
} from '../../../../../../utils/strategy-names';
|
||||||
import { UPDATE_FEATURE } from '../../../../../providers/AccessProvider/permissions';
|
import { UPDATE_FEATURE } from '../../../../../providers/AccessProvider/permissions';
|
||||||
import ConditionallyRender from '../../../../../common/ConditionallyRender';
|
import ConditionallyRender from '../../../../../common/ConditionallyRender';
|
||||||
@ -63,7 +63,7 @@ const FeatureStrategyCard = ({
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
const readableName = getHumanReadbleStrategyName(name);
|
const readableName = getHumanReadableStrategyName(name);
|
||||||
const Icon = getFeatureStrategyIcon(name);
|
const Icon = getFeatureStrategyIcon(name);
|
||||||
|
|
||||||
const classes = classNames(styles.featureStrategyCard);
|
const classes = classNames(styles.featureStrategyCard);
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
||||||
import {
|
import {
|
||||||
getFeatureStrategyIcon,
|
getFeatureStrategyIcon,
|
||||||
getHumanReadbleStrategyName,
|
getHumanReadableStrategyName,
|
||||||
} from '../../../../../utils/strategy-names';
|
} from '../../../../../utils/strategy-names';
|
||||||
import { useStyles } from './FeatureStrategyAccordion.styles';
|
import { useStyles } from './FeatureStrategyAccordion.styles';
|
||||||
import ConditionallyRender from '../../../../common/ConditionallyRender';
|
import ConditionallyRender from '../../../../common/ConditionallyRender';
|
||||||
@ -44,7 +44,7 @@ const FeatureStrategyAccordion: React.FC<IFeatureStrategyAccordionProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const smallScreen = useMediaQuery('(max-width:500px)');
|
const smallScreen = useMediaQuery('(max-width:500px)');
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
const strategyName = getHumanReadbleStrategyName(strategy.name);
|
const strategyName = getHumanReadableStrategyName(strategy.name);
|
||||||
const Icon = getFeatureStrategyIcon(strategy.name);
|
const Icon = getFeatureStrategyIcon(strategy.name);
|
||||||
|
|
||||||
const updateParameters = (field: string, value: any) => {
|
const updateParameters = (field: string, value: any) => {
|
||||||
|
@ -7,7 +7,7 @@ import UserWithIdStrategy from './user-with-id-strategy';
|
|||||||
import GeneralStrategy from './general-strategy';
|
import GeneralStrategy from './general-strategy';
|
||||||
import StrategyConstraints from '../StrategyConstraint/StrategyConstraintInput';
|
import StrategyConstraints from '../StrategyConstraint/StrategyConstraintInput';
|
||||||
|
|
||||||
import { getHumanReadbleStrategyName } from '../../../../utils/strategy-names';
|
import { getHumanReadableStrategyName } from '../../../../utils/strategy-names';
|
||||||
import Dialogue from '../../../common/Dialogue';
|
import Dialogue from '../../../common/Dialogue';
|
||||||
|
|
||||||
const EditStrategyModal = ({
|
const EditStrategyModal = ({
|
||||||
@ -91,7 +91,7 @@ const EditStrategyModal = ({
|
|||||||
fullWidth
|
fullWidth
|
||||||
onClose={onCancel}
|
onClose={onCancel}
|
||||||
onClick={save}
|
onClick={save}
|
||||||
title={`Configure ${getHumanReadbleStrategyName(
|
title={`Configure ${getHumanReadableStrategyName(
|
||||||
strategy.name
|
strategy.name
|
||||||
)} strategy`}
|
)} strategy`}
|
||||||
primaryButtonText="Save"
|
primaryButtonText="Save"
|
||||||
|
@ -6,7 +6,7 @@ import { Card, CardContent } from '@material-ui/core';
|
|||||||
import { useStyles } from './StrategyCard.styles';
|
import { useStyles } from './StrategyCard.styles';
|
||||||
import StrategyCardContent from './StrategyCardContent/StrategyCardContent';
|
import StrategyCardContent from './StrategyCardContent/StrategyCardContent';
|
||||||
import StrategyCardHeader from './StrategyCardHeader/StrategyCardHeader';
|
import StrategyCardHeader from './StrategyCardHeader/StrategyCardHeader';
|
||||||
import { getHumanReadbleStrategyName } from '../../../../utils/strategy-names';
|
import { getHumanReadableStrategyName } from '../../../../utils/strategy-names';
|
||||||
|
|
||||||
const StrategyCard = ({
|
const StrategyCard = ({
|
||||||
strategy,
|
strategy,
|
||||||
@ -25,7 +25,7 @@ const StrategyCard = ({
|
|||||||
<span style={{ alignItems: 'stretch' }}>
|
<span style={{ alignItems: 'stretch' }}>
|
||||||
<Card className={styles.strategyCard}>
|
<Card className={styles.strategyCard}>
|
||||||
<StrategyCardHeader
|
<StrategyCardHeader
|
||||||
name={getHumanReadbleStrategyName(strategy.name)}
|
name={getHumanReadableStrategyName(strategy.name)}
|
||||||
connectDragSource={connectDragSource}
|
connectDragSource={connectDragSource}
|
||||||
removeStrategy={removeStrategy}
|
removeStrategy={removeStrategy}
|
||||||
editStrategy={editStrategy}
|
editStrategy={editStrategy}
|
||||||
|
@ -4,10 +4,27 @@ import classnames from 'classnames';
|
|||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
||||||
|
|
||||||
import { IconButton, List, ListItem, ListItemAvatar, ListItemText, Tooltip } from '@material-ui/core';
|
import {
|
||||||
import { Add, Delete, Extension, Visibility, VisibilityOff } from '@material-ui/icons';
|
IconButton,
|
||||||
|
List,
|
||||||
|
ListItem,
|
||||||
|
ListItemAvatar,
|
||||||
|
ListItemText,
|
||||||
|
Tooltip,
|
||||||
|
} from '@material-ui/core';
|
||||||
|
import {
|
||||||
|
Add,
|
||||||
|
Delete,
|
||||||
|
Extension,
|
||||||
|
Visibility,
|
||||||
|
VisibilityOff,
|
||||||
|
} from '@material-ui/icons';
|
||||||
|
|
||||||
import { CREATE_STRATEGY, DELETE_STRATEGY, UPDATE_STRATEGY } from '../../providers/AccessProvider/permissions';
|
import {
|
||||||
|
CREATE_STRATEGY,
|
||||||
|
DELETE_STRATEGY,
|
||||||
|
UPDATE_STRATEGY,
|
||||||
|
} from '../../providers/AccessProvider/permissions';
|
||||||
|
|
||||||
import ConditionallyRender from '../../common/ConditionallyRender/ConditionallyRender';
|
import ConditionallyRender from '../../common/ConditionallyRender/ConditionallyRender';
|
||||||
import PageContent from '../../common/PageContent/PageContent';
|
import PageContent from '../../common/PageContent/PageContent';
|
||||||
@ -19,6 +36,7 @@ import Dialogue from '../../common/Dialogue';
|
|||||||
import { ADD_NEW_STRATEGY_ID } from '../../../testIds';
|
import { ADD_NEW_STRATEGY_ID } from '../../../testIds';
|
||||||
import PermissionIconButton from '../../common/PermissionIconButton/PermissionIconButton';
|
import PermissionIconButton from '../../common/PermissionIconButton/PermissionIconButton';
|
||||||
import PermissionButton from '../../common/PermissionButton/PermissionButton';
|
import PermissionButton from '../../common/PermissionButton/PermissionButton';
|
||||||
|
import { getHumanReadableStrategyName } from '../../../utils/strategy-names';
|
||||||
|
|
||||||
const StrategiesList = ({
|
const StrategiesList = ({
|
||||||
strategies,
|
strategies,
|
||||||
@ -45,17 +63,14 @@ const StrategiesList = ({
|
|||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={smallScreen}
|
condition={smallScreen}
|
||||||
show={
|
show={
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
data-test={ADD_NEW_STRATEGY_ID}
|
data-test={ADD_NEW_STRATEGY_ID}
|
||||||
onClick={() =>
|
onClick={() => history.push('/strategies/create')}
|
||||||
history.push('/strategies/create')
|
permission={CREATE_STRATEGY}
|
||||||
}
|
tooltip={'Add new strategy'}
|
||||||
permission={CREATE_STRATEGY}
|
>
|
||||||
tooltip={'Add new strategy'}
|
<Add />
|
||||||
>
|
</PermissionIconButton>
|
||||||
<Add />
|
|
||||||
</PermissionIconButton>
|
|
||||||
|
|
||||||
}
|
}
|
||||||
elseShow={
|
elseShow={
|
||||||
<PermissionButton
|
<PermissionButton
|
||||||
@ -76,7 +91,7 @@ const StrategiesList = ({
|
|||||||
|
|
||||||
const strategyLink = ({ name, deprecated }) => (
|
const strategyLink = ({ name, deprecated }) => (
|
||||||
<Link to={`/strategies/view/${name}`}>
|
<Link to={`/strategies/view/${name}`}>
|
||||||
<strong>{name}</strong>
|
<strong>{getHumanReadableStrategyName(name)}</strong>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={deprecated}
|
condition={deprecated}
|
||||||
show={<small> (Deprecated)</small>}
|
show={<small> (Deprecated)</small>}
|
||||||
@ -96,7 +111,9 @@ const StrategiesList = ({
|
|||||||
}
|
}
|
||||||
permission={UPDATE_STRATEGY}
|
permission={UPDATE_STRATEGY}
|
||||||
tooltip={'Reactivate activation strategy'}
|
tooltip={'Reactivate activation strategy'}
|
||||||
><VisibilityOff /></PermissionIconButton>
|
>
|
||||||
|
<VisibilityOff />
|
||||||
|
</PermissionIconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -119,8 +136,7 @@ const StrategiesList = ({
|
|||||||
setDialogueMetaData({
|
setDialogueMetaData({
|
||||||
show: true,
|
show: true,
|
||||||
title: 'Really deprecate strategy?',
|
title: 'Really deprecate strategy?',
|
||||||
onConfirm: () =>
|
onConfirm: () => deprecateStrategy(strategy),
|
||||||
deprecateStrategy(strategy),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
permission={UPDATE_STRATEGY}
|
permission={UPDATE_STRATEGY}
|
||||||
@ -137,19 +153,19 @@ const StrategiesList = ({
|
|||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={strategy.editable}
|
condition={strategy.editable}
|
||||||
show={
|
show={
|
||||||
<PermissionIconButton
|
<PermissionIconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
setDialogueMetaData({
|
setDialogueMetaData({
|
||||||
show: true,
|
show: true,
|
||||||
title: 'Really delete strategy?',
|
title: 'Really delete strategy?',
|
||||||
onConfirm: () => removeStrategy(strategy),
|
onConfirm: () => removeStrategy(strategy),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
permission={DELETE_STRATEGY}
|
permission={DELETE_STRATEGY}
|
||||||
tooltip={'Delete strategy'}
|
tooltip={'Delete strategy'}
|
||||||
>
|
>
|
||||||
<Delete />
|
<Delete />
|
||||||
</PermissionIconButton>
|
</PermissionIconButton>
|
||||||
}
|
}
|
||||||
elseShow={
|
elseShow={
|
||||||
<Tooltip title="You cannot delete a built-in strategy">
|
<Tooltip title="You cannot delete a built-in strategy">
|
||||||
|
@ -47,7 +47,7 @@ const nameMapping = {
|
|||||||
export const getHumanReadbleStrategy = strategyName =>
|
export const getHumanReadbleStrategy = strategyName =>
|
||||||
nameMapping[strategyName];
|
nameMapping[strategyName];
|
||||||
|
|
||||||
export const getHumanReadbleStrategyName = strategyName => {
|
export const getHumanReadableStrategyName = strategyName => {
|
||||||
const humanReadableStrategy = nameMapping[strategyName];
|
const humanReadableStrategy = nameMapping[strategyName];
|
||||||
|
|
||||||
if (humanReadableStrategy) {
|
if (humanReadableStrategy) {
|
||||||
|
Loading…
Reference in New Issue
Block a user