Skip to content

Commit 57ecc10

Browse files
authored
fix(frontend): typed inputs in new run modal (#10799)
## Changes 🏗️ ### Make the **Credentials Inputs** show up on the new Run Agent Modal <img width="450" height="784" alt="Screenshot 2025-09-02 at 00 54 19" src="https://github.com/user-attachments/assets/26ad8242-a1bc-45f6-9149-a3d207683679" /> ### Fixes on other modals... <img width="450" height="579" alt="Screenshot 2025-09-02 at 00 04 40" src="https://github.com/user-attachments/assets/fa2f9ed9-207b-4599-9e60-3e37c4be6ea9" /> <img width="450" height="579" alt="Screenshot 2025-09-02 at 00 04 44" src="https://github.com/user-attachments/assets/92e062a7-f161-423e-b6c9-f998fbdef102" /> <img width="450" height="634" alt="Screenshot 2025-09-02 at 00 47 06" src="https://github.com/user-attachments/assets/93009809-0df0-44c5-b2d2-a9aa0f501312" /> - always use buttons/inputs in small size ( _due to the tight space_ ) - use from the design system - always use pretty scrollbars - Configure [`tailwind-scrollbars`](https://github.com/adoxography/tailwind-scrollbar) for pretty scrollbars - prevent content in dialog to overflow when scrollable ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Run the app locally with the new agent run modal flag enabled - [x] Check the above #### For configuration changes: None
1 parent 4928ce3 commit 57ecc10

File tree

23 files changed

+332
-347
lines changed

23 files changed

+332
-347
lines changed

autogpt_platform/frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"shepherd.js": "14.5.1",
9090
"sonner": "2.0.7",
9191
"tailwind-merge": "2.6.0",
92+
"tailwind-scrollbar": "4.0.2",
9293
"tailwindcss-animate": "1.0.7",
9394
"uuid": "11.1.0",
9495
"vaul": "1.1.2",

autogpt_platform/frontend/pnpm-lock.yaml

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/AgentRunsView/components/APIKeyCredentialsModal/APIKeyCredentialsModal.tsx

Lines changed: 45 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
11
import { Input } from "@/components/atoms/Input/Input";
22
import { Button } from "@/components/atoms/Button/Button";
33
import { Dialog } from "@/components/molecules/Dialog/Dialog";
4-
import {
5-
Form,
6-
FormControl,
7-
FormDescription,
8-
FormField,
9-
FormItem,
10-
FormLabel,
11-
FormMessage,
12-
} from "@/components/ui/form";
4+
import { Form, FormDescription, FormField } from "@/components/ui/form";
135
import {
146
BlockIOCredentialsSubSchema,
157
CredentialsMetaInput,
@@ -54,86 +46,75 @@ export function APIKeyCredentialsModal({
5446
},
5547
}}
5648
onClose={onClose}
49+
styling={{
50+
maxWidth: "25rem",
51+
}}
5752
>
5853
<Dialog.Content>
5954
{schemaDescription && (
6055
<p className="mb-4 text-sm text-zinc-600">{schemaDescription}</p>
6156
)}
6257

6358
<Form {...form}>
64-
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
59+
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-2">
6560
<FormField
6661
control={form.control}
6762
name="apiKey"
6863
render={({ field }) => (
69-
<FormItem>
70-
<FormLabel>API Key</FormLabel>
71-
{schema.credentials_scopes && (
72-
<FormDescription>
73-
Required scope(s) for this block:{" "}
74-
{schema.credentials_scopes?.map((s, i, a) => (
75-
<span key={i}>
76-
<code>{s}</code>
77-
{i < a.length - 1 && ", "}
78-
</span>
79-
))}
80-
</FormDescription>
81-
)}
82-
<FormControl>
83-
<Input
84-
id="apiKey"
85-
label="API Key"
86-
hideLabel
87-
type="password"
88-
placeholder="Enter API key..."
89-
{...field}
90-
/>
91-
</FormControl>
92-
<FormMessage />
93-
</FormItem>
64+
<>
65+
<Input
66+
id="apiKey"
67+
label="API Key"
68+
type="password"
69+
placeholder="Enter API key..."
70+
size="small"
71+
hint={
72+
schema.credentials_scopes ? (
73+
<FormDescription>
74+
Required scope(s) for this block:{" "}
75+
{schema.credentials_scopes?.map((s, i, a) => (
76+
<span key={i}>
77+
<code className="text-xs font-bold">{s}</code>
78+
{i < a.length - 1 && ", "}
79+
</span>
80+
))}
81+
</FormDescription>
82+
) : null
83+
}
84+
{...field}
85+
/>
86+
</>
9487
)}
9588
/>
9689
<FormField
9790
control={form.control}
9891
name="title"
9992
render={({ field }) => (
100-
<FormItem>
101-
<FormLabel>Name</FormLabel>
102-
<FormControl>
103-
<Input
104-
id="title"
105-
label="Name"
106-
hideLabel
107-
type="text"
108-
placeholder="Enter a name for this API key..."
109-
{...field}
110-
/>
111-
</FormControl>
112-
<FormMessage />
113-
</FormItem>
93+
<Input
94+
id="title"
95+
label="Name"
96+
type="text"
97+
placeholder="Enter a name for this API key..."
98+
size="small"
99+
{...field}
100+
/>
114101
)}
115102
/>
116103
<FormField
117104
control={form.control}
118105
name="expiresAt"
119106
render={({ field }) => (
120-
<FormItem>
121-
<FormLabel>Expiration Date (Optional)</FormLabel>
122-
<FormControl>
123-
<Input
124-
id="expiresAt"
125-
label="Expiration Date"
126-
hideLabel
127-
type="datetime-local"
128-
placeholder="Select expiration date..."
129-
{...field}
130-
/>
131-
</FormControl>
132-
<FormMessage />
133-
</FormItem>
107+
<Input
108+
id="expiresAt"
109+
label="Expiration Date"
110+
type="datetime-local"
111+
placeholder="Select expiration date..."
112+
size="small"
113+
{...field}
114+
/>
134115
)}
135116
/>
136-
<Button type="submit" className="w-full">
117+
<Button type="submit" size="small" className="min-w-68">
137118
Save & use this API key
138119
</Button>
139120
</form>

autogpt_platform/frontend/src/app/(platform)/library/agents/[id]/components/AgentRunsView/components/CredentialsInputs/CredentialsInputs.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,30 +335,39 @@ export const CredentialsInput: FC<{
335335
// Show credentials creation UI when no relevant credentials exist
336336
if (!hasRelevantCredentials) {
337337
return (
338-
<div>
338+
<div className="mb-4">
339339
{fieldHeader}
340340

341341
<div className={cn("flex flex-row space-x-2", className)}>
342342
{supportsOAuth2 && (
343-
<Button onClick={handleOAuthLogin}>
343+
<Button onClick={handleOAuthLogin} size="small">
344344
<ProviderIcon className="mr-2 h-4 w-4" />
345345
{"Sign in with " + providerName}
346346
</Button>
347347
)}
348348
{supportsApiKey && (
349-
<Button onClick={() => setAPICredentialsModalOpen(true)}>
349+
<Button
350+
onClick={() => setAPICredentialsModalOpen(true)}
351+
size="small"
352+
>
350353
<ProviderIcon className="mr-2 h-4 w-4" />
351354
Enter API key
352355
</Button>
353356
)}
354357
{supportsUserPassword && (
355-
<Button onClick={() => setUserPasswordCredentialsModalOpen(true)}>
358+
<Button
359+
onClick={() => setUserPasswordCredentialsModalOpen(true)}
360+
size="small"
361+
>
356362
<ProviderIcon className="mr-2 h-4 w-4" />
357363
Enter username and password
358364
</Button>
359365
)}
360366
{supportsHostScoped && credentials.discriminatorValue && (
361-
<Button onClick={() => setHostScopedCredentialsModalOpen(true)}>
367+
<Button
368+
onClick={() => setHostScopedCredentialsModalOpen(true)}
369+
size="small"
370+
>
362371
<ProviderIcon className="mr-2 h-4 w-4" />
363372
{`Enter sensitive headers for ${getHostFromUrl(credentials.discriminatorValue)}`}
364373
</Button>

0 commit comments

Comments
 (0)