ISSUE-3427_frontend store getValue call in a variable, update percentage view

This commit is contained in:
Nail Badiullin 2023-04-26 10:30:00 +04:00
parent 9c6f561cee
commit 6b86202c97

View file

@ -113,37 +113,46 @@ const BrokersList: React.FC = () => {
header: () => <SkewHeader />,
accessorKey: 'partitionsSkew',
// eslint-disable-next-line react/no-unstable-nested-components
cell: ({ getValue }) => (
cell: ({ getValue }) => {
const value = getValue<number>();
return (
<ColoredCell
value={getValue<number>() !== null ? `${getValue<number>()}%` : '-'}
warn={getValue<number>() >= 10 && getValue<number>() < 20}
attention={getValue<number>() >= 20}
value={value ? `${value.toFixed(2)}%` : '-'}
warn={value >= 10 && value < 20}
attention={value >= 20}
/>
),
);
},
},
{ header: 'Leaders', accessorKey: 'partitionsLeader' },
{
header: 'Leader skew',
accessorKey: 'leadersSkew',
// eslint-disable-next-line react/no-unstable-nested-components
cell: ({ getValue }) => (
cell: ({ getValue }) => {
const value = getValue<number>();
return (
<ColoredCell
value={getValue<number>() !== null ? `${getValue<number>()}%` : '-'}
warn={getValue<number>() >= 10 && getValue<number>() < 20}
attention={getValue<number>() >= 20}
value={value ? `${value.toFixed(2)}%` : '-'}
warn={value >= 10 && value < 20}
attention={value >= 20}
/>
),
);
},
},
{
header: 'Online partitions',
accessorKey: 'inSyncPartitions',
// eslint-disable-next-line react/no-unstable-nested-components
cell: ({ getValue, row }) => (
cell: ({ getValue, row }) => {
const value = getValue<number>();
return (
<ColoredCell
value={getValue<number>()}
attention={getValue<number>() !== row.original.count}
value={value}
attention={value !== row.original.count}
/>
),
);
},
},
{ header: 'Port', accessorKey: 'port' },
{