Skip to content

Commit

Permalink
fix: show all selected application names (#6110)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew authored Feb 2, 2024
1 parent fbb5733 commit 1834f9f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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>;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down Expand Up @@ -103,6 +104,7 @@ const COLUMNS = [
{
Header: 'Application',
accessor: 'appName',
Cell: ApplicationsCell,
},
{
Header: 'Environment',
Expand Down

0 comments on commit 1834f9f

Please sign in to comment.