Brijesh619 commented on code in PR #703:
URL: https://github.com/apache/atlas/pull/703#discussion_r3926945412
##########
dashboard/src/views/Statistics/EntityStatsChart.tsx:
##########
@@ -56,6 +58,37 @@ const EntityStatsChart = ({
onLegendClick,
getColorForKey,
}: EntityStatsChartProps) => {
+ const legendPayload = useMemo(() => {
+ return Object.keys(activeKeys).map((key) => ({
+ id: key,
+ value: key,
+ color: activeKeys[key as keyof ActiveKeys] === true ?
getColorForKey(key) : "#d3d3d3",
+ inactive: !activeKeys[key as keyof ActiveKeys],
+ }));
+ }, [activeKeys, getColorForKey]);
+
+ const renderLegend = useCallback(
+ () => (
+ <Stack direction="row" spacing={2}
justifyContent="center" mt={1}>
+ {legendPayload.map((entry) => (
+ <ButtonBase
+ key={entry.id}
+
data-testid={`legend-${entry.id}`}
+ onClick={() =>
onLegendClick(String(entry.value))}
+ aria-label={String(entry.value)}
+ className="legend-button"
+ >
+ <Box
className="legend-color-box" style={{ backgroundColor: entry.color }} />
Review Comment:
Refactored `.legend-color-box` to use CSS custom property `style={{
'--legend-color': entry.color }}` in `EntityStatsChart.tsx` combined with
`background-color: var(--legend-color, #d3d3d3)` in `stats.scss`. Updated unit
test assertions accordingly.
##########
dashboard/src/views/DashboardOverview/EntityStatusDonut.tsx:
##########
@@ -147,19 +106,20 @@ const EntityStatusDonut = memo(({ entity, isLoading }:
EntityStatusDonutProps) =
isAnimationActive
animationDuration={800}
animationEasing="ease-out"
-
activeIndex={activeIndex}
-
activeShape={renderActiveShape}
- onMouseEnter={(_,
index) => setActiveIndex(index)}
- onMouseLeave={() =>
setActiveIndex(-1)}
- onClick={(data) =>
handleStatusClick(data.name as "Active" | "Shell" | "Deleted")}
+ onClick={(data:
unknown) => {
Review Comment:
Updated `EntityStatusDonut.tsx` to use
`getPayloadFromRechartsEvent<StatusDonutDataItem>` in `handlePieClick` instead
of inline type casting, aligning it with `EntityTypeBarChart` and
`ClassificationDistributionCard`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]