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.

fix(web): align New RAG add source forms (#44855)

非法操作8f7ef0ec04a9
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 721ae9483f3..8c0d5f20355 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -6821,16 +6821,6 @@
"count": 1
}
},
- "web/features/new-rag/sources/create/connected-source-workflow.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
- "web/features/new-rag/sources/create/page.tsx": {
- "better-tailwindcss/enforce-logical-properties": {
- "count": 2
- }
- },
"web/features/new-rag/sources/create/website-crawl-preview.tsx": {
"better-tailwindcss/enforce-logical-properties": {
"count": 2
diff --git a/web/features/new-rag/sources/create/connected-source-workflow.tsx b/web/features/new-rag/sources/create/connected-source-workflow.tsx
index 820b23066c8..0b567c899b4 100644
--- a/web/features/new-rag/sources/create/connected-source-workflow.tsx
+++ b/web/features/new-rag/sources/create/connected-source-workflow.tsx
@@ -405,7 +405,7 @@ function ResourceList({
<span className="system-xs-medium text-text-primary">
{t(($) => $.selectAll, { ns: 'knowledgeSources' })}
</span>
- <span className="ml-auto truncate system-xs-regular text-text-tertiary">
+ <span className="ms-auto truncate system-xs-regular text-text-tertiary">
{connectionLabel(connection, resources, providerRegion)}
</span>
</div>
@@ -1390,7 +1390,7 @@ function ResourceConfiguration({
<span role="status" className="system-xs-regular text-text-tertiary">
{t(($) => $.pagesSelected, { ns: 'knowledgeSources', count: selected.size })}
{selectionLimitVisible && (
- <span id={selectionLimitId} className="ml-2 text-text-destructive">
+ <span id={selectionLimitId} className="ms-2 text-text-destructive">
{t(($) => $.maxPages, { ns: 'knowledgeSources' })}: {MAX_SELECTION}
</span>
)}
@@ -1995,7 +1995,7 @@ function ConnectedSourceWorkflowSession({
<ConnectedSourceSyncPolicyField draft={providerDraft} onDraftChange={onDraftChange} />
)}
{!connection && (
- <div className="mt-1 flex justify-between gap-2 border-t border-divider-subtle pt-4.75">
+ <div className="mt-1 flex justify-end gap-2 border-t border-divider-subtle pt-4.75">
<Button type="button" onClick={onExit}>
{t(($) => $.cancelAddSource, { ns: 'knowledgeSources' })}
</Button>
diff --git a/web/features/new-rag/sources/create/page.tsx b/web/features/new-rag/sources/create/page.tsx
index e9d80e94e23..47045672d4b 100644
--- a/web/features/new-rag/sources/create/page.tsx
+++ b/web/features/new-rag/sources/create/page.tsx
@@ -194,7 +194,7 @@ function ProviderFieldControl({
>
<SelectLabel>
{label}
- {field.required && <span className="ml-0.5 text-text-destructive">*</span>}
+ {field.required && <span className="ms-0.5 text-text-destructive">*</span>}
</SelectLabel>
<SelectTrigger aria-describedby={descriptionId} size="large">
{value === 'true'
@@ -224,7 +224,7 @@ function ProviderFieldControl({
<>
<FieldLabel>
{label}
- {field.required && <span className="ml-0.5 text-text-destructive">*</span>}
+ {field.required && <span className="ms-0.5 text-text-destructive">*</span>}
</FieldLabel>
<Input
aria-describedby={descriptionId}
@@ -1070,7 +1070,6 @@ function AddSourcePageContent({
<>
<SourceProviderSelector
disabled={websiteSetupLocked}
- layout="grid-four"
options={websiteProviderOptions}
providerKey={websiteProviderOption?.key ?? ''}
showEmptyState={!queryError && websiteProviderOptions.length === 0}
@@ -1125,10 +1124,10 @@ function AddSourcePageContent({
providerOption={datasourceProvider}
syncPolicyField={
<SourceSyncPolicyField
- className="w-full sm:w-75.25"
disabled={websiteSetupLocked}
draft={providerDraft}
size="medium"
+ triggerClassName="w-full sm:w-75.25"
onDraftChange={updateSourceDraft}
/>
}
@@ -1187,9 +1186,9 @@ function AddSourcePageContent({
)}
{sourceType === 'websiteCrawl' && !websiteReady && (
<SourceSyncPolicyField
- className="w-full sm:w-75.25"
draft={providerDraft}
size="medium"
+ triggerClassName="w-full sm:w-75.25"
onDraftChange={updateSourceDraft}
/>
)}
diff --git a/web/features/new-rag/sources/setup/__tests__/sync-policy-field.spec.tsx b/web/features/new-rag/sources/setup/__tests__/sync-policy-field.spec.tsx
index 20d295e184b..79915313297 100644
--- a/web/features/new-rag/sources/setup/__tests__/sync-policy-field.spec.tsx
+++ b/web/features/new-rag/sources/setup/__tests__/sync-policy-field.spec.tsx
@@ -57,6 +57,28 @@ describe('SyncPolicyField', () => {
i18nLanguage.current = 'en-US'
})
+ it('shows sync timing for default and preset intervals but not manual sync', async () => {
+ const user = userEvent.setup()
+ render(<SyncPolicyFieldHarness />)
+
+ const trigger = screen.getByRole('combobox', { name: 'Sync policy' })
+ expect(trigger).toHaveTextContent('Every 24 hours')
+ expect(
+ screen.getByText('First sync runs right after creation, then every 24 hours.'),
+ ).toBeVisible()
+
+ await user.click(trigger)
+ await user.click(screen.getByRole('option', { name: 'Every 3 days' }))
+ expect(
+ screen.getByText('First sync runs right after creation, then every 3 days.'),
+ ).toBeVisible()
+
+ await user.click(trigger)
+ await user.click(screen.getByRole('option', { name: 'Manual sync' }))
+ expect(trigger).toHaveTextContent('Manual sync')
+ expect(screen.queryByText(/^First sync runs right after creation/)).not.toBeInTheDocument()
+ })
+
it('separates numbers from units in Simplified Chinese interval labels', async () => {
i18nLanguage.current = 'zh-Hans'
const user = userEvent.setup()
diff --git a/web/features/new-rag/sources/setup/sync-policy-field.tsx b/web/features/new-rag/sources/setup/sync-policy-field.tsx
index 2c7ec6198dd..614a1e3f66c 100644
--- a/web/features/new-rag/sources/setup/sync-policy-field.tsx
+++ b/web/features/new-rag/sources/setup/sync-policy-field.tsx
@@ -374,7 +374,7 @@ export function SyncPolicyField({
}}
onOpenChange={setCustomOpen}
/>
- {customIntervalSelected && (
+ {value.mode !== 'manual' && (
<p className="system-xs-regular text-text-tertiary">
{t(($) => $.syncPolicyCustomDescription, {
ns: 'knowledgeSources',