mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
refactor: Improve CopilotActionPropViewer component
This commit is contained in:
parent
9be38d55c6
commit
6a10bdff56
@ -20,7 +20,6 @@ export interface ComponentProps {
|
||||
const CopilotActionPropViewer: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps,
|
||||
): ReactElement => {
|
||||
|
||||
if (!props.actionProps) {
|
||||
return <>-</>;
|
||||
}
|
||||
@ -31,8 +30,6 @@ const CopilotActionPropViewer: FunctionComponent<ComponentProps> = (
|
||||
const actionPropType: CopilotActionPropType =
|
||||
CopilotActionPropUtil.getCopilotActionPropByActionType(props.actionType);
|
||||
|
||||
|
||||
|
||||
if (actionPropType === CopilotActionPropType.Directory) {
|
||||
return (
|
||||
<div>
|
||||
@ -58,11 +55,14 @@ const CopilotActionPropViewer: FunctionComponent<ComponentProps> = (
|
||||
<div>
|
||||
<p className="text-gray-900">Exception</p>
|
||||
<p>
|
||||
|
||||
{(props.actionProps as ExceptionActionProp).fingerprint && <TelemetryExceptionElement
|
||||
message={(props.actionProps as ExceptionActionProp).message}
|
||||
fingerprint={(props.actionProps as ExceptionActionProp).fingerprint}
|
||||
/>}
|
||||
{(props.actionProps as ExceptionActionProp).fingerprint && (
|
||||
<TelemetryExceptionElement
|
||||
message={(props.actionProps as ExceptionActionProp).message}
|
||||
fingerprint={
|
||||
(props.actionProps as ExceptionActionProp).fingerprint
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
{!(props.actionProps as ExceptionActionProp).fingerprint && <p>-</p>}
|
||||
</p>
|
||||
@ -76,17 +76,18 @@ const CopilotActionPropViewer: FunctionComponent<ComponentProps> = (
|
||||
<p className="text-gray-900">Trace ID</p>
|
||||
<p>
|
||||
{!(props.actionProps as SpanActionProp).traceId && <p>-</p>}
|
||||
{(props.actionProps as SpanActionProp).traceId && <TraceElement
|
||||
traceId={(props.actionProps as SpanActionProp).traceId}
|
||||
/>}
|
||||
{(props.actionProps as SpanActionProp).traceId && (
|
||||
<TraceElement
|
||||
traceId={(props.actionProps as SpanActionProp).traceId}
|
||||
/>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
if (actionPropType === CopilotActionPropType.Function) {
|
||||
|
||||
if(!(props.actionProps as FunctionActionProp).functionName) {
|
||||
if (!(props.actionProps as FunctionActionProp).functionName) {
|
||||
return <>-</>;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ import SimpleLogViewer from "Common/UI/Components/SimpleLogViewer/SimpleLogViewe
|
||||
import { ButtonStyleType } from "Common/UI/Components/Button/Button";
|
||||
import IconProp from "Common/Types/Icon/IconProp";
|
||||
import ServiceCatalogElement from "../../ServiceCatalog/ServiceElement";
|
||||
import CopilotActionPropViewer from "./CopilotActionPropViewer";
|
||||
|
||||
export interface ComponentProps {
|
||||
query: Query<CopilotAction>;
|
||||
@ -53,6 +54,21 @@ const CopilotActionTable: FunctionComponent<ComponentProps> = (
|
||||
title: "Action Type",
|
||||
type: FieldType.Text,
|
||||
},
|
||||
{
|
||||
field: {
|
||||
copilotActionProp: true,
|
||||
},
|
||||
title: "More Details",
|
||||
type: FieldType.Element,
|
||||
getElement: (item: CopilotAction): ReactElement => {
|
||||
return (
|
||||
<CopilotActionPropViewer
|
||||
actionProps={item.copilotActionProp!}
|
||||
actionType={item.copilotActionType!}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: {
|
||||
serviceCatalog: {
|
||||
|
Loading…
Reference in New Issue
Block a user