mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Refactor GanttChart components and update title and description types to support React elements
This commit is contained in:
@@ -5,8 +5,8 @@ import Bar, { GanttChartBar } from '../Bar/Index';
|
||||
export interface GanttChartRow {
|
||||
rowInfo: {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
title: string | ReactElement;
|
||||
description: string | ReactElement;
|
||||
};
|
||||
childRows: GanttChartRow[];
|
||||
bars: Array<GanttChartBar>; // usually will have only one bar, this is for future proofing
|
||||
@@ -25,11 +25,11 @@ export interface ComponentProps {
|
||||
const Row: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
|
||||
type GetRowFunction = (data: { row: GanttChartRow }) => ReactElement;
|
||||
|
||||
const getRow: GetRowFunction = (data: { row: GanttChartRow }): ReactElement => {
|
||||
const getRow: GetRowFunction = (data: {
|
||||
row: GanttChartRow;
|
||||
}): ReactElement => {
|
||||
const { row } = data;
|
||||
|
||||
return (
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import React, { FunctionComponent, ReactElement } from 'react';
|
||||
|
||||
export interface ComponentProps {
|
||||
title: string;
|
||||
description: string;
|
||||
title: string | ReactElement;
|
||||
description: string | ReactElement;
|
||||
}
|
||||
|
||||
const RowLabel: FunctionComponent<ComponentProps> = (
|
||||
|
||||
@@ -13,10 +13,11 @@ export interface ComponentProps {
|
||||
const Rows: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
|
||||
type GetRowFunction = (data: { row: GanttChartRow }) => ReactElement;
|
||||
|
||||
const getRow: GetRowFunction = (data: { row: GanttChartRow }): ReactElement => {
|
||||
const getRow: GetRowFunction = (data: {
|
||||
row: GanttChartRow;
|
||||
}): ReactElement => {
|
||||
const { row } = data;
|
||||
|
||||
return (
|
||||
|
||||
@@ -26,6 +26,7 @@ import { GanttChartBar } from 'CommonUI/src/Components/GanttChart/Bar/Index';
|
||||
import { GanttChartRow } from 'CommonUI/src/Components/GanttChart/Row/Index';
|
||||
import { PromiseVoidFunction } from 'Common/Types/FunctionTypes';
|
||||
import { getRefreshButton } from 'CommonUI/src/Components/Card/CardButtons/Refresh';
|
||||
import TelemetryServiceElement from '../../../../../../Components/TelemetryService/TelemetryServiceElement';
|
||||
|
||||
type BarTooltipFunctionProps = {
|
||||
span: Span;
|
||||
@@ -291,10 +292,23 @@ const TraceView: FunctionComponent<PageComponentProps> = (
|
||||
return [];
|
||||
}
|
||||
|
||||
const telemetryService: TelemetryService | undefined =
|
||||
telemetryServices.find((service: TelemetryService) => {
|
||||
return (
|
||||
service._id?.toString() === rootSpan.serviceId?.toString()
|
||||
);
|
||||
});
|
||||
|
||||
const rootRow: GanttChartRow = {
|
||||
rowInfo: {
|
||||
title: rootSpan.name!,
|
||||
description: '',
|
||||
title: <div>{rootSpan.name!}</div>,
|
||||
description: telemetryService ? (
|
||||
<TelemetryServiceElement
|
||||
telemetryService={telemetryService}
|
||||
/>
|
||||
) : (
|
||||
<></>
|
||||
),
|
||||
id: ObjectID.generate().toString(),
|
||||
},
|
||||
bars: [
|
||||
|
||||
Reference in New Issue
Block a user