Unverified Commit 81689c18 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Featue] support resource file copy path (#3188)

parent 4ffb9336
...@@ -469,7 +469,7 @@ CREATE TABLE `dinky_resources` ( ...@@ -469,7 +469,7 @@ CREATE TABLE `dinky_resources` (
`type` tinyint(4) DEFAULT null COMMENT 'resource type,0:FILE,1:UDF', `type` tinyint(4) DEFAULT null COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT null COMMENT 'resource size', `size` bigint(20) DEFAULT null COMMENT 'resource size',
`pid` int(11) DEFAULT null, `pid` int(11) DEFAULT null,
`full_name` varchar(128) DEFAULT null, `full_name` text DEFAULT null,
`is_directory` tinyint(4) DEFAULT null, `is_directory` tinyint(4) DEFAULT null,
`create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', `create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', `update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
......
...@@ -975,6 +975,8 @@ export default { ...@@ -975,6 +975,8 @@ export default {
'Support for a single or bulk upload. Strictly prohibited from uploading company data or\n other banned files.', 'Support for a single or bulk upload. Strictly prohibited from uploading company data or\n other banned files.',
'rc.resource.filelist': 'File list', 'rc.resource.filelist': 'File list',
'rc.resource.sync': 'Sync remote files', 'rc.resource.sync': 'Sync remote files',
'rc.resource.copy': 'Copy as: {fillValue}',
'rc.template.codeType': 'Code Type', 'rc.template.codeType': 'Code Type',
'rc.template.codeTypePlaceholder': 'Please select code type! ', 'rc.template.codeTypePlaceholder': 'Please select code type! ',
'rc.template.create': 'Create UDF Template', 'rc.template.create': 'Create UDF Template',
......
...@@ -934,6 +934,7 @@ export default { ...@@ -934,6 +934,7 @@ export default {
'rc.resource.upload.tip2': '支持单个或批量上传。严禁上传公司数据或其他禁止上传的文件。', 'rc.resource.upload.tip2': '支持单个或批量上传。严禁上传公司数据或其他禁止上传的文件。',
'rc.resource.filelist': '文件列表', 'rc.resource.filelist': '文件列表',
'rc.resource.sync': '同步目录结构', 'rc.resource.sync': '同步目录结构',
'rc.resource.copy': '复制为: {fillValue}',
'rc.template.codeType': '代码类型', 'rc.template.codeType': '代码类型',
'rc.template.codeTypePlaceholder': '请选择代码类型!', 'rc.template.codeTypePlaceholder': '请选择代码类型!',
......
...@@ -21,11 +21,22 @@ import { TagAlignCenter } from '@/components/StyledComponents'; ...@@ -21,11 +21,22 @@ import { TagAlignCenter } from '@/components/StyledComponents';
import { ResourceInfo } from '@/types/RegCenter/data'; import { ResourceInfo } from '@/types/RegCenter/data';
import { parseByteStr, renderIcon } from '@/utils/function'; import { parseByteStr, renderIcon } from '@/utils/function';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { Typography } from 'antd';
const buildTitleLabel = (showCopy = false, item: ResourceInfo) => {
const fillValue = `ADD FILE 'rs:${item.fullName}';`;
const buildTitleLabel = (item: ResourceInfo) => {
return ( return (
<> <>
{item.fileName} {!item.isDirectory && showCopy ? (
<Typography.Text
copyable={{ text: fillValue, tooltips: l('rc.resource.copy', '', { fillValue }) }}
>
{item.fileName}
</Typography.Text>
) : (
item.fileName
)}
{!item.isDirectory && ( {!item.isDirectory && (
<span style={{ color: 'gray' }}> <span style={{ color: 'gray' }}>
{' '} {' '}
...@@ -79,9 +90,10 @@ function filterEmpty( ...@@ -79,9 +90,10 @@ function filterEmpty(
} }
export const buildResourceTreeData = ( export const buildResourceTreeData = (
data: ResourceInfo[], data: ResourceInfo[] = [],
isFilterEmptyChildren = false, isFilterEmptyChildren = false,
filterSuffixList: string[] = [] filterSuffixList: string[] = [],
showCopy: boolean = false
): any => ): any =>
data data
.filter((item: ResourceInfo) => filterEmpty(isFilterEmptyChildren, item, filterSuffixList)) .filter((item: ResourceInfo) => filterEmpty(isFilterEmptyChildren, item, filterSuffixList))
...@@ -90,13 +102,15 @@ export const buildResourceTreeData = ( ...@@ -90,13 +102,15 @@ export const buildResourceTreeData = (
isLeaf: !item.isDirectory, isLeaf: !item.isDirectory,
name: item.fileName, name: item.fileName,
parentId: item.pid, parentId: item.pid,
label: item.fullName + '/' + item.fileName, label: item.fileName,
icon: <TagAlignCenter>{renderIcon(item.fileName, '.', item.isDirectory)}</TagAlignCenter>, icon: <TagAlignCenter>{renderIcon(item.fileName, '.', item.isDirectory)}</TagAlignCenter>,
path: item.fullName, path: item.fullName,
title: buildTitleLabel(item), title: buildTitleLabel(showCopy, item),
fullInfo: item, fullInfo: item,
key: item.id, key: item.id,
id: item.id, id: item.id,
children: item.children && buildResourceTreeData(item.children, isFilterEmptyChildren) children:
item.children &&
buildResourceTreeData(item.children, isFilterEmptyChildren, filterSuffixList, showCopy)
}; };
}); });
...@@ -50,7 +50,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => { ...@@ -50,7 +50,7 @@ const FileTree: React.FC<FileTreeProps> = (props) => {
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
onSelect={(_, info) => onNodeClick(info)} onSelect={(_, info) => onNodeClick(info)}
onRightClick={(info) => onRightClick(info)} onRightClick={(info) => onRightClick(info)}
treeData={buildResourceTreeData(treeData)} treeData={buildResourceTreeData(treeData, false, [], true)}
/> />
) : ( ) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} /> <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
......
...@@ -248,15 +248,15 @@ const ResourceOverView: React.FC = () => { ...@@ -248,15 +248,15 @@ const ResourceOverView: React.FC = () => {
<ProCard ghost size={'small'} bodyStyle={{ height: parent.innerHeight - 80 }}> <ProCard ghost size={'small'} bodyStyle={{ height: parent.innerHeight - 80 }}>
<SplitPane <SplitPane
split={'vertical'} split={'vertical'}
defaultSizes={[150, 500]} defaultSizes={[200, 500]}
minSize={150} minSize={200}
className={'split-pane'} className={'split-pane'}
> >
<Pane <Pane
className={'split-pane'} className={'split-pane'}
forwardRef={refObject} forwardRef={refObject}
minSize={100} minSize={200}
size={100} size={200}
split={'horizontal'} split={'horizontal'}
> >
<ProCard <ProCard
......
...@@ -1651,7 +1651,7 @@ CREATE TABLE `dinky_git_project` ( ...@@ -1651,7 +1651,7 @@ CREATE TABLE `dinky_git_project` (
`operator` int(11) DEFAULT NULL COMMENT 'operator', `operator` int(11) DEFAULT NULL COMMENT 'operator',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
KEY `tenant_id` (`tenant_id`) USING BTREE KEY `tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4; ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='git project' ROW_FORMAT=DYNAMIC;
-- ---------------------------- -- ----------------------------
-- Records of dinky_git_project -- Records of dinky_git_project
...@@ -1678,7 +1678,7 @@ CREATE TABLE `dinky_metrics` ( ...@@ -1678,7 +1678,7 @@ CREATE TABLE `dinky_metrics` (
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='metrics layout'; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='metrics layout';
-- ---------------------------- -- ----------------------------
-- Table structure for dinky_resources -- Table structure for dinky_resources
...@@ -1686,13 +1686,13 @@ CREATE TABLE `dinky_metrics` ( ...@@ -1686,13 +1686,13 @@ CREATE TABLE `dinky_metrics` (
DROP TABLE IF EXISTS dinky_resources; DROP TABLE IF EXISTS dinky_resources;
CREATE TABLE `dinky_resources` ( CREATE TABLE `dinky_resources` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key', `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`file_name` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'file name', `file_name` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'file name',
`description` varchar(255) COLLATE utf8_bin DEFAULT NULL, `description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`user_id` int(11) DEFAULT NULL COMMENT 'user id', `user_id` int(11) DEFAULT NULL COMMENT 'user id',
`type` tinyint(4) DEFAULT NULL COMMENT 'resource type,0:FILE,1:UDF', `type` tinyint(4) DEFAULT NULL COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT NULL COMMENT 'resource size', `size` bigint(20) DEFAULT NULL COMMENT 'resource size',
`pid` int(11) DEFAULT NULL, `pid` int(11) DEFAULT NULL,
`full_name` varchar(128) COLLATE utf8_bin DEFAULT NULL, `full_name` text COLLATE utf8mb4_general_ci DEFAULT NULL,
`is_directory` tinyint(4) DEFAULT NULL, `is_directory` tinyint(4) DEFAULT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time', `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time', `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
...@@ -1700,7 +1700,7 @@ CREATE TABLE `dinky_resources` ( ...@@ -1700,7 +1700,7 @@ CREATE TABLE `dinky_resources` (
`updater` int(11) DEFAULT NULL COMMENT 'updater', `updater` int(11) DEFAULT NULL COMMENT 'updater',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `dinky_resources_un` (`full_name`,`type`) UNIQUE KEY `dinky_resources_un` (`full_name`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- ---------------------------- -- ----------------------------
-- Records of dinky_resources -- Records of dinky_resources
-- ---------------------------- -- ----------------------------
...@@ -1770,7 +1770,7 @@ create table `dinky_sys_menu` ( ...@@ -1770,7 +1770,7 @@ create table `dinky_sys_menu` (
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time', `update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL, `note` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
primary key (`id`) using btree primary key (`id`) using btree
) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_general_ci; ) engine=innodb auto_increment=1 default charset=utf8mb4 collate=utf8mb4_general_ci comment='system menu' row_format=dynamic;
-- ---------------------------- -- ----------------------------
-- Records of dinky_sys_menu -- Records of dinky_sys_menu
...@@ -1942,7 +1942,7 @@ CREATE TABLE `dinky_sys_role_menu` ( ...@@ -1942,7 +1942,7 @@ CREATE TABLE `dinky_sys_role_menu` (
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time', `update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `un_role_menu_inx` (`role_id`,`menu_id`) USING BTREE UNIQUE KEY `un_role_menu_inx` (`role_id`,`menu_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='role menu';
-- ---------------------------- -- ----------------------------
-- Table structure dinky_sys_alert -- Table structure dinky_sys_alert
...@@ -1958,7 +1958,7 @@ CREATE TABLE `dinky_alert_template` ( ...@@ -1958,7 +1958,7 @@ CREATE TABLE `dinky_alert_template` (
`creator` int(11) DEFAULT NULL COMMENT 'create user id', `creator` int(11) DEFAULT NULL COMMENT 'create user id',
`updater` int(11) DEFAULT NULL COMMENT 'update user id', `updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='alert template';
...@@ -1978,7 +1978,7 @@ CREATE TABLE `dinky_alert_rules` ( ...@@ -1978,7 +1978,7 @@ CREATE TABLE `dinky_alert_rules` (
`updater` int(11) DEFAULT NULL COMMENT 'update user id', `updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`) UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='alert rule';
...@@ -2020,7 +2020,7 @@ CREATE TABLE `dinky_udf_manage` ( ...@@ -2020,7 +2020,7 @@ CREATE TABLE `dinky_udf_manage` (
`updater` int(11) DEFAULT NULL COMMENT 'update user id', `updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`) USING BTREE, PRIMARY KEY (`id`) USING BTREE,
KEY `name,resources_id` (`name`,`resources_id`) USING BTREE KEY `name,resources_id` (`name`,`resources_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='udf'; ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='udf';
-- ---------------------------- -- ----------------------------
-- Table structure dinky_sys_token -- Table structure dinky_sys_token
...@@ -2043,6 +2043,6 @@ CREATE TABLE `dinky_sys_token` ( ...@@ -2043,6 +2043,6 @@ CREATE TABLE `dinky_sys_token` (
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
UNIQUE KEY `token_value` (`token_value`) USING BTREE, UNIQUE KEY `token_value` (`token_value`) USING BTREE,
KEY `source` (`source`) USING HASH KEY `source` (`source`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COMMENT='token management'; ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC collate = utf8mb4_general_ci COMMENT='token management';
SET FOREIGN_KEY_CHECKS = 1; SET FOREIGN_KEY_CHECKS = 1;
...@@ -3418,7 +3418,7 @@ CREATE TABLE "public"."dinky_resources" ...@@ -3418,7 +3418,7 @@ CREATE TABLE "public"."dinky_resources"
"type" int2, "type" int2,
"size" int8, "size" int8,
"pid" int4, "pid" int4,
"full_name" varchar(128) COLLATE "pg_catalog"."default", "full_name" text COLLATE "pg_catalog"."default",
"is_directory" int2, "is_directory" int2,
"create_time" timestamp(6) NOT null, "create_time" timestamp(6) NOT null,
"update_time" timestamp(6) NOT null, "update_time" timestamp(6) NOT null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment