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` (
`type` tinyint(4) DEFAULT null COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT null COMMENT 'resource size',
`pid` int(11) DEFAULT null,
`full_name` varchar(128) DEFAULT null,
`full_name` text DEFAULT null,
`is_directory` tinyint(4) DEFAULT null,
`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',
......
......@@ -975,6 +975,8 @@ export default {
'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.sync': 'Sync remote files',
'rc.resource.copy': 'Copy as: {fillValue}',
'rc.template.codeType': 'Code Type',
'rc.template.codeTypePlaceholder': 'Please select code type! ',
'rc.template.create': 'Create UDF Template',
......
......@@ -934,6 +934,7 @@ export default {
'rc.resource.upload.tip2': '支持单个或批量上传。严禁上传公司数据或其他禁止上传的文件。',
'rc.resource.filelist': '文件列表',
'rc.resource.sync': '同步目录结构',
'rc.resource.copy': '复制为: {fillValue}',
'rc.template.codeType': '代码类型',
'rc.template.codeTypePlaceholder': '请选择代码类型!',
......
......@@ -21,11 +21,22 @@ import { TagAlignCenter } from '@/components/StyledComponents';
import { ResourceInfo } from '@/types/RegCenter/data';
import { parseByteStr, renderIcon } from '@/utils/function';
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 (
<>
{item.fileName}
{!item.isDirectory && showCopy ? (
<Typography.Text
copyable={{ text: fillValue, tooltips: l('rc.resource.copy', '', { fillValue }) }}
>
{item.fileName}
</Typography.Text>
) : (
item.fileName
)}
{!item.isDirectory && (
<span style={{ color: 'gray' }}>
{' '}
......@@ -79,9 +90,10 @@ function filterEmpty(
}
export const buildResourceTreeData = (
data: ResourceInfo[],
data: ResourceInfo[] = [],
isFilterEmptyChildren = false,
filterSuffixList: string[] = []
filterSuffixList: string[] = [],
showCopy: boolean = false
): any =>
data
.filter((item: ResourceInfo) => filterEmpty(isFilterEmptyChildren, item, filterSuffixList))
......@@ -90,13 +102,15 @@ export const buildResourceTreeData = (
isLeaf: !item.isDirectory,
name: item.fileName,
parentId: item.pid,
label: item.fullName + '/' + item.fileName,
label: item.fileName,
icon: <TagAlignCenter>{renderIcon(item.fileName, '.', item.isDirectory)}</TagAlignCenter>,
path: item.fullName,
title: buildTitleLabel(item),
title: buildTitleLabel(showCopy, item),
fullInfo: item,
key: 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) => {
selectedKeys={selectedKeys}
onSelect={(_, info) => onNodeClick(info)}
onRightClick={(info) => onRightClick(info)}
treeData={buildResourceTreeData(treeData)}
treeData={buildResourceTreeData(treeData, false, [], true)}
/>
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
......
......@@ -248,15 +248,15 @@ const ResourceOverView: React.FC = () => {
<ProCard ghost size={'small'} bodyStyle={{ height: parent.innerHeight - 80 }}>
<SplitPane
split={'vertical'}
defaultSizes={[150, 500]}
minSize={150}
defaultSizes={[200, 500]}
minSize={200}
className={'split-pane'}
>
<Pane
className={'split-pane'}
forwardRef={refObject}
minSize={100}
size={100}
minSize={200}
size={200}
split={'horizontal'}
>
<ProCard
......
......@@ -1651,7 +1651,7 @@ CREATE TABLE `dinky_git_project` (
`operator` int(11) DEFAULT NULL COMMENT 'operator',
PRIMARY KEY (`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
......@@ -1678,7 +1678,7 @@ CREATE TABLE `dinky_metrics` (
`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',
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
......@@ -1686,13 +1686,13 @@ CREATE TABLE `dinky_metrics` (
DROP TABLE IF EXISTS dinky_resources;
CREATE TABLE `dinky_resources` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`file_name` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'file name',
`description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`file_name` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'file name',
`description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`user_id` int(11) DEFAULT NULL COMMENT 'user id',
`type` tinyint(4) DEFAULT NULL COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT NULL COMMENT 'resource size',
`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,
`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',
......@@ -1700,7 +1700,7 @@ CREATE TABLE `dinky_resources` (
`updater` int(11) DEFAULT NULL COMMENT 'updater',
PRIMARY KEY (`id`),
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
-- ----------------------------
......@@ -1770,7 +1770,7 @@ create table `dinky_sys_menu` (
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
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
......@@ -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',
PRIMARY KEY (`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
......@@ -1958,7 +1958,7 @@ CREATE TABLE `dinky_alert_template` (
`creator` int(11) DEFAULT NULL COMMENT 'create user id',
`updater` int(11) DEFAULT NULL COMMENT 'update user 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` (
`updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`),
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` (
`updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`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
......@@ -2043,6 +2043,6 @@ CREATE TABLE `dinky_sys_token` (
PRIMARY KEY (`id`),
UNIQUE KEY `token_value` (`token_value`) USING BTREE,
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;
......@@ -3418,7 +3418,7 @@ CREATE TABLE "public"."dinky_resources"
"type" int2,
"size" int8,
"pid" int4,
"full_name" varchar(128) COLLATE "pg_catalog"."default",
"full_name" text COLLATE "pg_catalog"."default",
"is_directory" int2,
"create_time" timestamp(6) NOT null,
"update_time" timestamp(6) NOT null,
......
......@@ -106,7 +106,7 @@ CREATE TABLE `dinky_git_project` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
PRIMARY KEY (`id`) USING BTREE,
KEY `tenant_id` (`tenant_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='git project';
ALTER TABLE dinky_role_select_permissions RENAME TO dinky_row_permissions;
......@@ -131,7 +131,7 @@ CREATE TABLE `dinky_metrics` (
`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',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='metrics layout';
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC collate = utf8mb4_general_ci COMMENT='metrics layout';
-- ----------------------------
......@@ -139,19 +139,19 @@ CREATE TABLE `dinky_metrics` (
-- ----------------------------
CREATE TABLE `dinky_resources` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'key',
`file_name` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'file name',
`description` varchar(255) COLLATE utf8_bin DEFAULT NULL,
`file_name` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'file name',
`description` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
`user_id` int(11) DEFAULT NULL COMMENT 'user id',
`type` tinyint(4) DEFAULT NULL COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT NULL COMMENT 'resource size',
`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,
`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',
PRIMARY KEY (`id`),
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 COMMENT='resource table';
ALTER TABLE dinky_database modify password varchar(512) null comment 'password';
......@@ -245,54 +245,56 @@ CREATE TABLE `dinky_sys_role_menu` (
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
create table if not exists dinky_alert_template
(
id int auto_increment
primary key COMMENT 'id',
name varchar(20) unicode COMMENT 'template name',
template_content text null COMMENT 'template content',
enabled tinyint default 1 null COMMENT 'is enable',
create_time datetime null COMMENT 'create time',
update_time datetime null COMMENT 'update time'
);
create table if not exists dinky_alert_rules
(
id int auto_increment
primary key comment 'id',
name varchar(40) unique not null comment 'rule name',
rule text null comment 'specify rule',
template_id int null comment 'template id',
rule_type varchar(10) null comment 'alert rule type',
trigger_conditions varchar(20) null comment 'trigger conditions',
description text null comment 'description',
enabled tinyint default 1 null comment 'is enable',
create_time datetime null comment 'create time',
update_time datetime null comment 'update time'
);
CREATE TABLE if not exists `dinky_alert_template` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(20) CHARACTER SET ucs2 COLLATE ucs2_general_ci DEFAULT NULL COMMENT 'template name',
`template_content` text COLLATE utf8mb4_general_ci COMMENT 'template content',
`enabled` tinyint DEFAULT '1' COMMENT 'is enable',
`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',
`creator` int(11) DEFAULT NULL COMMENT 'create user id',
`updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='alert template';
CREATE TABLE if not exists `dinky_alert_rules` (
`id` int NOT NULL AUTO_INCREMENT COMMENT 'id',
`name` varchar(40) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'rule name',
`rule` text COLLATE utf8mb4_general_ci COMMENT 'specify rule',
`template_id` int DEFAULT NULL COMMENT 'template id',
`rule_type` varchar(10) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'alert rule type',
`trigger_conditions` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'trigger conditions',
`description` text COLLATE utf8mb4_general_ci COMMENT 'description',
`enabled` tinyint DEFAULT 1 COMMENT 'is enable',
`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',
`creator` int(11) DEFAULT NULL COMMENT 'create user id',
`updater` int(11) DEFAULT NULL COMMENT 'update user id',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='alert rule';
-- ----------------------------
-- Table structure dinky_sys_token
-- ----------------------------
CREATE TABLE `dinky_sys_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`token_value` varchar(255) NOT NULL COMMENT 'token value',
`user_id` bigint(20) NOT NULL COMMENT 'user id',
`role_id` bigint(20) NOT NULL COMMENT 'role id',
`tenant_id` bigint(20) NOT NULL COMMENT 'tenant id',
`expire_type` tinyint(4) NOT NULL COMMENT '1: never expire, 2: expire after a period of time, 3: expire at a certain time',
`expire_start_time` datetime DEFAULT NULL COMMENT 'expire start time ,when expire_type = 3 , it is the start time of the period',
`expire_end_time` datetime DEFAULT NULL COMMENT 'expire end time ,when expire_type = 2,3 , it is the end time of the period',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'modify time',
`creator` bigint(20) DEFAULT NULL COMMENT '创建人',
`updator` bigint(20) DEFAULT NULL COMMENT '修改人',
`source` tinyint(2) DEFAULT NULL COMMENT '1:login 2:custom',
PRIMARY KEY (`id`),
UNIQUE KEY `token_value` (`token_value`) USING BTREE,
KEY `source` (`source`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COMMENT='token management';
CREATE TABLE if not exists `dinky_sys_token` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
`token_value` varchar(255) NOT NULL COMMENT 'token value',
`user_id` bigint(20) NOT NULL COMMENT 'user id',
`role_id` bigint(20) NOT NULL COMMENT 'role id',
`tenant_id` bigint(20) NOT NULL COMMENT 'tenant id',
`expire_type` tinyint(4) NOT NULL COMMENT '1: never expire, 2: expire after a period of time, 3: expire at a certain time',
`expire_start_time` datetime DEFAULT NULL COMMENT 'expire start time ,when expire_type = 3 , it is the start time of the period',
`expire_end_time` datetime DEFAULT NULL COMMENT 'expire end time ,when expire_type = 2,3 , it is the end time of the period',
`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',
`source` tinyint(2) DEFAULT NULL COMMENT '1:login 2:custom',
`creator` int(20) DEFAULT NULL COMMENT '创建人',
`updater` int(20) DEFAULT NULL COMMENT '修改人',
PRIMARY KEY (`id`),
UNIQUE KEY `token_value` (`token_value`) USING BTREE,
KEY `source` (`source`) USING HASH
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC collate = utf8mb4_general_ci COMMENT='token management';
CREATE TABLE `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
......
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