mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 23:47:12 +00:00
* refactor: initial setup * refactor: created panelWrapper to separate panel data * fix: type error * fix: the dimension issue for graphs * refactor: done with table value uplot panels * refactor: done with logs panel component * refactor: updated props for log panel component * fix: query range duplicate issue for logs * refactor: trace list view done * fix: full view support * refactor: done with edit mode for panels * refactor: type and props * refactor: reduce an extra api call on edit for list view * refactor: done with full graph visibility handler * refactor: removed commented code * refactor: removed commented code * fix: build failure * refactor: updated service layer graphs * refactor: updated top level oparation query key * refactor: added drag select * refactor: done with drag select in chart * refactor: code cleanup * refactor: legend should not need stage and run query
74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
import { ToggleGraphProps } from 'components/Graph/types';
|
|
import { getComponentForPanelType } from 'constants/panelTypes';
|
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
|
import { GRID_TABLE_CONFIG } from 'container/GridTableComponent/config';
|
|
import { FC, forwardRef, memo, useMemo } from 'react';
|
|
|
|
import { GridPanelSwitchProps, PropsTypePropsMap } from './types';
|
|
|
|
const GridPanelSwitch = forwardRef<
|
|
ToggleGraphProps | undefined,
|
|
GridPanelSwitchProps
|
|
>(
|
|
(
|
|
{
|
|
panelType,
|
|
data,
|
|
yAxisUnit,
|
|
panelData,
|
|
query,
|
|
options,
|
|
thresholds,
|
|
dataSource,
|
|
},
|
|
ref,
|
|
): JSX.Element | null => {
|
|
const currentProps: PropsTypePropsMap = useMemo(() => {
|
|
const result: PropsTypePropsMap = {
|
|
[PANEL_TYPES.TIME_SERIES]: {
|
|
data,
|
|
options,
|
|
ref,
|
|
},
|
|
[PANEL_TYPES.VALUE]: {
|
|
data,
|
|
yAxisUnit,
|
|
thresholds,
|
|
},
|
|
[PANEL_TYPES.TABLE]: {
|
|
...GRID_TABLE_CONFIG,
|
|
data: panelData,
|
|
query,
|
|
thresholds,
|
|
},
|
|
[PANEL_TYPES.LIST]: null,
|
|
[PANEL_TYPES.TRACE]: null,
|
|
[PANEL_TYPES.BAR]: {
|
|
data,
|
|
options,
|
|
ref,
|
|
},
|
|
[PANEL_TYPES.EMPTY_WIDGET]: null,
|
|
};
|
|
|
|
return result;
|
|
}, [data, options, ref, yAxisUnit, thresholds, panelData, query]);
|
|
|
|
const Component = getComponentForPanelType(panelType, dataSource) as FC<
|
|
PropsTypePropsMap[typeof panelType]
|
|
>;
|
|
const componentProps = useMemo(() => currentProps[panelType], [
|
|
panelType,
|
|
currentProps,
|
|
]);
|
|
|
|
if (!Component || !componentProps) return null;
|
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
return <Component {...componentProps} />;
|
|
},
|
|
);
|
|
|
|
GridPanelSwitch.displayName = 'GridPanelSwitch';
|
|
|
|
export default memo(GridPanelSwitch);
|