mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
chore: Update CopilotActionTypePriorityService and CopilotActionTypeElement
This commit is contained in:
parent
c76237f785
commit
06ac018ec6
@ -1,4 +1,5 @@
|
||||
import CopilotActionType from "../../Types/Copilot/CopilotActionType";
|
||||
import BadDataException from "../../Types/Exception/BadDataException";
|
||||
import ObjectID from "../../Types/ObjectID";
|
||||
import CreateBy from "../Types/Database/CreateBy";
|
||||
import { OnCreate } from "../Types/Database/Hooks";
|
||||
@ -20,11 +21,11 @@ export class Service extends DatabaseService<Model> {
|
||||
createBy.data.codeRepositoryId;
|
||||
|
||||
if (!actionType) {
|
||||
throw new Error("ActionType is required");
|
||||
throw new BadDataException("ActionType is required");
|
||||
}
|
||||
|
||||
if (!codeRepositoryId) {
|
||||
throw new Error("CodeRepositoryId is required");
|
||||
throw new BadDataException("CodeRepositoryId is required");
|
||||
}
|
||||
|
||||
const existingItem: Model | null = await this.findOneBy({
|
||||
@ -44,7 +45,9 @@ export class Service extends DatabaseService<Model> {
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error("Action Type already exists for this repository.");
|
||||
throw new BadDataException(
|
||||
"Action Type already exists for this repository.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,9 @@ const CopilotActionTypeElement: FunctionComponent<ComponentProps> = (
|
||||
|
||||
return (
|
||||
<div>
|
||||
<p className="font-semibold text-gray-900">{copilotActionTypeData.type}</p>
|
||||
<p className="font-semibold text-gray-900">
|
||||
{copilotActionTypeData.type}
|
||||
</p>
|
||||
<p>{copilotActionTypeData.description}</p>
|
||||
</div>
|
||||
);
|
||||
|
@ -61,7 +61,16 @@ const CopilotPriorities: FunctionComponent<
|
||||
"Please enter priority for this action. Please enter a number from 1 to 5.",
|
||||
},
|
||||
]}
|
||||
createVerb="Add"
|
||||
singularName="Action"
|
||||
pluralName="Actions"
|
||||
showRefreshButton={true}
|
||||
onBeforeCreate={(
|
||||
copilotActionTypePriority: CopilotActionTypePriority,
|
||||
) => {
|
||||
copilotActionTypePriority.codeRepositoryId = modelId;
|
||||
return Promise.resolve(copilotActionTypePriority);
|
||||
}}
|
||||
showViewIdButton={true}
|
||||
filters={[]}
|
||||
columns={[
|
||||
@ -71,11 +80,15 @@ const CopilotPriorities: FunctionComponent<
|
||||
},
|
||||
title: "Action",
|
||||
type: FieldType.Element,
|
||||
getElement: (copilotActionTypePriority: CopilotActionTypePriority) => {
|
||||
getElement: (
|
||||
copilotActionTypePriority: CopilotActionTypePriority,
|
||||
) => {
|
||||
return (
|
||||
<CopilotActionTypeElement copilotAction={copilotActionTypePriority.actionType!} />
|
||||
)
|
||||
}
|
||||
<CopilotActionTypeElement
|
||||
copilotAction={copilotActionTypePriority.actionType!}
|
||||
/>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
field: {
|
||||
|
Loading…
Reference in New Issue
Block a user