This is an automated email from the ASF dual-hosted git repository. vogievetsky pushed a commit to branch segment_timeline2 in repository https://gitbox.apache.org/repos/asf/druid.git
commit 109022c4c4ec8c1310dba2ccf982139b902a4174 Author: Vadim Ogievetsky <[email protected]> AuthorDate: Mon Nov 4 16:12:10 2024 -0800 normalize to days --- .../src/components/segment-timeline/common.ts | 2 +- .../segment-timeline/segment-bar-chart-render.tsx | 23 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/web-console/src/components/segment-timeline/common.ts b/web-console/src/components/segment-timeline/common.ts index 7371aada27f..69a1d20c457 100644 --- a/web-console/src/components/segment-timeline/common.ts +++ b/web-console/src/components/segment-timeline/common.ts @@ -58,7 +58,7 @@ export interface IntervalRow extends Record<IntervalStat, number> { } export interface TrimmedIntervalRow extends IntervalRow { - shownSeconds: number; + shownDays: number; normalized: Record<IntervalStat, number>; } diff --git a/web-console/src/components/segment-timeline/segment-bar-chart-render.tsx b/web-console/src/components/segment-timeline/segment-bar-chart-render.tsx index 0152188e8e2..dbf8302d109 100644 --- a/web-console/src/components/segment-timeline/segment-bar-chart-render.tsx +++ b/web-console/src/components/segment-timeline/segment-bar-chart-render.tsx @@ -22,7 +22,7 @@ import classNames from 'classnames'; import { max } from 'd3-array'; import { axisBottom, axisLeft } from 'd3-axis'; import { scaleLinear, scaleUtc } from 'd3-scale'; -import type { ReactNode } from 'react'; +import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react'; import { useMemo, useRef, useState } from 'react'; import { getDatasourceColor } from '../../druid-models'; @@ -69,8 +69,8 @@ function offsetDateRange(dateRange: NonNullDateRange, offset: number): NonNullDa function stackIntervalRows(trimmedIntervalRows: TrimmedIntervalRow[]): IntervalBar[] { const sortedIntervalRows = trimmedIntervalRows.sort((a, b) => { - const shownSecondsDiff = b.shownSeconds - a.shownSeconds; - if (shownSecondsDiff) return shownSecondsDiff; + const shownDaysDiff = b.shownDays - a.shownDays; + if (shownDaysDiff) return shownDaysDiff; const timeSpanDiff = b.originalTimeSpan.getCanonicalLength() - a.originalTimeSpan.getCanonicalLength(); @@ -142,16 +142,16 @@ export const SegmentBarChartRender = function SegmentBarChartRender( if (focusDatasource && intervalRow.datasource !== focusDatasource) return; const start = trimDuration.floor(intervalRow.start, TZ_UTC); const end = trimDuration.ceil(intervalRow.end, TZ_UTC); - const shownSeconds = (end.valueOf() - start.valueOf()) / 1000; + const shownDays = (end.valueOf() - start.valueOf()) / day.canonicalLength; return { ...intervalRow, start, end, - shownSeconds: (end.valueOf() - start.valueOf()) / 1000, + shownDays, normalized: { - segments: intervalRow.segments / shownSeconds, - size: intervalRow.size / shownSeconds, - rows: intervalRow.rows / shownSeconds, + segments: intervalRow.segments / shownDays, + size: intervalRow.size / shownDays, + rows: intervalRow.rows / shownDays, }, }; }); @@ -208,20 +208,19 @@ export const SegmentBarChartRender = function SegmentBarChartRender( }; const formatTickRate = (n: number) => { - n = (n * new Duration(trimGranularity).getCanonicalLength()) / 1000; switch (shownIntervalStat) { case 'segments': - return formatNumber(n) + ' seg/s'; + return formatNumber(n); // + ' seg/day'; case 'rows': - return formatNumber(n) + ' row/s'; + return formatNumber(n); // + ' row/day'; case 'size': return formatBytes(n); } }; - function handleMouseDown(e: React.MouseEvent) { + function handleMouseDown(e: ReactMouseEvent) { const svg = svgRef.current; if (!svg || hoveredIntervalBar) return; e.preventDefault(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
