1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-10 17:53:36 +02:00

Chore(1-3894): update old/new name display + remove strategy type names (#10305)

This PR updates how we show old/new strategy/segment names in change
requests, and also removes the name of the strategy type from the
change.

For the old/new names: instead of showing them stacked vertically, we
show them side by side (old name first, then new name).

Compare before:
<img width="967" alt="image"
src="https://github.com/user-attachments/assets/d3e36f49-4abc-4cd4-8ba9-752515740185"
/>


with after:

<img width="974" alt="image"
src="https://github.com/user-attachments/assets/d0f85264-b055-4c44-b985-f992f09d8dab"
/>


Only affects the new components (legacy CR view is untouched). If we get
negative feedback while rolling it out because the strat type name is
missing, we can always add it back.
This commit is contained in:
Thomas Heartman 2025-07-03 14:58:13 +02:00 committed by GitHub
parent 2b780e0120
commit 51a895b660
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 14 additions and 70 deletions

View File

@ -1,18 +0,0 @@
import type { FC } from 'react';
import { NameWithChangeInfo } from './NameWithChangeInfo/NameWithChangeInfo.tsx';
type ChangeSegmentNameProps = {
name: string;
previousName?: string;
};
export const ChangeSegmentName: FC<ChangeSegmentNameProps> = ({
name,
previousName,
}) => {
return (
<span>
<NameWithChangeInfo newName={name} previousName={previousName} />
</span>
);
};

View File

@ -1,30 +0,0 @@
import type { FC } from 'react';
import { formatStrategyName } from 'utils/strategyNames';
import { styled } from '@mui/material';
import { textTruncated } from 'themes/themeStyles';
import { NameWithChangeInfo } from './NameWithChangeInfo/NameWithChangeInfo.tsx';
import { Truncator } from 'component/common/Truncator/Truncator.tsx';
type ChangeStrategyNameProps = {
name: string;
title?: string;
previousTitle?: string;
};
const Truncated = styled('span')(() => ({
...textTruncated,
maxWidth: 500,
}));
export const ChangeStrategyName: FC<ChangeStrategyNameProps> = ({
name,
title,
previousTitle,
}) => {
return (
<Truncated>
<Truncator component='span'>{formatStrategyName(name)}</Truncator>
<NameWithChangeInfo newName={title} previousName={previousTitle} />
</Truncated>
);
};

View File

@ -6,7 +6,6 @@ import { textTruncated } from 'themes/themeStyles';
const Truncated = styled('span')(() => ({ const Truncated = styled('span')(() => ({
...textTruncated, ...textTruncated,
maxWidth: 500, maxWidth: 500,
display: 'block',
})); }));
const NewName = styled(Typography)<TypographyProps>({ const NewName = styled(Typography)<TypographyProps>({

View File

@ -17,7 +17,7 @@ import {
Deleted, Deleted,
} from './Change.styles.tsx'; } from './Change.styles.tsx';
import { SegmentDiff } from './SegmentDiff.tsx'; import { SegmentDiff } from './SegmentDiff.tsx';
import { ChangeSegmentName } from './ChangeSegmentName.tsx'; import { NameWithChangeInfo } from './NameWithChangeInfo/NameWithChangeInfo.tsx';
const ActionsContainer = styled('div')(({ theme }) => ({ const ActionsContainer = styled('div')(({ theme }) => ({
display: 'flex', display: 'flex',
@ -72,8 +72,8 @@ export const SegmentChangeDetails: FC<{
<ChangeItemWrapper> <ChangeItemWrapper>
<ChangeItemInfo> <ChangeItemInfo>
<Deleted>Deleting segment</Deleted> <Deleted>Deleting segment</Deleted>
<ChangeSegmentName <NameWithChangeInfo
name={change.payload.name} newName={change.payload.name}
previousName={previousName} previousName={previousName}
/> />
</ChangeItemInfo> </ChangeItemInfo>
@ -102,8 +102,8 @@ export const SegmentChangeDetails: FC<{
<ChangeItemWrapper> <ChangeItemWrapper>
<ChangeItemInfo> <ChangeItemInfo>
<Action>Editing segment</Action> <Action>Editing segment</Action>
<ChangeSegmentName <NameWithChangeInfo
name={change.payload.name} newName={change.payload.name}
previousName={previousName} previousName={previousName}
/> />
</ChangeItemInfo> </ChangeItemInfo>

View File

@ -243,7 +243,6 @@ test('Deleting strategy before change request is applied diffs against current s
); );
await screen.findByText('Deleting strategy'); await screen.findByText('Deleting strategy');
await screen.findByText('Gradual rollout');
await screen.findByText('current_title'); await screen.findByText('current_title');
await screen.findByText('current_variant'); await screen.findByText('current_variant');
@ -299,7 +298,6 @@ test('Deleting strategy after change request is applied diffs against the snapsh
); );
await screen.findByText('Deleting strategy'); await screen.findByText('Deleting strategy');
await screen.findByText('Gradual rollout');
await screen.findByText('snapshot_title'); await screen.findByText('snapshot_title');
expect(screen.queryByText('current_title')).not.toBeInTheDocument(); expect(screen.queryByText('current_title')).not.toBeInTheDocument();

View File

@ -18,7 +18,6 @@ import { EnvironmentVariantsTable } from 'component/feature/FeatureView/FeatureV
import { ChangeOverwriteWarning } from './ChangeOverwriteWarning/ChangeOverwriteWarning.tsx'; import { ChangeOverwriteWarning } from './ChangeOverwriteWarning/ChangeOverwriteWarning.tsx';
import type { IFeatureStrategy } from 'interfaces/strategy'; import type { IFeatureStrategy } from 'interfaces/strategy';
import { Tab, TabList, TabPanel, Tabs } from './ChangeTabComponents.tsx'; import { Tab, TabList, TabPanel, Tabs } from './ChangeTabComponents.tsx';
import { ChangeStrategyName } from './ChangeStrategyName.tsx';
import { StrategyDiff } from './StrategyDiff.tsx'; import { StrategyDiff } from './StrategyDiff.tsx';
import { import {
Action, Action,
@ -27,6 +26,7 @@ import {
ChangeItemWrapper, ChangeItemWrapper,
Deleted, Deleted,
} from './Change.styles.tsx'; } from './Change.styles.tsx';
import { NameWithChangeInfo } from './NameWithChangeInfo/NameWithChangeInfo.tsx';
const StyledBox: FC<{ children?: React.ReactNode }> = styled(Box)( const StyledBox: FC<{ children?: React.ReactNode }> = styled(Box)(
({ theme }) => ({ ({ theme }) => ({
@ -103,10 +103,6 @@ const DeleteStrategy: FC<{
currentStrategy: IFeatureStrategy | undefined; currentStrategy: IFeatureStrategy | undefined;
actions?: ReactNode; actions?: ReactNode;
}> = ({ change, changeRequestState, currentStrategy, actions }) => { }> = ({ change, changeRequestState, currentStrategy, actions }) => {
const name =
changeRequestState === 'Applied'
? change.payload?.snapshot?.name
: currentStrategy?.name;
const title = const title =
changeRequestState === 'Applied' changeRequestState === 'Applied'
? change.payload?.snapshot?.title ? change.payload?.snapshot?.title
@ -121,7 +117,10 @@ const DeleteStrategy: FC<{
<ChangeItemWrapper> <ChangeItemWrapper>
<ChangeItemInfo> <ChangeItemInfo>
<Deleted>Deleting strategy</Deleted> <Deleted>Deleting strategy</Deleted>
<ChangeStrategyName name={name || ''} title={title} /> <NameWithChangeInfo
newName={title}
previousName={referenceStrategy?.title}
/>
</ChangeItemInfo> </ChangeItemInfo>
{actions} {actions}
</ChangeItemWrapper> </ChangeItemWrapper>
@ -175,10 +174,9 @@ const UpdateStrategy: FC<{
wasDisabled={currentStrategy?.disabled} wasDisabled={currentStrategy?.disabled}
willBeDisabled={change.payload?.disabled} willBeDisabled={change.payload?.disabled}
/> />
<ChangeStrategyName <NameWithChangeInfo
name={change.payload.name} newName={change.payload.title}
title={change.payload.title} previousName={previousTitle}
previousTitle={previousTitle}
/> />
</ChangeItemInfo> </ChangeItemInfo>
{actions} {actions}
@ -248,10 +246,7 @@ const AddStrategy: FC<{
<AddedStrategy disabled={change.payload?.disabled}> <AddedStrategy disabled={change.payload?.disabled}>
Adding {isDefaultChange && 'default'} strategy Adding {isDefaultChange && 'default'} strategy
</AddedStrategy> </AddedStrategy>
<ChangeStrategyName <NameWithChangeInfo newName={change.payload.title} />
name={change.payload.name}
title={change.payload.title}
/>
<DisabledEnabledState <DisabledEnabledState
disabled disabled
show={change.payload?.disabled === true} show={change.payload?.disabled === true}