Skip to content

Commit

Permalink
fix: rename candidate
Browse files Browse the repository at this point in the history
  • Loading branch information
shahargl committed Nov 3, 2024
1 parent 5ce3230 commit f11f813
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions keep-ui/app/alerts/alert-create-incident-ai-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand All @@ -49,7 +49,7 @@ const IncidentCard: React.FC<IncidentCardProps> = ({
}) => {
const [isEditing, setIsEditing] = useState(false);
const [editedIncident, setEditedIncident] =
useState<IncidentCandidatDto>(incident);
useState<IncidentCandidateDto>(incident);

useEffect(() => {
setEditedIncident(incident);
Expand All @@ -63,7 +63,7 @@ const IncidentCard: React.FC<IncidentCardProps> = ({
};

const handleFieldChange = (
field: keyof IncidentCandidatDto,
field: keyof IncidentCandidateDto,
value: string
) => {
setEditedIncident((prev) => ({ ...prev, [field]: value }));
Expand Down
18 changes: 9 additions & 9 deletions keep-ui/app/alerts/alert-create-incident-ai-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -24,7 +24,7 @@ interface IncidentChange {
}

interface IncidentSuggestion {
incident_suggestion: IncidentCandidatDto[];
incident_suggestion: IncidentCandidateDto[];
suggestion_id: string;
}

Expand All @@ -36,14 +36,14 @@ const CreateIncidentWithAIModal = ({
const [isLoading, setIsLoading] = useState(false);
const [error, setError] = useState<string | null>(null);
const [incidentCandidates, setIncidentCandidates] = useState<
IncidentCandidatDto[]
IncidentCandidateDto[]
>([]);
const [changes, setChanges] = useState<
Record<string, Record<string, IncidentChange>>
>({});
const [selectedIncidents, setSelectedIncidents] = useState<string[]>([]);
const [originalSuggestions, setOriginalSuggestions] = useState<
IncidentCandidatDto[]
IncidentCandidateDto[]
>([]);
const [suggestionId, setSuggestionId] = useState<string>("");
const { data: session } = useSession();
Expand Down Expand Up @@ -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
Expand All @@ -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],
};
}
});
Expand Down
2 changes: 1 addition & 1 deletion keep-ui/app/incidents/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface IncidentDto {
merged_at: Date;
}

export interface IncidentCandidatDto {
export interface IncidentCandidateDto {
id: string;
name: string;
description: string;
Expand Down

0 comments on commit f11f813

Please sign in to comment.