From f11f81358168f8c6b4af9806763fbd74c0d1f95b Mon Sep 17 00:00:00 2001 From: shahargl Date: Sun, 3 Nov 2024 09:14:15 +0200 Subject: [PATCH] fix: rename candidate --- .../alerts/alert-create-incident-ai-card.tsx | 12 ++++++------ .../alerts/alert-create-incident-ai-modal.tsx | 18 +++++++++--------- keep-ui/app/incidents/models.ts | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/keep-ui/app/alerts/alert-create-incident-ai-card.tsx b/keep-ui/app/alerts/alert-create-incident-ai-card.tsx index 80c071f0a..be75ed447 100644 --- a/keep-ui/app/alerts/alert-create-incident-ai-card.tsx +++ b/keep-ui/app/alerts/alert-create-incident-ai-card.tsx @@ -17,16 +17,16 @@ import { } from "@tremor/react"; import { Droppable, Draggable } from "react-beautiful-dnd"; import { AlertDto } from "./models"; -import { IncidentCandidatDto } from "../incidents/models"; +import { IncidentCandidateDto } from "../incidents/models"; interface IncidentCardProps { - incident: IncidentCandidatDto; + incident: IncidentCandidateDto; index: number; - onIncidentChange: (updatedIncident: IncidentCandidatDto) => void; + onIncidentChange: (updatedIncident: IncidentCandidateDto) => void; } interface EditableField { - name: keyof IncidentCandidatDto; + name: keyof IncidentCandidateDto; label: string; type: "text" | "textarea"; } @@ -49,7 +49,7 @@ const IncidentCard: React.FC = ({ }) => { const [isEditing, setIsEditing] = useState(false); const [editedIncident, setEditedIncident] = - useState(incident); + useState(incident); useEffect(() => { setEditedIncident(incident); @@ -63,7 +63,7 @@ const IncidentCard: React.FC = ({ }; const handleFieldChange = ( - field: keyof IncidentCandidatDto, + field: keyof IncidentCandidateDto, value: string ) => { setEditedIncident((prev) => ({ ...prev, [field]: value })); diff --git a/keep-ui/app/alerts/alert-create-incident-ai-modal.tsx b/keep-ui/app/alerts/alert-create-incident-ai-modal.tsx index c3027cca6..95f505cee 100644 --- a/keep-ui/app/alerts/alert-create-incident-ai-modal.tsx +++ b/keep-ui/app/alerts/alert-create-incident-ai-modal.tsx @@ -5,7 +5,7 @@ import { useSession } from "next-auth/react"; import { toast } from "react-toastify"; import Loading from "../loading"; import { AlertDto } from "./models"; -import { IncidentDto, IncidentCandidatDto } from "../incidents/models"; +import { IncidentDto, IncidentCandidateDto } from "../incidents/models"; import { useApiUrl, useConfig } from "utils/hooks/useConfig"; import { DragDropContext } from "react-beautiful-dnd"; import IncidentCard from "./alert-create-incident-ai-card"; @@ -24,7 +24,7 @@ interface IncidentChange { } interface IncidentSuggestion { - incident_suggestion: IncidentCandidatDto[]; + incident_suggestion: IncidentCandidateDto[]; suggestion_id: string; } @@ -36,14 +36,14 @@ const CreateIncidentWithAIModal = ({ const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const [incidentCandidates, setIncidentCandidates] = useState< - IncidentCandidatDto[] + IncidentCandidateDto[] >([]); const [changes, setChanges] = useState< Record> >({}); const [selectedIncidents, setSelectedIncidents] = useState([]); const [originalSuggestions, setOriginalSuggestions] = useState< - IncidentCandidatDto[] + IncidentCandidateDto[] >([]); const [suggestionId, setSuggestionId] = useState(""); const { data: session } = useSession(); @@ -183,7 +183,7 @@ const CreateIncidentWithAIModal = ({ }); }; - const handleIncidentChange = (updatedIncident: IncidentCandidatDto) => { + const handleIncidentChange = (updatedIncident: IncidentCandidateDto) => { setIncidentCandidates((prevIncidents) => prevIncidents.map((incident) => incident.id === updatedIncident.id ? updatedIncident : incident @@ -201,12 +201,12 @@ const CreateIncidentWithAIModal = ({ ); if ( originalIncident && - updatedIncident[key as keyof IncidentCandidatDto] !== - originalIncident[key as keyof IncidentCandidatDto] + updatedIncident[key as keyof IncidentCandidateDto] !== + originalIncident[key as keyof IncidentCandidateDto] ) { newChanges[key] = { - from: originalIncident[key as keyof IncidentCandidatDto], - to: updatedIncident[key as keyof IncidentCandidatDto], + from: originalIncident[key as keyof IncidentCandidateDto], + to: updatedIncident[key as keyof IncidentCandidateDto], }; } }); diff --git a/keep-ui/app/incidents/models.ts b/keep-ui/app/incidents/models.ts index 7d2896289..05961dea8 100644 --- a/keep-ui/app/incidents/models.ts +++ b/keep-ui/app/incidents/models.ts @@ -32,7 +32,7 @@ export interface IncidentDto { merged_at: Date; } -export interface IncidentCandidatDto { +export interface IncidentCandidateDto { id: string; name: string; description: string;