mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-11 19:56:44 +00:00
feat: Refactor telemetryService references to service in components and add ServicesElement for improved service handling
This commit is contained in:
parent
a9b5ea4702
commit
2dc2f3bf36
8 changed files with 45 additions and 14 deletions
|
|
@ -104,7 +104,7 @@ const ExceptionDetail: FunctionComponent<ComponentProps> = (
|
|||
fieldType: FieldType.Element,
|
||||
getElement: () => {
|
||||
return (
|
||||
<ServiceElement telemetryService={props.telemetryService!} />
|
||||
<ServiceElement service={props.telemetryService!} />
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ const MetricsTable: FunctionComponent<ComponentProps> = (
|
|||
getElement: (item: MetricType): ReactElement => {
|
||||
return (
|
||||
<ServicesElement
|
||||
telemetryServices={item.services || []}
|
||||
services={item.services || []}
|
||||
/>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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} />
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
31
Dashboard/src/Components/Service/ServiceElements.tsx
Normal file
31
Dashboard/src/Components/Service/ServiceElements.tsx
Normal 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;
|
||||
|
|
@ -597,7 +597,7 @@ const SpanViewer: FunctionComponent<ComponentProps> = (
|
|||
getElement: () => {
|
||||
return (
|
||||
<ServiceElement
|
||||
telemetryService={telemetryService}
|
||||
service={telemetryService}
|
||||
onNavigateComplete={() => {
|
||||
onClose();
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ const TraceTable: FunctionComponent<ComponentProps> = (
|
|||
return (
|
||||
<Fragment>
|
||||
<ServiceElement
|
||||
telemetryService={telemetryService}
|
||||
service={telemetryService}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue