From 165170cd5cfd724bb2bfa87d228dfa001b37a545 Mon Sep 17 00:00:00 2001 From: Youssef Khedher Date: Mon, 29 Nov 2021 14:29:58 +0100 Subject: [PATCH] fix/breadcrumb (#533) * fix: remove features2 from breadcrumb * fix: strategy names Co-authored-by: Fredrik Oseberg --- .../common/BreadcrumbNav/BreadcrumbNav.tsx | 3 +- .../FeatureOverviewEnvironmentStrategy.tsx | 4 +- .../FeatureStrategyCard.tsx | 4 +- .../FeatureStrategyAccordion.tsx | 4 +- .../EditStrategyModal/EditStrategyModal.jsx | 4 +- .../strategy/StrategyCard/StrategyCard.jsx | 4 +- .../StrategiesList/StrategiesList.jsx | 78 +++++++++++-------- frontend/src/utils/strategy-names.js | 2 +- 8 files changed, 60 insertions(+), 43 deletions(-) diff --git a/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx index 745019498f..6f8d71f9f8 100644 --- a/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx +++ b/frontend/src/component/common/BreadcrumbNav/BreadcrumbNav.tsx @@ -22,7 +22,8 @@ const BreadcrumbNav = () => { item !== 'metrics' && item !== 'copy' && item !== 'strategies' && - item !== 'features' + item !== 'features' && + item !== 'features2' ); return ( diff --git a/frontend/src/component/feature/FeatureView2/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentStrategies/FeatureOverviewEnvironmentStrategy/FeatureOverviewEnvironmentStrategy.tsx b/frontend/src/component/feature/FeatureView2/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentStrategies/FeatureOverviewEnvironmentStrategy/FeatureOverviewEnvironmentStrategy.tsx index 8cb651ef36..922be20a21 100644 --- a/frontend/src/component/feature/FeatureView2/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentStrategies/FeatureOverviewEnvironmentStrategy/FeatureOverviewEnvironmentStrategy.tsx +++ b/frontend/src/component/feature/FeatureView2/FeatureOverview/FeatureOverviewEnvironments/FeatureOverviewEnvironment/FeatureOverviewEnvironmentStrategies/FeatureOverviewEnvironmentStrategy/FeatureOverviewEnvironmentStrategy.tsx @@ -5,7 +5,7 @@ import { IFeatureViewParams } from '../../../../../../../../interfaces/params'; import { IFeatureStrategy } from '../../../../../../../../interfaces/strategy'; import { getFeatureStrategyIcon, - getHumanReadbleStrategyName, + getHumanReadableStrategyName, } from '../../../../../../../../utils/strategy-names'; import PermissionIconButton from '../../../../../../../common/PermissionIconButton/PermissionIconButton'; import { UPDATE_FEATURE } from '../../../../../../../providers/AccessProvider/permissions'; @@ -33,7 +33,7 @@ const FeatureOverviewEnvironmentStrategy = ({
- {getHumanReadbleStrategyName(strategy.name)} + {getHumanReadableStrategyName(strategy.name)}
= ({ }) => { const smallScreen = useMediaQuery('(max-width:500px)'); const styles = useStyles(); - const strategyName = getHumanReadbleStrategyName(strategy.name); + const strategyName = getHumanReadableStrategyName(strategy.name); const Icon = getFeatureStrategyIcon(strategy.name); const updateParameters = (field: string, value: any) => { diff --git a/frontend/src/component/feature/strategy/EditStrategyModal/EditStrategyModal.jsx b/frontend/src/component/feature/strategy/EditStrategyModal/EditStrategyModal.jsx index f2629dc419..db46eb49dd 100644 --- a/frontend/src/component/feature/strategy/EditStrategyModal/EditStrategyModal.jsx +++ b/frontend/src/component/feature/strategy/EditStrategyModal/EditStrategyModal.jsx @@ -7,7 +7,7 @@ import UserWithIdStrategy from './user-with-id-strategy'; import GeneralStrategy from './general-strategy'; import StrategyConstraints from '../StrategyConstraint/StrategyConstraintInput'; -import { getHumanReadbleStrategyName } from '../../../../utils/strategy-names'; +import { getHumanReadableStrategyName } from '../../../../utils/strategy-names'; import Dialogue from '../../../common/Dialogue'; const EditStrategyModal = ({ @@ -91,7 +91,7 @@ const EditStrategyModal = ({ fullWidth onClose={onCancel} onClick={save} - title={`Configure ${getHumanReadbleStrategyName( + title={`Configure ${getHumanReadableStrategyName( strategy.name )} strategy`} primaryButtonText="Save" diff --git a/frontend/src/component/feature/strategy/StrategyCard/StrategyCard.jsx b/frontend/src/component/feature/strategy/StrategyCard/StrategyCard.jsx index 2226e8ac03..4eb7919b9d 100644 --- a/frontend/src/component/feature/strategy/StrategyCard/StrategyCard.jsx +++ b/frontend/src/component/feature/strategy/StrategyCard/StrategyCard.jsx @@ -6,7 +6,7 @@ import { Card, CardContent } from '@material-ui/core'; import { useStyles } from './StrategyCard.styles'; import StrategyCardContent from './StrategyCardContent/StrategyCardContent'; import StrategyCardHeader from './StrategyCardHeader/StrategyCardHeader'; -import { getHumanReadbleStrategyName } from '../../../../utils/strategy-names'; +import { getHumanReadableStrategyName } from '../../../../utils/strategy-names'; const StrategyCard = ({ strategy, @@ -25,7 +25,7 @@ const StrategyCard = ({ - history.push('/strategies/create') - } - permission={CREATE_STRATEGY} - tooltip={'Add new strategy'} - > - - - + history.push('/strategies/create')} + permission={CREATE_STRATEGY} + tooltip={'Add new strategy'} + > + + } elseShow={ ( - {name} + {getHumanReadableStrategyName(name)} (Deprecated)} @@ -96,7 +111,9 @@ const StrategiesList = ({ } permission={UPDATE_STRATEGY} tooltip={'Reactivate activation strategy'} - > + > + + ); @@ -119,8 +136,7 @@ const StrategiesList = ({ setDialogueMetaData({ show: true, title: 'Really deprecate strategy?', - onConfirm: () => - deprecateStrategy(strategy), + onConfirm: () => deprecateStrategy(strategy), }) } permission={UPDATE_STRATEGY} @@ -137,19 +153,19 @@ const StrategiesList = ({ - setDialogueMetaData({ - show: true, - title: 'Really delete strategy?', - onConfirm: () => removeStrategy(strategy), - }) - } - permission={DELETE_STRATEGY} - tooltip={'Delete strategy'} - > - - + + setDialogueMetaData({ + show: true, + title: 'Really delete strategy?', + onConfirm: () => removeStrategy(strategy), + }) + } + permission={DELETE_STRATEGY} + tooltip={'Delete strategy'} + > + + } elseShow={ diff --git a/frontend/src/utils/strategy-names.js b/frontend/src/utils/strategy-names.js index dc3c2c1515..c633d210f7 100644 --- a/frontend/src/utils/strategy-names.js +++ b/frontend/src/utils/strategy-names.js @@ -47,7 +47,7 @@ const nameMapping = { export const getHumanReadbleStrategy = strategyName => nameMapping[strategyName]; -export const getHumanReadbleStrategyName = strategyName => { +export const getHumanReadableStrategyName = strategyName => { const humanReadableStrategy = nameMapping[strategyName]; if (humanReadableStrategy) {