Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor(web): migrate tracing inputs (#41341)

yyh8266d741e83f
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 7b9c7d32e06..a0c36e9ee71 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -59,11 +59,6 @@
"count": 3
}
},
- "web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/field.tsx": {
- "no-restricted-imports": {
- "count": 1
- }
- },
"web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/provider-panel.tsx": {
"eslint-react/static-components": {
"count": 2
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/provider-config-modal.spec.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/provider-config-modal.spec.tsx
index ceebf3bdeb3..47880f0e3fd 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/provider-config-modal.spec.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/__tests__/provider-config-modal.spec.tsx
@@ -355,7 +355,7 @@ describe('ProviderConfigModal', () => {
screen.getByText(`app.tracing.configProvider.titleapp.tracing.${provider}.title`),
).toBeInTheDocument()
expectedLabels.forEach((label) => {
- expect(screen.getByText(label)).toBeInTheDocument()
+ expect(screen.getByRole('textbox', { name: label })).toBeInTheDocument()
})
expect(
screen.getByRole('button', { name: 'common.operation.saveAndEnable' }),
@@ -368,11 +368,16 @@ describe('ProviderConfigModal', () => {
it('should add and choose the provider when saving a new config', async () => {
const user = userEvent.setup()
const callbacks = renderProviderConfigModal({ type: TracingProvider.langfuse })
- const textboxes = screen.getAllByRole('textbox')
- await user.type(textboxes[0]!, 'secret-key')
- await user.type(textboxes[1]!, 'public-key')
- await user.type(textboxes[2]!, 'https://cloud.langfuse.com')
+ await user.type(
+ screen.getByRole('textbox', { name: 'app.tracing.configProvider.secretKey' }),
+ 'secret-key',
+ )
+ await user.type(
+ screen.getByRole('textbox', { name: 'app.tracing.configProvider.publicKey' }),
+ 'public-key',
+ )
+ await user.type(screen.getByRole('textbox', { name: 'Host' }), 'https://cloud.langfuse.com')
await user.click(screen.getByRole('button', { name: 'common.operation.saveAndEnable' }))
await waitFor(() => {
diff --git a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/field.tsx b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/field.tsx
index 9a039dbd125..26135bb5bc5 100644
--- a/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/field.tsx
+++ b/web/app/(commonLayout)/app/(appDetailLayout)/[appId]/overview/tracing/field.tsx
@@ -1,8 +1,8 @@
'use client'
import type { FC } from 'react'
import { cn } from '@langgenius/dify-ui/cn'
+import { Input } from '@langgenius/dify-ui/input'
import * as React from 'react'
-import Input from '@/app/components/base/input'
type Props = Readonly<{
className?: string
@@ -23,22 +23,26 @@ const Field: FC<Props> = ({
isRequired = false,
placeholder = '',
}) => {
+ const inputId = React.useId()
+
return (
<div className={cn(className)}>
<div className="flex py-1.75">
- <div
+ <label
+ htmlFor={inputId}
className={cn(
labelClassName,
'flex h-4.5 items-center text-[13px] font-medium text-text-primary',
)}
>
{label}{' '}
- </div>
+ </label>
{isRequired && <span className="ml-0.5 text-xs font-semibold text-[#D92D20]">*</span>}
</div>
<Input
+ id={inputId}
value={value}
- onChange={(e) => onChange(e.target.value)}
+ onValueChange={(nextValue) => onChange(nextValue)}
className="h-9"
placeholder={placeholder}
/>