mirror of
https://github.com/langgenius/dify.git
synced 2026-04-23 04:06:13 +08:00
fix(web): truncate long parent paths in skill file-tree search results
This commit is contained in:
@ -83,6 +83,23 @@ describe('SearchResultList', () => {
|
||||
expect(screen.queryByText('readme.md')).not.toBeInTheDocument()
|
||||
expect(screen.queryByRole('button')).not.toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('should apply truncation semantics to long parent paths', () => {
|
||||
const longParentPath = 'docx/scripts/office/schemas/ISO-IEC29500-4_2016/very/deep/path'
|
||||
const treeChildren = [
|
||||
createNode({
|
||||
id: 'file-1',
|
||||
name: 'sample.md',
|
||||
path: `/${longParentPath}/sample.md`,
|
||||
}),
|
||||
]
|
||||
|
||||
render(<SearchResultList searchTerm="sample" treeChildren={treeChildren} />)
|
||||
|
||||
const parentPath = screen.getByText(longParentPath)
|
||||
expect(parentPath).toHaveClass('truncate', 'text-right')
|
||||
expect(parentPath).toHaveAttribute('title', longParentPath)
|
||||
})
|
||||
})
|
||||
|
||||
// File and folder actions should dispatch the correct store operations.
|
||||
|
||||
@ -53,7 +53,8 @@ const SearchResultRow = ({ node, parentPath, treeChildren }: SearchResultRowProp
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
className={cn(
|
||||
'flex h-6 w-full cursor-pointer items-center rounded-md px-2',
|
||||
'flex h-6 w-full items-center gap-2 overflow-hidden rounded-md px-2',
|
||||
'cursor-pointer',
|
||||
'hover:bg-state-base-hover',
|
||||
isActive && 'bg-state-base-active',
|
||||
)}
|
||||
@ -84,7 +85,10 @@ const SearchResultRow = ({ node, parentPath, treeChildren }: SearchResultRowProp
|
||||
</span>
|
||||
</div>
|
||||
{parentPath && (
|
||||
<span className="shrink-0 text-text-tertiary system-xs-regular">
|
||||
<span
|
||||
title={parentPath}
|
||||
className="block min-w-0 max-w-[45%] truncate text-right text-text-tertiary system-xs-regular"
|
||||
>
|
||||
{parentPath}
|
||||
</span>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user