Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/support-resource-file-copy-path'…
Browse files Browse the repository at this point in the history
… into support-resource-file-copy-path

# Conflicts:
#	dinky-web/src/pages/RegCenter/Resource/components/FileTree/function.tsx
  • Loading branch information
Zzm0809 committed Feb 27, 2024
2 parents 7d84f7b + af609bc commit 6200ae9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ import { parseByteStr, renderIcon } from '@/utils/function';
import { l } from '@/utils/intl';
import { Typography } from 'antd';

const buildTitleLabel = (showCopy = false,item: ResourceInfo) => {

const buildTitleLabel = (showCopy = false, item: ResourceInfo) => {
const fillValue = `ADD FILE 'rs:${item.fullName}';`;

return (
<>
{(!item.isDirectory && showCopy) ?
<Typography.Text copyable={{text: fillValue, tooltips: l('rc.resource.copy','', {fillValue})}}>
{!item.isDirectory && showCopy ? (
<Typography.Text
copyable={{ text: fillValue, tooltips: l('rc.resource.copy', '', { fillValue }) }}
>
{item.fileName}
</Typography.Text>
: item.fileName
}
) : (
item.fileName
)}
{!item.isDirectory && (
<span style={{ color: 'gray' }}>
{' '}
Expand Down Expand Up @@ -91,7 +93,7 @@ export const buildResourceTreeData = (
data: ResourceInfo[] = [],
isFilterEmptyChildren = false,
filterSuffixList: string[] = [],
showCopy: boolean = false,
showCopy: boolean = false
): any =>
data
.filter((item: ResourceInfo) => filterEmpty(isFilterEmptyChildren, item, filterSuffixList))
Expand All @@ -103,10 +105,12 @@ export const buildResourceTreeData = (
label: item.fileName,
icon: <TagAlignCenter>{renderIcon(item.fileName, '.', item.isDirectory)}</TagAlignCenter>,
path: item.fullName,
title: buildTitleLabel(showCopy,item),
title: buildTitleLabel(showCopy, item),
fullInfo: item,
key: item.id,
id: item.id,
children: item.children && buildResourceTreeData(item.children, isFilterEmptyChildren,filterSuffixList, showCopy),
children:
item.children &&
buildResourceTreeData(item.children, isFilterEmptyChildren, filterSuffixList, showCopy)
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => {
selectedKeys={selectedKeys}
onSelect={(_, info) => onNodeClick(info)}
onRightClick={(info) => onRightClick(info)}
treeData={buildResourceTreeData(treeData,false ,[], true)}
treeData={buildResourceTreeData(treeData, false, [], true)}
/>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
Expand Down

0 comments on commit 6200ae9

Please sign in to comment.