mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
Chore/cleanup tag color feature falg (#9959)
Removes the flag for tag type colors.
This commit is contained in:
parent
6efbe2d545
commit
d4d6e658ff
@ -175,10 +175,8 @@ interface ITagItemProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TagItem: FC<ITagItemProps> = ({ tag, onClick }) => {
|
const TagItem: FC<ITagItemProps> = ({ tag, onClick }) => {
|
||||||
const isTagTypeColorEnabled = useUiFlag('tagTypeColor');
|
|
||||||
const tagFullText = formatTag(tag);
|
const tagFullText = formatTag(tag);
|
||||||
|
|
||||||
if (isTagTypeColorEnabled) {
|
|
||||||
const tagComponent = (
|
const tagComponent = (
|
||||||
<Box onClick={() => onClick(tag)} sx={{ cursor: 'pointer' }}>
|
<Box onClick={() => onClick(tag)} sx={{ cursor: 'pointer' }}>
|
||||||
<Tag tag={tag} maxLength={30} />
|
<Tag tag={tag} maxLength={30} />
|
||||||
@ -190,32 +188,12 @@ const TagItem: FC<ITagItemProps> = ({ tag, onClick }) => {
|
|||||||
<span>{tagComponent}</span>
|
<span>{tagComponent}</span>
|
||||||
</HtmlTooltip>
|
</HtmlTooltip>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
// For non-color tags, use the StyledTag approach
|
|
||||||
const isOverflowing = tagFullText.length > 30;
|
|
||||||
const displayText = isOverflowing
|
|
||||||
? `${tagFullText.substring(0, 30)}...`
|
|
||||||
: tagFullText;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledTag
|
|
||||||
key={tagFullText}
|
|
||||||
label={displayText}
|
|
||||||
size='small'
|
|
||||||
onClick={() => onClick(tag)}
|
|
||||||
sx={{ cursor: 'pointer' }}
|
|
||||||
title={isOverflowing ? tagFullText : undefined}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const RestTags: FC<{
|
const RestTags: FC<{
|
||||||
tags: TagSchema[];
|
tags: TagSchema[];
|
||||||
onClick: (tag: string) => void;
|
onClick: (tag: string) => void;
|
||||||
}> = ({ tags, onClick }) => {
|
}> = ({ tags, onClick }) => {
|
||||||
const isTagTypeColorEnabled = useUiFlag('tagTypeColor');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HtmlTooltip
|
<HtmlTooltip
|
||||||
title={tags.map((tag) => {
|
title={tags.map((tag) => {
|
||||||
@ -226,11 +204,7 @@ const RestTags: FC<{
|
|||||||
onClick={() => onClick(formattedTag)}
|
onClick={() => onClick(formattedTag)}
|
||||||
key={formattedTag}
|
key={formattedTag}
|
||||||
>
|
>
|
||||||
{isTagTypeColorEnabled ? (
|
|
||||||
<Tag tag={tag} maxLength={30} />
|
<Tag tag={tag} maxLength={30} />
|
||||||
) : (
|
|
||||||
formattedTag
|
|
||||||
)}
|
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@ -238,9 +212,7 @@ const RestTags: FC<{
|
|||||||
<CustomTagButton
|
<CustomTagButton
|
||||||
sx={{
|
sx={{
|
||||||
cursor: 'initial',
|
cursor: 'initial',
|
||||||
...(isTagTypeColorEnabled && {
|
|
||||||
borderRadius: (theme) => theme.spacing(2),
|
borderRadius: (theme) => theme.spacing(2),
|
||||||
}),
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{tags.length} more...
|
{tags.length} more...
|
||||||
|
@ -162,17 +162,11 @@ interface ITagItemProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const TagItem = ({ tag, canUpdateTags, onTagRemove }: ITagItemProps) => {
|
const TagItem = ({ tag, canUpdateTags, onTagRemove }: ITagItemProps) => {
|
||||||
const isTagTypeColorEnabled = useUiFlag('tagTypeColor');
|
|
||||||
const tagLabel = formatTag(tag);
|
const tagLabel = formatTag(tag);
|
||||||
const isOverflowing = tagLabel.length > 25;
|
const isOverflowing = tagLabel.length > 25;
|
||||||
const deleteIcon = (
|
|
||||||
<Tooltip title='Remove tag' arrow>
|
|
||||||
<DeleteTagIcon />
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
const onDelete = canUpdateTags ? () => onTagRemove(tag) : undefined;
|
const onDelete = canUpdateTags ? () => onTagRemove(tag) : undefined;
|
||||||
|
|
||||||
if (isTagTypeColorEnabled) {
|
|
||||||
const deleteIcon = (
|
const deleteIcon = (
|
||||||
<Tooltip title='Remove tag' arrow>
|
<Tooltip title='Remove tag' arrow>
|
||||||
<ClearIcon sx={{ height: '20px', width: '20px' }} />
|
<ClearIcon sx={{ height: '20px', width: '20px' }} />
|
||||||
@ -182,38 +176,8 @@ const TagItem = ({ tag, canUpdateTags, onTagRemove }: ITagItemProps) => {
|
|||||||
return (
|
return (
|
||||||
<Tooltip key={tagLabel} title={isOverflowing ? tagLabel : ''} arrow>
|
<Tooltip key={tagLabel} title={isOverflowing ? tagLabel : ''} arrow>
|
||||||
<span>
|
<span>
|
||||||
<Tag
|
<Tag tag={tag} onDelete={onDelete} deleteIcon={deleteIcon} />
|
||||||
tag={tag}
|
|
||||||
onDelete={onDelete}
|
|
||||||
deleteIcon={deleteIcon}
|
|
||||||
/>
|
|
||||||
</span>
|
</span>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<StyledTag
|
|
||||||
key={tagLabel}
|
|
||||||
label={
|
|
||||||
<Tooltip
|
|
||||||
key={tagLabel}
|
|
||||||
title={isOverflowing ? tagLabel : ''}
|
|
||||||
arrow
|
|
||||||
>
|
|
||||||
<span>
|
|
||||||
{tagLabel.substring(0, 25)}
|
|
||||||
{isOverflowing ? (
|
|
||||||
<StyledEllipsis>…</StyledEllipsis>
|
|
||||||
) : (
|
|
||||||
''
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
</Tooltip>
|
|
||||||
}
|
|
||||||
size='small'
|
|
||||||
deleteIcon={deleteIcon}
|
|
||||||
onDelete={onDelete}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
@ -25,7 +25,6 @@ const CreateTagType = () => {
|
|||||||
validateNameUniqueness,
|
validateNameUniqueness,
|
||||||
errors,
|
errors,
|
||||||
clearErrors,
|
clearErrors,
|
||||||
isTagTypeColorEnabled,
|
|
||||||
} = useTagTypeForm();
|
} = useTagTypeForm();
|
||||||
const { createTag, loading } = useTagTypesApi();
|
const { createTag, loading } = useTagTypesApi();
|
||||||
|
|
||||||
@ -81,7 +80,6 @@ const CreateTagType = () => {
|
|||||||
mode='Create'
|
mode='Create'
|
||||||
clearErrors={clearErrors}
|
clearErrors={clearErrors}
|
||||||
validateNameUniqueness={validateNameUniqueness}
|
validateNameUniqueness={validateNameUniqueness}
|
||||||
isTagTypeColorEnabled={isTagTypeColorEnabled}
|
|
||||||
>
|
>
|
||||||
<CreateButton name='type' permission={CREATE_TAG_TYPE} />
|
<CreateButton name='type' permission={CREATE_TAG_TYPE} />
|
||||||
</TagTypeForm>
|
</TagTypeForm>
|
||||||
|
@ -28,7 +28,6 @@ const EditTagType = () => {
|
|||||||
getTagPayload,
|
getTagPayload,
|
||||||
errors,
|
errors,
|
||||||
clearErrors,
|
clearErrors,
|
||||||
isTagTypeColorEnabled,
|
|
||||||
} = useTagTypeForm(tagType?.name, tagType?.description, tagType?.color);
|
} = useTagTypeForm(tagType?.name, tagType?.description, tagType?.color);
|
||||||
const { updateTagType, loading } = useTagTypesApi();
|
const { updateTagType, loading } = useTagTypesApi();
|
||||||
|
|
||||||
@ -82,7 +81,6 @@ const EditTagType = () => {
|
|||||||
setColor={setColor}
|
setColor={setColor}
|
||||||
mode='Edit'
|
mode='Edit'
|
||||||
clearErrors={clearErrors}
|
clearErrors={clearErrors}
|
||||||
isTagTypeColorEnabled={isTagTypeColorEnabled}
|
|
||||||
>
|
>
|
||||||
<UpdateButton permission={UPDATE_TAG_TYPE} />
|
<UpdateButton permission={UPDATE_TAG_TYPE} />
|
||||||
</TagForm>
|
</TagForm>
|
||||||
|
@ -4,7 +4,6 @@ import { TagTypeColorPicker } from './TagTypeColorPicker';
|
|||||||
import type React from 'react';
|
import type React from 'react';
|
||||||
import { trim } from 'component/common/util';
|
import { trim } from 'component/common/util';
|
||||||
import { EDIT } from 'constants/misc';
|
import { EDIT } from 'constants/misc';
|
||||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
|
||||||
|
|
||||||
interface ITagTypeForm {
|
interface ITagTypeForm {
|
||||||
tagName: string;
|
tagName: string;
|
||||||
@ -19,7 +18,6 @@ interface ITagTypeForm {
|
|||||||
mode: 'Create' | 'Edit';
|
mode: 'Create' | 'Edit';
|
||||||
clearErrors: () => void;
|
clearErrors: () => void;
|
||||||
validateNameUniqueness?: () => void;
|
validateNameUniqueness?: () => void;
|
||||||
isTagTypeColorEnabled: boolean;
|
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +69,6 @@ const TagTypeForm: React.FC<ITagTypeForm> = ({
|
|||||||
mode,
|
mode,
|
||||||
validateNameUniqueness,
|
validateNameUniqueness,
|
||||||
clearErrors,
|
clearErrors,
|
||||||
isTagTypeColorEnabled,
|
|
||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<StyledForm onSubmit={handleSubmit}>
|
<StyledForm onSubmit={handleSubmit}>
|
||||||
@ -102,10 +99,7 @@ const TagTypeForm: React.FC<ITagTypeForm> = ({
|
|||||||
value={tagDesc}
|
value={tagDesc}
|
||||||
onChange={(e) => setTagDesc(e.target.value)}
|
onChange={(e) => setTagDesc(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
|
||||||
condition={isTagTypeColorEnabled}
|
|
||||||
show={
|
|
||||||
<>
|
|
||||||
<Typography variant='body2'>
|
<Typography variant='body2'>
|
||||||
Tag color
|
Tag color
|
||||||
<TagTypeColorPicker
|
<TagTypeColorPicker
|
||||||
@ -113,9 +107,6 @@ const TagTypeForm: React.FC<ITagTypeForm> = ({
|
|||||||
onChange={setColor}
|
onChange={setColor}
|
||||||
/>
|
/>
|
||||||
</Typography>
|
</Typography>
|
||||||
</>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</StyledContainer>
|
</StyledContainer>
|
||||||
<StyledButtonContainer>
|
<StyledButtonContainer>
|
||||||
{children}
|
{children}
|
||||||
|
@ -19,7 +19,6 @@ const useTagTypeForm = (
|
|||||||
const [color, setColor] = useState(initialColor);
|
const [color, setColor] = useState(initialColor);
|
||||||
const [errors, setErrors] = useState({});
|
const [errors, setErrors] = useState({});
|
||||||
const { validateTagName } = useTagTypesApi();
|
const { validateTagName } = useTagTypesApi();
|
||||||
const isTagTypeColorEnabled = Boolean(useUiFlag('tagTypeColor'));
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setTagName(initialTagName);
|
setTagName(initialTagName);
|
||||||
@ -37,12 +36,9 @@ const useTagTypeForm = (
|
|||||||
const payload: TagTypePayload = {
|
const payload: TagTypePayload = {
|
||||||
name: tagName,
|
name: tagName,
|
||||||
description: tagDesc,
|
description: tagDesc,
|
||||||
|
color: color,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isTagTypeColorEnabled && color) {
|
|
||||||
payload.color = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +81,6 @@ const useTagTypeForm = (
|
|||||||
clearErrors,
|
clearErrors,
|
||||||
validateNameUniqueness,
|
validateNameUniqueness,
|
||||||
errors,
|
errors,
|
||||||
isTagTypeColorEnabled,
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +57,6 @@ export const TagTypeList = () => {
|
|||||||
const { deleteTagType } = useTagTypesApi();
|
const { deleteTagType } = useTagTypesApi();
|
||||||
const { tagTypes, refetch, loading } = useTagTypes();
|
const { tagTypes, refetch, loading } = useTagTypes();
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const isTagTypeColorEnabled = Boolean(useUiFlag('tagTypeColor'));
|
|
||||||
|
|
||||||
const data = useMemo(() => {
|
const data = useMemo(() => {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@ -105,9 +104,7 @@ export const TagTypeList = () => {
|
|||||||
return (
|
return (
|
||||||
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
<Box sx={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={
|
condition={Boolean(color)}
|
||||||
isTagTypeColorEnabled && Boolean(color)
|
|
||||||
}
|
|
||||||
show={<StyledColorDot $color={color} />}
|
show={<StyledColorDot $color={color} />}
|
||||||
/>
|
/>
|
||||||
<LinkCell
|
<LinkCell
|
||||||
@ -162,7 +159,7 @@ export const TagTypeList = () => {
|
|||||||
disableSortBy: true,
|
disableSortBy: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[navigate, isTagTypeColorEnabled],
|
[navigate],
|
||||||
);
|
);
|
||||||
|
|
||||||
const initialState = useMemo(
|
const initialState = useMemo(
|
||||||
|
@ -88,7 +88,6 @@ export type UiFlags = {
|
|||||||
showUserDeviceCount?: boolean;
|
showUserDeviceCount?: boolean;
|
||||||
consumptionModel?: boolean;
|
consumptionModel?: boolean;
|
||||||
edgeObservability?: boolean;
|
edgeObservability?: boolean;
|
||||||
tagTypeColor?: boolean;
|
|
||||||
addEditStrategy?: boolean;
|
addEditStrategy?: boolean;
|
||||||
flagsReleaseManagementUI?: boolean;
|
flagsReleaseManagementUI?: boolean;
|
||||||
cleanupReminder?: boolean;
|
cleanupReminder?: boolean;
|
||||||
|
@ -58,7 +58,6 @@ export type IFlagKey =
|
|||||||
| 'consumptionModel'
|
| 'consumptionModel'
|
||||||
| 'teamsIntegrationChangeRequests'
|
| 'teamsIntegrationChangeRequests'
|
||||||
| 'edgeObservability'
|
| 'edgeObservability'
|
||||||
| 'tagTypeColor'
|
|
||||||
| 'addEditStrategy'
|
| 'addEditStrategy'
|
||||||
| 'flagsOverviewSearch'
|
| 'flagsOverviewSearch'
|
||||||
| 'flagsReleaseManagementUI'
|
| 'flagsReleaseManagementUI'
|
||||||
@ -280,10 +279,6 @@ const flags: IFlags = {
|
|||||||
process.env.EXPERIMENTAL_EDGE_OBSERVABILITY,
|
process.env.EXPERIMENTAL_EDGE_OBSERVABILITY,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
tagTypeColor: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_TAG_TYPE_COLOR,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
addEditStrategy: parseEnvVarBoolean(
|
addEditStrategy: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_ADD_EDIT_STRATEGY,
|
process.env.UNLEASH_EXPERIMENTAL_ADD_EDIT_STRATEGY,
|
||||||
false,
|
false,
|
||||||
|
@ -52,7 +52,6 @@ process.nextTick(async () => {
|
|||||||
uniqueSdkTracking: true,
|
uniqueSdkTracking: true,
|
||||||
filterExistingFlagNames: true,
|
filterExistingFlagNames: true,
|
||||||
teamsIntegrationChangeRequests: true,
|
teamsIntegrationChangeRequests: true,
|
||||||
tagTypeColor: true,
|
|
||||||
addEditStrategy: true,
|
addEditStrategy: true,
|
||||||
flagsOverviewSearch: true,
|
flagsOverviewSearch: true,
|
||||||
cleanupReminder: true,
|
cleanupReminder: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user