feat: Refactor telemetryService references to service in components and add ServicesElement for improved service handling

This commit is contained in:
Nawaz Dhandala 2026-01-09 18:07:11 +00:00
parent a9b5ea4702
commit 2dc2f3bf36
No known key found for this signature in database
GPG key ID: 96C5DCA24769DBCA
8 changed files with 45 additions and 14 deletions

View file

@ -104,7 +104,7 @@ const ExceptionDetail: FunctionComponent<ComponentProps> = (
fieldType: FieldType.Element,
getElement: () => {
return (
<ServiceElement telemetryService={props.telemetryService!} />
<ServiceElement service={props.telemetryService!} />
);
},
});

View file

@ -165,7 +165,7 @@ const MetricsTable: FunctionComponent<ComponentProps> = (
getElement: (item: MetricType): ReactElement => {
return (
<ServicesElement
telemetryServices={item.services || []}
services={item.services || []}
/>
);
},

View file

@ -385,7 +385,7 @@ const MonitorStepElement: FunctionComponent<ComponentProps> = (
placeholder: "No telemetry services entered",
getElement: (): ReactElement => {
return (
<ServicesElement telemetryServices={telemetryServices} />
<ServicesElement services={telemetryServices} />
);
},
});
@ -484,7 +484,7 @@ const MonitorStepElement: FunctionComponent<ComponentProps> = (
placeholder: "No telemetry services entered",
getElement: (): ReactElement => {
return (
<ServicesElement telemetryServices={telemetryServices} />
<ServicesElement services={telemetryServices} />
);
},
});

View file

@ -0,0 +1,31 @@
import ServiceElement from "./ServiceElement";
import TableColumnListComponent from "Common/UI/Components/TableColumnList/TableColumnListComponent";
import Service from "Common/Models/DatabaseModels/Service";
import React, { FunctionComponent, ReactElement } from "react";
export interface ComponentProps {
services: Array<Service>;
onNavigateComplete?: (() => void) | undefined;
}
const ServicesElement: FunctionComponent<ComponentProps> = (
props: ComponentProps,
): ReactElement => {
return (
<TableColumnListComponent
items={props.services}
moreText="more services"
getEachElement={(service: Service) => {
return (
<ServiceElement
service={service}
onNavigateComplete={props.onNavigateComplete}
/>
);
}}
noItemsMessage="No services."
/>
);
};
export default ServicesElement;

View file

@ -597,7 +597,7 @@ const SpanViewer: FunctionComponent<ComponentProps> = (
getElement: () => {
return (
<ServiceElement
telemetryService={telemetryService}
service={telemetryService}
onNavigateComplete={() => {
onClose();
}}

View file

@ -410,8 +410,8 @@ const TraceExplorer: FunctionComponent<ComponentProps> = (
return (
<div className="flex space-x-5">
<ServiceElement
telemetryService={telemetryService}
telemetryServiceNameClassName="mt-0.5"
service={telemetryService}
serviceNameClassName="mt-0.5"
/>
</div>
);

View file

@ -439,7 +439,7 @@ const TraceTable: FunctionComponent<ComponentProps> = (
return (
<Fragment>
<ServiceElement
telemetryService={telemetryService}
service={telemetryService}
/>
</Fragment>
);

View file

@ -63,9 +63,9 @@ const Settings: FunctionComponent<ComponentProps> = (
},
{
field: {
telemetryService: true,
service: true,
},
title: "Telemetry Service",
title: "Service",
type: FieldType.Entity,
filterEntityType: Service,
filterQuery: {
@ -108,19 +108,19 @@ const Settings: FunctionComponent<ComponentProps> = (
},
{
field: {
telemetryService: {
service: {
name: true,
_id: true,
serviceColor: true,
},
},
title: "Telemetry Service",
title: "Service",
type: FieldType.Element,
getElement: (item: TelemetryUsageBilling) => {
return (
<ServiceElement
telemetryService={
item["telemetryService"] as Service
service={
item["service"] as Service
}
/>
);