diff --git a/eslint-suppressions.json b/eslint-suppressions.json index c4f01d8b68..0f63309ced 100644 --- a/eslint-suppressions.json +++ b/eslint-suppressions.json @@ -3079,20 +3079,12 @@ "count": 2 } }, - "web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx": { - "no-restricted-imports": { - "count": 1 - } - }, "web/app/components/tools/edit-custom-collection-modal/get-schema.tsx": { "no-restricted-imports": { "count": 1 } }, "web/app/components/tools/edit-custom-collection-modal/index.tsx": { - "no-restricted-imports": { - "count": 1 - }, "react/set-state-in-effect": { "count": 4 }, diff --git a/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx b/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx index 7c45b97c06..9d68c43d24 100644 --- a/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx +++ b/web/app/components/app/duplicate-modal/__tests__/index.spec.tsx @@ -141,18 +141,6 @@ describe('DuplicateAppModal', () => { />, ) - await user.click(screen.getByText('open-icon-picker')) - await waitFor(() => { - expect(screen.getByPlaceholderText('Search emojis...')).toBeInTheDocument() - }) - const emojiButton = document.querySelector('em-emoji')?.closest('button') - expect(emojiButton).toBeTruthy() - await user.click(emojiButton!) - await user.click(screen.getByRole('button', { name: '#E4FBCC' })) - await user.click(screen.getByRole('button', { name: /iconPicker\.ok/ })) - await waitFor(() => { - expect(screen.queryByPlaceholderText('Search emojis...')).not.toBeInTheDocument() - }) await user.click(screen.getByText('open-icon-picker')) await waitFor(() => { expect(screen.getByPlaceholderText('Search emojis...')).toBeInTheDocument() @@ -165,9 +153,9 @@ describe('DuplicateAppModal', () => { expect(onConfirm).toHaveBeenCalledWith(expect.objectContaining({ name: 'Image App', - icon_type: 'emoji', - icon: expect.any(String), - icon_background: '#E4FBCC', + icon_type: 'image', + icon: 'original-file', + icon_background: undefined, })) }) }) diff --git a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx index 09f119c1d6..dcbf834ede 100644 --- a/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/config-credentials.tsx @@ -14,12 +14,13 @@ import { } from '@langgenius/dify-ui/drawer' import { FieldItem, FieldLabel, FieldRoot } from '@langgenius/dify-ui/field' import { FieldsetLegend, FieldsetRoot } from '@langgenius/dify-ui/fieldset' +import { Input } from '@langgenius/dify-ui/input' import { Radio } from '@langgenius/dify-ui/radio' import { RadioGroup } from '@langgenius/dify-ui/radio-group' +import { ScrollArea } from '@langgenius/dify-ui/scroll-area' import { useState } from 'react' import { useTranslation } from 'react-i18next' import { Infotip } from '@/app/components/base/infotip' -import Input from '@/app/components/base/input' import { AuthHeaderPrefix, AuthType } from '@/app/components/tools/types' type Props = { @@ -41,11 +42,11 @@ function SelectItem({ text, value, isChecked }: ItemProps) { -
{text}
+
{text}
) @@ -104,7 +105,7 @@ export default function ConfigCredential({ : 'data-[swipe-direction=right]:right-2', )} > - +
@@ -116,128 +117,132 @@ export default function ConfigCredential({ />
-
-
- - - className="space-x-3" - value={tempCredential.auth_type} - onValueChange={handleAuthTypeChange} + + + + className="grid grid-cols-[repeat(auto-fit,minmax(8.5rem,1fr))] gap-2" + value={tempCredential.auth_type} + onValueChange={handleAuthTypeChange} + /> + )} + > + + {t('createTool.authMethod.type', { ns: 'tools' })} + + + + + + + {tempCredential.auth_type === AuthType.apiKeyHeader && ( + <> + + + className="grid grid-cols-[repeat(auto-fit,minmax(8.5rem,1fr))] gap-2" + value={tempCredential.api_key_header_prefix} + onValueChange={value => setTempCredential({ ...tempCredential, api_key_header_prefix: value })} + /> + )} + > + + {t('createTool.authHeaderPrefix.title', { ns: 'tools' })} + + - )} - > - - {t('createTool.authMethod.type', { ns: 'tools' })} - - - - - - - {tempCredential.auth_type === AuthType.apiKeyHeader && ( - <> - - - className="space-x-3" - value={tempCredential.api_key_header_prefix} - onValueChange={value => setTempCredential({ ...tempCredential, api_key_header_prefix: value })} - /> - )} + + + + +
+
+ {t('createTool.authMethod.key', { ns: 'tools' })} + - - {t('createTool.authHeaderPrefix.title', { ns: 'tools' })} - - - - - - -
-
- {t('createTool.authMethod.key', { ns: 'tools' })} - - {t('createTool.authMethod.keyTooltip', { ns: 'tools' })} - -
- setTempCredential({ ...tempCredential, api_key_header: e.target.value })} - placeholder={t('createTool.authMethod.types.apiKeyPlaceholder', { ns: 'tools' })!} - /> + {t('createTool.authMethod.keyTooltip', { ns: 'tools' })} +
-
-
{t('createTool.authMethod.value', { ns: 'tools' })}
- setTempCredential({ ...tempCredential, api_key_value: e.target.value })} - placeholder={t('createTool.authMethod.types.apiValuePlaceholder', { ns: 'tools' })!} - /> + setTempCredential({ ...tempCredential, api_key_header: e.target.value })} + placeholder={t('createTool.authMethod.types.apiKeyPlaceholder', { ns: 'tools' })!} + /> +
+
+
{t('createTool.authMethod.value', { ns: 'tools' })}
+ setTempCredential({ ...tempCredential, api_key_value: e.target.value })} + placeholder={t('createTool.authMethod.types.apiValuePlaceholder', { ns: 'tools' })!} + /> +
+ + )} + {tempCredential.auth_type === AuthType.apiKeyQuery && ( + <> +
+
+ {t('createTool.authMethod.queryParam', { ns: 'tools' })} + + {t('createTool.authMethod.queryParamTooltip', { ns: 'tools' })} +
- - )} - {tempCredential.auth_type === AuthType.apiKeyQuery && ( - <> -
-
- {t('createTool.authMethod.queryParam', { ns: 'tools' })} - - {t('createTool.authMethod.queryParamTooltip', { ns: 'tools' })} - -
- setTempCredential({ ...tempCredential, api_key_query_param: e.target.value })} - placeholder={t('createTool.authMethod.types.queryParamPlaceholder', { ns: 'tools' })!} - /> -
-
-
{t('createTool.authMethod.value', { ns: 'tools' })}
- setTempCredential({ ...tempCredential, api_key_value: e.target.value })} - placeholder={t('createTool.authMethod.types.apiValuePlaceholder', { ns: 'tools' })!} - /> -
- - )} -
-
+ setTempCredential({ ...tempCredential, api_key_query_param: e.target.value })} + placeholder={t('createTool.authMethod.types.queryParamPlaceholder', { ns: 'tools' })!} + /> +
+
+
{t('createTool.authMethod.value', { ns: 'tools' })}
+ setTempCredential({ ...tempCredential, api_key_value: e.target.value })} + placeholder={t('createTool.authMethod.types.apiValuePlaceholder', { ns: 'tools' })!} + /> +
+ + )} +