1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

fix: show all selected application names (#6110)

This commit is contained in:
Mateusz Kwasniewski 2024-02-02 11:35:00 +01:00 committed by GitHub
parent fbb5733f18
commit 1834f9f8bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 55 additions and 1 deletions

View File

@ -79,7 +79,14 @@ export const FeatureMetrics = () => {
.filter((metric) =>
selectedApplications.includes(metric.appName),
) || [],
);
).map((metric) => ({
...metric,
appName:
selectedApplications.length > 1
? 'all selected'
: metric.appName,
selectedApplications,
}));
}, [
cachedMetrics,
selectedEnvironment,

View File

@ -0,0 +1,45 @@
import { VFC } from 'react';
import { styled, Typography } from '@mui/material';
import { TooltipLink } from 'component/common/TooltipLink/TooltipLink';
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
const StyledTag = styled(Typography)(({ theme }) => ({
fontSize: theme.fontSizes.smallerBody,
}));
interface IFeatureTagCellProps {
row: {
original: {
appName: string;
selectedApplications: string[];
};
};
}
export const ApplicationsCell: VFC<IFeatureTagCellProps> = ({ row }) => {
if (
row.original.selectedApplications &&
row.original.selectedApplications.length > 1
) {
return (
<TextCell>
<TooltipLink
tooltip={
<>
{row.original.selectedApplications.map(
(appName) => (
<StyledTag key={appName}>
{appName}
</StyledTag>
),
)}
</>
}
>
{row.original.appName}
</TooltipLink>
</TextCell>
);
}
return <TextCell>{row.original.appName}</TextCell>;
};

View File

@ -9,6 +9,7 @@ import { useMemo } from 'react';
import { TextCell } from 'component/common/Table/cells/TextCell/TextCell';
import theme from 'themes/theme';
import { useConditionallyHiddenColumns } from 'hooks/useConditionallyHiddenColumns';
import { ApplicationsCell } from './ApplicationsCell';
interface IFeatureMetricsTableProps {
metrics: IFeatureMetricsRaw[];
@ -103,6 +104,7 @@ const COLUMNS = [
{
Header: 'Application',
accessor: 'appName',
Cell: ApplicationsCell,
},
{
Header: 'Environment',