mirror of
https://github.com/langgenius/dify.git
synced 2026-07-20 00:53:34 -04:00
fix: web detail adjustment before release (#38296)
Co-authored-by: Jingyi-Dify <jingyi.qi@dify.ai>
This commit is contained in:
@@ -649,13 +649,13 @@ describe('IntegrationsPage', () => {
|
||||
expect(screen.getAllByText('common.settings.customEndpoint')).toHaveLength(2)
|
||||
expect(screen.getByText('common.apiBasedExtensionPage.description')).toBeInTheDocument()
|
||||
expect(screen.getByTestId('api-extension-toolbar')).toBeInTheDocument()
|
||||
expect(screen.getByRole('link', { name: /common\.modelProvider\.learnMore/i })).toHaveAttribute('href', 'https://docs.dify.ai/en/self-host/use-dify/workspace/api-extension/api-extension')
|
||||
expect(screen.getByRole('link', { name: /common\.modelProvider\.learnMore/i })).toHaveAttribute('href', 'https://docs.dify.ai/en/develop-plugin/dev-guides-and-walkthroughs/endpoint')
|
||||
expect(screen.queryByText('common.toolsPage.description')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it.each([
|
||||
['trigger', 'plugin.categorySingle.trigger', 'common.triggerPage.description', 'https://docs.dify.ai/en/develop-plugin/dev-guides-and-walkthroughs/trigger-plugin'],
|
||||
['extension', 'plugin.categorySingle.extension', 'common.extensionPage.description', 'https://docs.dify.ai/en/develop-plugin/dev-guides-and-walkthroughs/endpoint'],
|
||||
['extension', 'plugin.categorySingle.extension', 'common.extensionPage.description', 'https://docs.dify.ai/en/self-host/use-dify/workspace/api-extension/api-extension'],
|
||||
['agent-strategy', 'plugin.categorySingle.agent', 'common.agentStrategyPage.description', 'https://docs.dify.ai/en/develop-plugin/dev-guides-and-walkthroughs/agent-strategy-plugin'],
|
||||
] as const)('renders the %s header with a docs link', (section, title, description, href) => {
|
||||
renderIntegrationsPage({ section })
|
||||
|
||||
@@ -43,9 +43,9 @@ const headerDescriptionDocPaths: Partial<Record<IntegrationSection, string>> = {
|
||||
'custom-tool': '/use-dify/workspace/tools#custom-tool',
|
||||
'workflow-tool': '/use-dify/workspace/tools#workflow-tool',
|
||||
'mcp': '/use-dify/build/mcp',
|
||||
'custom-endpoint': '/use-dify/workspace/api-extension/api-extension',
|
||||
'custom-endpoint': '/develop-plugin/dev-guides-and-walkthroughs/endpoint',
|
||||
'trigger': '/develop-plugin/dev-guides-and-walkthroughs/trigger-plugin',
|
||||
'extension': '/develop-plugin/dev-guides-and-walkthroughs/endpoint',
|
||||
'extension': '/use-dify/workspace/api-extension/api-extension',
|
||||
'agent-strategy': '/develop-plugin/dev-guides-and-walkthroughs/agent-strategy-plugin',
|
||||
}
|
||||
|
||||
|
||||
@@ -360,7 +360,11 @@ describe('MainNav', () => {
|
||||
it('aligns the global navigation spacing with the main sidebar design', async () => {
|
||||
mockInstalledApps = [createInstalledApp()]
|
||||
|
||||
renderMainNav()
|
||||
const { container } = renderMainNav()
|
||||
|
||||
const mainNav = container.querySelector('aside')
|
||||
expect(mainNav).toHaveClass('w-62', 'p-1')
|
||||
expect(mainNav?.firstElementChild).toHaveClass('w-60')
|
||||
|
||||
const logoLink = screen.getByLabelText('Dify')
|
||||
expect(logoLink).not.toHaveClass('px-2')
|
||||
@@ -374,6 +378,8 @@ describe('MainNav', () => {
|
||||
expect(webAppsButton.parentElement).toHaveClass('py-1', 'pr-2', 'pl-2')
|
||||
|
||||
const helpButton = screen.getByRole('button', { name: 'common.mainNav.help.openMenu' })
|
||||
expect(helpButton.parentElement?.parentElement).toHaveClass('w-60')
|
||||
expect(helpButton.parentElement?.parentElement).not.toHaveClass('w-full')
|
||||
expect(helpButton.parentElement).toHaveClass('shrink-0', 'rounded-full', 'p-1')
|
||||
})
|
||||
|
||||
|
||||
@@ -74,11 +74,11 @@ export function MainNav({
|
||||
return (
|
||||
<aside
|
||||
className={cn(
|
||||
'relative flex h-full w-60 shrink-0 flex-col overflow-hidden bg-background-body transition-all',
|
||||
'relative flex h-full w-62 shrink-0 flex-col overflow-hidden bg-background-body p-1 transition-all',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div className="flex min-h-0 flex-1 flex-col">
|
||||
<div className="flex min-h-0 w-60 flex-1 flex-col overflow-hidden">
|
||||
<div className="flex items-center justify-between pt-3 pr-2 pb-2 pl-4">
|
||||
{renderLogo()}
|
||||
<MainNavSearchButton />
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ describe('useAvailableNodesMetaData', () => {
|
||||
expect(result.current.nodesMap?.[BlockEnum.IterationStart]?.metaData.helpLinkUri).toBeUndefined()
|
||||
expect(result.current.nodesMap?.[BlockEnum.LoopStart]?.metaData.helpLinkUri).toBeUndefined()
|
||||
expect(result.current.nodesMap?.[BlockEnum.LoopEnd]?.metaData.helpLinkUri).toBeUndefined()
|
||||
expect(result.current.nodesMap?.[BlockEnum.Start]?.metaData.helpLinkUri).toBe('/docs/use-dify/nodes/user-input')
|
||||
expect(result.current.nodesMap?.[BlockEnum.Start]?.metaData.helpLinkUri).toBe('/docs/use-dify/nodes/start')
|
||||
})
|
||||
|
||||
it('should expose Agent v2 instead of legacy Agent when Agent v2 is enabled', () => {
|
||||
|
||||
@@ -9,7 +9,7 @@ const metaData = genNodeMetaData({
|
||||
isRequired: false,
|
||||
isSingleton: true,
|
||||
isTypeFixed: true,
|
||||
helpLinkUri: 'user-input',
|
||||
helpLinkUri: 'start',
|
||||
})
|
||||
|
||||
const nodeDefault: NodeDefault<StartPlaceholderNodeType> = {
|
||||
|
||||
@@ -10,7 +10,7 @@ const metaData = genNodeMetaData({
|
||||
isRequired: false,
|
||||
isSingleton: true,
|
||||
isTypeFixed: false, // support node type change for start node(user input)
|
||||
helpLinkUri: 'user-input',
|
||||
helpLinkUri: 'start',
|
||||
})
|
||||
const nodeDefault: NodeDefault<StartNodeType> = {
|
||||
metaData,
|
||||
|
||||
@@ -178,6 +178,14 @@ describe('useDocLink', () => {
|
||||
expect(url).toBe(`${defaultDocBaseUrl}/en/cloud/use-dify/workspace/subscription-management#dify-for-education`)
|
||||
})
|
||||
|
||||
it('should use the self-host Start node docs path outside cloud edition', () => {
|
||||
mockConfig.IS_CLOUD_EDITION = false
|
||||
|
||||
const { result } = renderHook(() => useDocLink())
|
||||
const url = result.current('/use-dify/nodes/start')
|
||||
expect(url).toBe(`${defaultDocBaseUrl}/en/self-host/use-dify/nodes/start`)
|
||||
})
|
||||
|
||||
it('should use the existing self-host docs path for self-host-only product docs in cloud edition', () => {
|
||||
mockConfig.IS_CLOUD_EDITION = true
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useSetNeedRefreshAppList } from '@/app/components/apps/storage'
|
||||
import { usePluginDependencies } from '@/app/components/workflow/plugin-dependency/hooks'
|
||||
import { useAppContext } from '@/context/app-context'
|
||||
import { systemFeaturesQueryOptions } from '@/features/system-features/client'
|
||||
import { DSLImportStatus } from '@/models/app'
|
||||
import { useRouter } from '@/next/navigation'
|
||||
@@ -45,6 +46,7 @@ export const useImportDSL = () => {
|
||||
const { push } = useRouter()
|
||||
const invalidateAppList = useInvalidateAppList()
|
||||
const { data: systemFeatures } = useSuspenseQuery(systemFeaturesQueryOptions())
|
||||
const { userProfile, workspacePermissionKeys } = useAppContext()
|
||||
const isRbacEnabled = systemFeatures.rbac_enabled
|
||||
const [versions, setVersions] = useState<{ importedVersion: string, systemVersion: string }>()
|
||||
const importIdRef = useRef<string>('')
|
||||
@@ -95,7 +97,12 @@ export const useImportDSL = () => {
|
||||
setNeedRefresh('1')
|
||||
invalidateAppList()
|
||||
await handleCheckPluginDependencies(app_id)
|
||||
getRedirection({ id: app_id, mode: app_mode, permission_keys }, push, { isRbacEnabled })
|
||||
getRedirection({ id: app_id, mode: app_mode, permission_keys }, push, {
|
||||
currentUserId: userProfile?.id,
|
||||
resourceMaintainer: userProfile?.id,
|
||||
workspacePermissionKeys,
|
||||
isRbacEnabled,
|
||||
})
|
||||
}
|
||||
else if (status === DSLImportStatus.PENDING) {
|
||||
setVersions({
|
||||
@@ -117,7 +124,7 @@ export const useImportDSL = () => {
|
||||
finally {
|
||||
setIsFetching(false)
|
||||
}
|
||||
}, [isFetching, t, handleCheckPluginDependencies, isRbacEnabled, push, setNeedRefresh, invalidateAppList])
|
||||
}, [isFetching, t, handleCheckPluginDependencies, isRbacEnabled, push, setNeedRefresh, invalidateAppList, userProfile?.id, workspacePermissionKeys])
|
||||
|
||||
const handleImportDSLConfirm = useCallback(async (
|
||||
{
|
||||
@@ -146,7 +153,12 @@ export const useImportDSL = () => {
|
||||
await handleCheckPluginDependencies(app_id)
|
||||
setNeedRefresh('1')
|
||||
invalidateAppList()
|
||||
getRedirection({ id: app_id, mode: app_mode, permission_keys }, push, { isRbacEnabled })
|
||||
getRedirection({ id: app_id, mode: app_mode, permission_keys }, push, {
|
||||
currentUserId: userProfile?.id,
|
||||
resourceMaintainer: userProfile?.id,
|
||||
workspacePermissionKeys,
|
||||
isRbacEnabled,
|
||||
})
|
||||
}
|
||||
else if (status === DSLImportStatus.FAILED) {
|
||||
toast.error(t('newApp.appCreateFailed', { ns: 'app' }))
|
||||
@@ -160,7 +172,7 @@ export const useImportDSL = () => {
|
||||
finally {
|
||||
setIsFetching(false)
|
||||
}
|
||||
}, [isFetching, t, handleCheckPluginDependencies, isRbacEnabled, setNeedRefresh, push, invalidateAppList])
|
||||
}, [isFetching, t, handleCheckPluginDependencies, isRbacEnabled, setNeedRefresh, push, invalidateAppList, userProfile?.id, workspacePermissionKeys])
|
||||
|
||||
return {
|
||||
handleImportDSL,
|
||||
|
||||
@@ -74,6 +74,7 @@ type CloudPath =
|
||||
| '/cloud/use-dify/nodes/output'
|
||||
| '/cloud/use-dify/nodes/parameter-extractor'
|
||||
| '/cloud/use-dify/nodes/question-classifier'
|
||||
| '/cloud/use-dify/nodes/start'
|
||||
| '/cloud/use-dify/nodes/template'
|
||||
| '/cloud/use-dify/nodes/tools'
|
||||
| '/cloud/use-dify/nodes/trigger/overview'
|
||||
@@ -170,6 +171,7 @@ type UseDifyPath =
|
||||
| '/use-dify/nodes/output'
|
||||
| '/use-dify/nodes/parameter-extractor'
|
||||
| '/use-dify/nodes/question-classifier'
|
||||
| '/use-dify/nodes/start'
|
||||
| '/use-dify/nodes/template'
|
||||
| '/use-dify/nodes/tools'
|
||||
| '/use-dify/nodes/trigger/overview'
|
||||
@@ -356,6 +358,7 @@ type SelfHostPath =
|
||||
| '/self-host/use-dify/nodes/output'
|
||||
| '/self-host/use-dify/nodes/parameter-extractor'
|
||||
| '/self-host/use-dify/nodes/question-classifier'
|
||||
| '/self-host/use-dify/nodes/start'
|
||||
| '/self-host/use-dify/nodes/template'
|
||||
| '/self-host/use-dify/nodes/tools'
|
||||
| '/self-host/use-dify/nodes/trigger/overview'
|
||||
@@ -588,6 +591,7 @@ export const docPathProductAvailability: Record<string, readonly DocsProduct[]>
|
||||
'/use-dify/nodes/output': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/parameter-extractor': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/question-classifier': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/start': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/template': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/tools': ['cloud', 'self-host'],
|
||||
'/use-dify/nodes/trigger/overview': ['cloud', 'self-host'],
|
||||
|
||||
Reference in New Issue
Block a user