Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe("EditEndpointModal", () => {
});
});

it("shows API key field when endpoint requires API key", () => {
it("shows API key field with hint when endpoint requires API key", () => {
render(
<EditEndpointModal
isOpen={true}
Expand All @@ -142,7 +142,7 @@ describe("EditEndpointModal", () => {
expect(screen.getByPlaceholderText("sk-...")).toBeInTheDocument();
});

it("does not show API key field when endpoint does not require API key", () => {
it("shows API key field without hint when endpoint does not require API key", () => {
const endpointWithoutApiKey = { ...mockEndpoint, requires_api_key: false };

render(
Expand All @@ -155,8 +155,11 @@ describe("EditEndpointModal", () => {
{ wrapper: createWrapper() },
);

expect(screen.queryByText(/API Key/)).not.toBeInTheDocument();
expect(screen.queryByPlaceholderText("sk-...")).not.toBeInTheDocument();
expect(screen.getByText(/API Key/)).toBeInTheDocument();
expect(screen.getByPlaceholderText("sk-...")).toBeInTheDocument();
expect(
screen.queryByText("Leave empty to keep existing key"),
).not.toBeInTheDocument();
});

it("closes modal when cancel is clicked", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ export const EditEndpointModal: React.FC<EditEndpointModalProps> = ({

const handleConfigureManually = () => {
setManualMode(true);
setCurrentStep(2);
setValidationState("idle");
setValidationError(null);

Expand Down Expand Up @@ -696,18 +697,19 @@ export const EditEndpointModal: React.FC<EditEndpointModalProps> = ({
)}
/>

{endpoint.requires_api_key && (
<FormField
control={form.control}
name="apiKey"
render={({ field }) => (
<FormItem>
<FormLabel>
API Key (optional)
<FormField
control={form.control}
name="apiKey"
render={({ field }) => (
<FormItem>
<FormLabel>
API Key (optional)
{endpoint.requires_api_key && (
<span className="text-xs text-gray-500 ml-2">
Leave empty to keep existing key
</span>
</FormLabel>
)}
</FormLabel>
<FormControl>
<div className="relative">
<Input
Expand Down Expand Up @@ -735,7 +737,6 @@ export const EditEndpointModal: React.FC<EditEndpointModalProps> = ({
</FormItem>
)}
/>
)}

{/* Advanced Configuration and Auto-discover */}
<div className="flex items-center justify-between">
Expand Down