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

fix: Health tooltip when all projects should show % (#6809)

What it says on the tin

Closes #
[1-2274](https://linear.app/unleash/issue/1-2274/health-tooltip-when-all-projects-should-show-percent-values)
<img width="945" alt="Screenshot 2024-04-09 at 16 09 34"
src="https://github.com/Unleash/unleash/assets/104830839/5c8fc8d3-bee6-4bf2-976d-de6f3e3013ca">

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
andreas-unleash 2024-04-09 16:20:32 +03:00 committed by GitHub
parent 2b3516dff1
commit 48b8df8f4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,16 +62,19 @@ export const ProjectHealthChart: VFC<IProjectHealthChartProps> = ({
); );
}) })
.sort((a, b) => (a.week > b.week ? 1 : -1)); .sort((a, b) => (a.week > b.week ? 1 : -1));
return { return {
datasets: [ datasets: [
{ {
label: 'Health', label: 'Health',
data: weeks.map((item) => ({ data: weeks.map((item) => ({
health: item.total health: item.total
? ((item.total - item.stale) / item.total) * 100 ? (
((item.total - item.stale) / item.total) *
100
).toFixed(2)
: undefined, : undefined,
date: item.date, date: item.date,
total: item.total,
})), })),
borderColor: theme.palette.primary.light, borderColor: theme.palette.primary.light,
backgroundColor: fillGradientPrimary, backgroundColor: fillGradientPrimary,
@ -93,7 +96,7 @@ export const ProjectHealthChart: VFC<IProjectHealthChartProps> = ({
<LineChart <LineChart
key={isAggregate ? 'aggregate' : 'project'} key={isAggregate ? 'aggregate' : 'project'}
data={data} data={data}
TooltipComponent={isAggregate ? undefined : HealthTooltip} TooltipComponent={HealthTooltip}
overrideOptions={ overrideOptions={
notEnoughData notEnoughData
? {} ? {}