Skip to content

Commit 766a754

Browse files
committed
Fix to add falback icon in case of error
1 parent 2d71e1e commit 766a754

2 files changed

Lines changed: 4 additions & 22 deletions

File tree

packages/agentflow/src/atoms/CredentialTypeSelector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function CredentialTypeSelector({ schemas, apiBaseUrl, onSelect }: Creden
8686
}
8787

8888
/** Circular credential icon with fallback to a key icon on load error. */
89-
function CredentialIcon({ name, apiBaseUrl }: { name: string; apiBaseUrl: string }) {
89+
export function CredentialIcon({ name, apiBaseUrl }: { name: string; apiBaseUrl: string }) {
9090
const theme = useTheme()
9191
const [failed, setFailed] = useState(false)
9292

packages/agentflow/src/features/node-editor/CreateCredentialDialog.tsx

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { useTheme } from '@mui/material/styles'
1717
import { IconAlertTriangle, IconArrowsMaximize } from '@tabler/icons-react'
1818
import parser from 'html-react-parser'
1919

20-
import { CredentialTypeSelector } from '@/atoms/CredentialTypeSelector'
20+
import { CredentialIcon, CredentialTypeSelector } from '@/atoms/CredentialTypeSelector'
2121
import { Dropdown } from '@/atoms/Dropdown'
2222
import { JsonInput } from '@/atoms/JsonInput'
2323
import { SwitchInput } from '@/atoms/SwitchInput'
@@ -178,26 +178,8 @@ export function CreateCredentialDialog({ open, credentialNames, onClose, onCreat
178178
<DialogTitle sx={{ fontSize: '1rem', p: 3, pb: 0 }}>
179179
{selectedSchema ? (
180180
<div style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
181-
<div
182-
style={{
183-
width: 50,
184-
height: 50,
185-
marginRight: 10,
186-
borderRadius: '50%',
187-
backgroundColor: theme.palette.common.white
188-
}}
189-
>
190-
<img
191-
style={{
192-
width: '100%',
193-
height: '100%',
194-
padding: 7,
195-
borderRadius: '50%',
196-
objectFit: 'contain'
197-
}}
198-
alt={selectedSchema.name}
199-
src={`${apiBaseUrl}/api/v1/components-credentials-icon/${selectedSchema.name}`}
200-
/>
181+
<div style={{ marginRight: 10 }}>
182+
<CredentialIcon name={selectedSchema.name} apiBaseUrl={apiBaseUrl} />
201183
</div>
202184
{selectedSchema.label}
203185
</div>

0 commit comments

Comments
 (0)