mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 00:05:53 +08:00
bug: timeline interval is updated
This commit is contained in:
parent
fb3dbcf662
commit
8e4f987cf6
@ -1,36 +1,25 @@
|
|||||||
import React, { useState, useMemo } from 'react';
|
import React, { useState, useMemo, useEffect } from 'react';
|
||||||
import { isEqual } from 'lodash-es';
|
|
||||||
import styles from './style.module.css';
|
import styles from './style.module.css';
|
||||||
import { useMeasure } from 'react-use';
|
import { useMeasure } from 'react-use';
|
||||||
import { toFixed } from 'utils/toFixed';
|
import { INTERVAL_UNITS } from 'container/TraceDetail/utils';
|
||||||
import {
|
|
||||||
INTERVAL_UNITS,
|
|
||||||
resolveTimeFromInterval,
|
|
||||||
} from 'container/TraceDetail/utils';
|
|
||||||
import useThemeMode from 'hooks/useThemeMode';
|
import useThemeMode from 'hooks/useThemeMode';
|
||||||
import { Interval } from './types';
|
import { Interval } from './types';
|
||||||
import { getIntervalSpread, getIntervals } from './utils';
|
import { getIntervalSpread, getIntervals } from './utils';
|
||||||
interface TimelineProps {
|
|
||||||
traceMetaData: object;
|
const Timeline_Height = 22;
|
||||||
globalTraceMetadata: object;
|
const Timeline_H_Spacing = 0;
|
||||||
intervalUnit: object;
|
|
||||||
setIntervalUnit: Function;
|
|
||||||
}
|
|
||||||
const Timeline = ({
|
const Timeline = ({
|
||||||
traceMetaData,
|
traceMetaData,
|
||||||
globalTraceMetadata,
|
globalTraceMetadata,
|
||||||
intervalUnit,
|
|
||||||
setIntervalUnit,
|
setIntervalUnit,
|
||||||
}: TimelineProps) => {
|
}: TimelineProps) => {
|
||||||
const [ref, { width }] = useMeasure<HTMLDivElement>();
|
const [ref, { width }] = useMeasure<HTMLDivElement>();
|
||||||
const { isDarkMode } = useThemeMode();
|
const { isDarkMode } = useThemeMode();
|
||||||
|
|
||||||
const Timeline_Height = 22;
|
|
||||||
const Timeline_H_Spacing = 0;
|
|
||||||
|
|
||||||
const [intervals, setIntervals] = useState<Interval[] | null>(null);
|
const [intervals, setIntervals] = useState<Interval[] | null>(null);
|
||||||
|
|
||||||
useMemo(() => {
|
useEffect(() => {
|
||||||
const {
|
const {
|
||||||
baseInterval,
|
baseInterval,
|
||||||
baseSpread,
|
baseSpread,
|
||||||
@ -44,7 +33,7 @@ const Timeline = ({
|
|||||||
for (const idx in INTERVAL_UNITS) {
|
for (const idx in INTERVAL_UNITS) {
|
||||||
const standard_interval = INTERVAL_UNITS[idx];
|
const standard_interval = INTERVAL_UNITS[idx];
|
||||||
if (baseSpread * standard_interval.multiplier < 1) {
|
if (baseSpread * standard_interval.multiplier < 1) {
|
||||||
intervalUnit = INTERVAL_UNITS[idx - 1];
|
intervalUnit = INTERVAL_UNITS[idx];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +47,7 @@ const Timeline = ({
|
|||||||
intervalUnit,
|
intervalUnit,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
}, [traceMetaData, globalTraceMetadata]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={ref} style={{ flex: 1, overflow: 'inherit' }}>
|
<div ref={ref} style={{ flex: 1, overflow: 'inherit' }}>
|
||||||
@ -102,4 +91,11 @@ const Timeline = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface TimelineProps {
|
||||||
|
traceMetaData: object;
|
||||||
|
globalTraceMetadata: object;
|
||||||
|
intervalUnit: object;
|
||||||
|
setIntervalUnit: Function;
|
||||||
|
}
|
||||||
|
|
||||||
export default Timeline;
|
export default Timeline;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user