mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: archived row styling (#8608)
1. Added badge 2. Added archived row styling. Button not clickable and gray 
This commit is contained in:
		
							parent
							
								
									5033ed6b45
								
							
						
					
					
						commit
						90ed7b6079
					
				@ -17,6 +17,7 @@ test('Preview parent feature', async () => {
 | 
				
			|||||||
            feature='featureA'
 | 
					            feature='featureA'
 | 
				
			||||||
            project='default'
 | 
					            project='default'
 | 
				
			||||||
            type='release'
 | 
					            type='release'
 | 
				
			||||||
 | 
					            archivedAt={null}
 | 
				
			||||||
            searchQuery=''
 | 
					            searchQuery=''
 | 
				
			||||||
            dependencyType='child'
 | 
					            dependencyType='child'
 | 
				
			||||||
            onTypeClick={() => {}}
 | 
					            onTypeClick={() => {}}
 | 
				
			||||||
@ -44,6 +45,7 @@ test('Preview child features', async () => {
 | 
				
			|||||||
            feature='featureA'
 | 
					            feature='featureA'
 | 
				
			||||||
            project='default'
 | 
					            project='default'
 | 
				
			||||||
            type='release'
 | 
					            type='release'
 | 
				
			||||||
 | 
					            archivedAt={null}
 | 
				
			||||||
            searchQuery=''
 | 
					            searchQuery=''
 | 
				
			||||||
            dependencyType='parent'
 | 
					            dependencyType='parent'
 | 
				
			||||||
            onTypeClick={() => {}}
 | 
					            onTypeClick={() => {}}
 | 
				
			||||||
 | 
				
			|||||||
@ -22,6 +22,7 @@ test('Display full overview information', () => {
 | 
				
			|||||||
                    type: 'release',
 | 
					                    type: 'release',
 | 
				
			||||||
                    dependencyType: 'child',
 | 
					                    dependencyType: 'child',
 | 
				
			||||||
                    project: 'my_project',
 | 
					                    project: 'my_project',
 | 
				
			||||||
 | 
					                    archivedAt: null,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            }}
 | 
					            }}
 | 
				
			||||||
        />,
 | 
					        />,
 | 
				
			||||||
@ -54,6 +55,7 @@ test('Display minimal overview information', () => {
 | 
				
			|||||||
                    type: '',
 | 
					                    type: '',
 | 
				
			||||||
                    dependencyType: null,
 | 
					                    dependencyType: null,
 | 
				
			||||||
                    project: 'my_project',
 | 
					                    project: 'my_project',
 | 
				
			||||||
 | 
					                    archivedAt: null,
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
            }}
 | 
					            }}
 | 
				
			||||||
        />,
 | 
					        />,
 | 
				
			||||||
@ -65,3 +67,26 @@ test('Display minimal overview information', () => {
 | 
				
			|||||||
        '/projects/my_project/features/my_feature',
 | 
					        '/projects/my_project/features/my_feature',
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test('show archived information', () => {
 | 
				
			||||||
 | 
					    const FeatureOverviewCell = makeFeatureOverviewCell(noOp, noOp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    render(
 | 
				
			||||||
 | 
					        <FeatureOverviewCell
 | 
				
			||||||
 | 
					            row={{
 | 
				
			||||||
 | 
					                original: {
 | 
				
			||||||
 | 
					                    name: 'archived_feature',
 | 
				
			||||||
 | 
					                    tags: [],
 | 
				
			||||||
 | 
					                    description: '',
 | 
				
			||||||
 | 
					                    type: '',
 | 
				
			||||||
 | 
					                    dependencyType: null,
 | 
				
			||||||
 | 
					                    project: 'my_project',
 | 
				
			||||||
 | 
					                    archivedAt: '2024-11-09',
 | 
				
			||||||
 | 
					                },
 | 
				
			||||||
 | 
					            }}
 | 
				
			||||||
 | 
					        />,
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    expect(screen.getByText('archived_feature')).toBeInTheDocument();
 | 
				
			||||||
 | 
					    expect(screen.getByText('Archived')).toBeInTheDocument();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
				
			|||||||
@ -22,6 +22,7 @@ interface IFeatureNameCellProps {
 | 
				
			|||||||
            | 'tags'
 | 
					            | 'tags'
 | 
				
			||||||
            | 'type'
 | 
					            | 'type'
 | 
				
			||||||
            | 'dependencyType'
 | 
					            | 'dependencyType'
 | 
				
			||||||
 | 
					            | 'archivedAt'
 | 
				
			||||||
        >;
 | 
					        >;
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -138,6 +139,22 @@ const FeatureName: FC<{
 | 
				
			|||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					const ArchivedFeatureName: FC<{
 | 
				
			||||||
 | 
					    feature: string;
 | 
				
			||||||
 | 
					    searchQuery: string;
 | 
				
			||||||
 | 
					}> = ({ feature, searchQuery }) => {
 | 
				
			||||||
 | 
					    return (
 | 
				
			||||||
 | 
					        <Box
 | 
				
			||||||
 | 
					            sx={(theme) => ({
 | 
				
			||||||
 | 
					                fontWeight: theme.typography.fontWeightBold,
 | 
				
			||||||
 | 
					                color: theme.palette.neutral.main,
 | 
				
			||||||
 | 
					            })}
 | 
				
			||||||
 | 
					        >
 | 
				
			||||||
 | 
					            <Highlighter search={searchQuery}>{feature}</Highlighter>
 | 
				
			||||||
 | 
					        </Box>
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const RestTags: FC<{ tags: string[]; onClick: (tag: string) => void }> = ({
 | 
					const RestTags: FC<{ tags: string[]; onClick: (tag: string) => void }> = ({
 | 
				
			||||||
    tags,
 | 
					    tags,
 | 
				
			||||||
    onClick,
 | 
					    onClick,
 | 
				
			||||||
@ -236,6 +253,7 @@ const DependencyPreview: FC<{ feature: string; project: string }> = ({
 | 
				
			|||||||
export const PrimaryFeatureInfo: FC<{
 | 
					export const PrimaryFeatureInfo: FC<{
 | 
				
			||||||
    project: string;
 | 
					    project: string;
 | 
				
			||||||
    feature: string;
 | 
					    feature: string;
 | 
				
			||||||
 | 
					    archivedAt: string | null;
 | 
				
			||||||
    searchQuery: string;
 | 
					    searchQuery: string;
 | 
				
			||||||
    type: string;
 | 
					    type: string;
 | 
				
			||||||
    dependencyType: string;
 | 
					    dependencyType: string;
 | 
				
			||||||
@ -244,6 +262,7 @@ export const PrimaryFeatureInfo: FC<{
 | 
				
			|||||||
}> = ({
 | 
					}> = ({
 | 
				
			||||||
    project,
 | 
					    project,
 | 
				
			||||||
    feature,
 | 
					    feature,
 | 
				
			||||||
 | 
					    archivedAt,
 | 
				
			||||||
    type,
 | 
					    type,
 | 
				
			||||||
    searchQuery,
 | 
					    searchQuery,
 | 
				
			||||||
    dependencyType,
 | 
					    dependencyType,
 | 
				
			||||||
@ -275,11 +294,19 @@ export const PrimaryFeatureInfo: FC<{
 | 
				
			|||||||
    return (
 | 
					    return (
 | 
				
			||||||
        <FeatureNameAndType data-loading>
 | 
					        <FeatureNameAndType data-loading>
 | 
				
			||||||
            <TypeIcon />
 | 
					            <TypeIcon />
 | 
				
			||||||
            <FeatureName
 | 
					            {archivedAt ? (
 | 
				
			||||||
                project={project}
 | 
					                <ArchivedFeatureName
 | 
				
			||||||
                feature={feature}
 | 
					                    feature={feature}
 | 
				
			||||||
                searchQuery={searchQuery}
 | 
					                    searchQuery={searchQuery}
 | 
				
			||||||
            />
 | 
					                />
 | 
				
			||||||
 | 
					            ) : (
 | 
				
			||||||
 | 
					                <FeatureName
 | 
				
			||||||
 | 
					                    project={project}
 | 
				
			||||||
 | 
					                    feature={feature}
 | 
				
			||||||
 | 
					                    searchQuery={searchQuery}
 | 
				
			||||||
 | 
					                />
 | 
				
			||||||
 | 
					            )}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            <ConditionallyRender
 | 
					            <ConditionallyRender
 | 
				
			||||||
                condition={Boolean(dependencyType)}
 | 
					                condition={Boolean(dependencyType)}
 | 
				
			||||||
                show={
 | 
					                show={
 | 
				
			||||||
@ -305,6 +332,11 @@ export const PrimaryFeatureInfo: FC<{
 | 
				
			|||||||
                    </HtmlTooltip>
 | 
					                    </HtmlTooltip>
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            />
 | 
					            />
 | 
				
			||||||
 | 
					            {archivedAt && (
 | 
				
			||||||
 | 
					                <HtmlTooltip arrow title={archivedAt} describeChild>
 | 
				
			||||||
 | 
					                    <Badge color='neutral'>Archived</Badge>
 | 
				
			||||||
 | 
					                </HtmlTooltip>
 | 
				
			||||||
 | 
					            )}
 | 
				
			||||||
        </FeatureNameAndType>
 | 
					        </FeatureNameAndType>
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
@ -343,6 +375,7 @@ export const FeatureOverviewCell =
 | 
				
			|||||||
                <PrimaryFeatureInfo
 | 
					                <PrimaryFeatureInfo
 | 
				
			||||||
                    project={row.original.project || ''}
 | 
					                    project={row.original.project || ''}
 | 
				
			||||||
                    feature={row.original.name}
 | 
					                    feature={row.original.name}
 | 
				
			||||||
 | 
					                    archivedAt={row.original.archivedAt}
 | 
				
			||||||
                    searchQuery={searchQuery}
 | 
					                    searchQuery={searchQuery}
 | 
				
			||||||
                    type={row.original.type || ''}
 | 
					                    type={row.original.type || ''}
 | 
				
			||||||
                    dependencyType={row.original.dependencyType || ''}
 | 
					                    dependencyType={row.original.dependencyType || ''}
 | 
				
			||||||
 | 
				
			|||||||
@ -389,6 +389,7 @@ export const ProjectFeatureToggles = ({
 | 
				
			|||||||
                    project: 'project',
 | 
					                    project: 'project',
 | 
				
			||||||
                    segments: [],
 | 
					                    segments: [],
 | 
				
			||||||
                    stale: false,
 | 
					                    stale: false,
 | 
				
			||||||
 | 
					                    archivedAt: null,
 | 
				
			||||||
                    environments: [
 | 
					                    environments: [
 | 
				
			||||||
                        {
 | 
					                        {
 | 
				
			||||||
                            name: 'development',
 | 
					                            name: 'development',
 | 
				
			||||||
 | 
				
			|||||||
@ -19,7 +19,7 @@ export interface FeatureSearchResponseSchema {
 | 
				
			|||||||
     * The date the feature was archived
 | 
					     * The date the feature was archived
 | 
				
			||||||
     * @nullable
 | 
					     * @nullable
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    archivedAt?: string | null;
 | 
					    archivedAt: string | null;
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * The date the feature was created
 | 
					     * The date the feature was created
 | 
				
			||||||
     * @nullable
 | 
					     * @nullable
 | 
				
			||||||
 | 
				
			|||||||
@ -25,6 +25,7 @@ export const featureSearchResponseSchema = {
 | 
				
			|||||||
        'createdBy',
 | 
					        'createdBy',
 | 
				
			||||||
        'environments',
 | 
					        'environments',
 | 
				
			||||||
        'segments',
 | 
					        'segments',
 | 
				
			||||||
 | 
					        'archivedAt',
 | 
				
			||||||
    ],
 | 
					    ],
 | 
				
			||||||
    description: 'A feature flag definition',
 | 
					    description: 'A feature flag definition',
 | 
				
			||||||
    properties: {
 | 
					    properties: {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user