Unverified Commit fadcbdbd authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Feature][resource]added resource layout (#2094)

parent 7950c5f9
...@@ -155,6 +155,12 @@ export default [ ...@@ -155,6 +155,12 @@ export default [
icon: 'ToolOutlined', icon: 'ToolOutlined',
component: './RegCenter/UDF', component: './RegCenter/UDF',
}, },
{
path: '/registration/resource',
name: 'resource',
icon: 'FileZipOutlined',
component: './RegCenter/Resource',
},
], ],
}, },
{ {
......
...@@ -284,6 +284,7 @@ ol { ...@@ -284,6 +284,7 @@ ol {
*/ */
.needWrap { .needWrap {
white-space: pre-wrap; white-space: pre-wrap;
align-content: center;
} }
.query-form{ .query-form{
......
...@@ -90,9 +90,7 @@ export default { ...@@ -90,9 +90,7 @@ export default {
'tips.selected': 'Selected {total} Item', 'tips.selected': 'Selected {total} Item',
'tips.notSelected': 'Not Select', 'tips.notSelected': 'Not Select',
'tips.enter': 'Please Enter', 'tips.enter': 'Please Enter',
'tips.confirm.logout.session': 'Confirm logout session [{sessionName}] ?',
'tips.confirm.delete.table': ' Are you sure you want to delete table [{tableName}]?', 'tips.confirm.delete.table': ' Are you sure you want to delete table [{tableName}]?',
'tips.create.session.success': 'Create Session [{session}] success!',
'status.enabled': 'Enabled', 'status.enabled': 'Enabled',
'status.disabled': 'Disabled', 'status.disabled': 'Disabled',
......
...@@ -51,6 +51,7 @@ export default { ...@@ -51,6 +51,7 @@ export default {
'menu.registration.fragment': 'Global Variable', 'menu.registration.fragment': 'Global Variable',
'menu.registration.gitprojects': 'Git Project(Beta)', 'menu.registration.gitprojects': 'Git Project(Beta)',
'menu.registration.udf': 'UDF Template', 'menu.registration.udf': 'UDF Template',
'menu.registration.resource': 'Resource',
'menu.auth': 'Auth Center', 'menu.auth': 'Auth Center',
'menu.auth.user': 'User', 'menu.auth.user': 'User',
'menu.auth.role': 'Role', 'menu.auth.role': 'Role',
......
...@@ -507,6 +507,10 @@ export default { ...@@ -507,6 +507,10 @@ export default {
'rc.template.create': 'Create UDF Template', 'rc.template.create': 'Create UDF Template',
'rc.template.modify': 'Modify UDF Template', 'rc.template.modify': 'Modify UDF Template',
// resource
'rc.resource.click': 'Click left file to view details',
'rc.resource.noResource': '\t\tNo resources\nPlease Click the button above to upload folders/files',
'rc.resource.upload': 'Upload Files/Folders',
//-------------------------------- setting center -------------------------------- //-------------------------------- setting center --------------------------------
//setting //setting
......
...@@ -91,9 +91,7 @@ export default { ...@@ -91,9 +91,7 @@ export default {
'tips.selected': '已选择 {total} 项', 'tips.selected': '已选择 {total} 项',
'tips.notSelected': '未选', 'tips.notSelected': '未选',
'tips.enter': '请输入', 'tips.enter': '请输入',
'tips.confirm.logout.session': '确认注销会话【{sessionName}】 吗?',
'tips.confirm.delete.table': '确定删除表【{tableName}】吗?', 'tips.confirm.delete.table': '确定删除表【{tableName}】吗?',
'tips.create.session.success': '创建会话【{session}】成功!',
'status.enabled': '启用', 'status.enabled': '启用',
'status.disabled': '禁用', 'status.disabled': '禁用',
......
...@@ -51,6 +51,7 @@ export default { ...@@ -51,6 +51,7 @@ export default {
'menu.registration.fragment': '全局变量', 'menu.registration.fragment': '全局变量',
'menu.registration.gitprojects': 'Git 项目(Beta)', 'menu.registration.gitprojects': 'Git 项目(Beta)',
'menu.registration.udf': 'UDF 模板', 'menu.registration.udf': 'UDF 模板',
'menu.registration.resource': '资源',
'menu.auth': '认证中心', 'menu.auth': '认证中心',
'menu.auth.user': '用户', 'menu.auth.user': '用户',
'menu.auth.role': '角色', 'menu.auth.role': '角色',
......
...@@ -507,6 +507,12 @@ export default { ...@@ -507,6 +507,12 @@ export default {
'rc.template.create': '创建 UDF 模板', 'rc.template.create': '创建 UDF 模板',
'rc.template.modify': '修改 UDF 模板', 'rc.template.modify': '修改 UDF 模板',
// resource
'rc.resource.click': '点击左侧文件查看详情',
'rc.resource.noResource': '\t\t暂无资源\n请点击上方按钮上传文件夹/文件',
'rc.resource.upload': '上传文件夹/文件',
//-------------------------------- setting center -------------------------------- //-------------------------------- setting center --------------------------------
//setting //setting
......
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React from "react";
import {l} from "@/utils/intl";
import CodeShow from "@/components/CustomEditor/CodeShow";
import {Empty} from "antd";
const CodeEditProps = {
height: "82vh",
width: "100%",
lineNumbers: "on",
language: "java",
};
type FileShowProps = {
code: string;
refreshLogCallback: () => void;
}
const FileShow: React.FC<FileShowProps> = (props) => {
const {code, refreshLogCallback} = props;
const restLogsShowProps = {
showFloatButton: true,
code,
refreshLogCallback,
};
return <>
{ code ? <CodeShow {...restLogsShowProps} {...CodeEditProps} />
: <Empty className={"code-content-empty"} description={l('rc.resource.click')}/>
}
</>;
}
export default FileShow;
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React from "react";
import {buildTreeData} from "@/utils/function";
import {Button, Tree, Typography, Upload} from "antd";
import {UploadOutlined} from "@ant-design/icons";
import {l} from "@/utils/intl";
const {DirectoryTree} = Tree;
const {Text} = Typography;
type FileTreeProps = {
treeData: Partial<any>[];
onNodeClick: (info: any) => void
onRightClick: (info: any) => void
}
const FileTree: React.FC<FileTreeProps> = (props) => {
const {treeData, onNodeClick, onRightClick} = props;
return <>
<DirectoryTree
onSelect={(_, info) => onNodeClick(info)}
onRightClick={info => onRightClick(info)}
treeData={buildTreeData(treeData)}
/>
{
(treeData.length > 0) ?
<DirectoryTree
onSelect={(_, info) => onNodeClick(info)}
treeData={buildTreeData(treeData)}
/> :
<>
<div style={{marginTop: '40vh', marginLeft: '1vw'}}>
<Upload action="https://www.mocky.io/v2/5cc8019d300000980a055e76" directory>
<Button icon={<UploadOutlined/>}>{l('rc.resource.upload')}</Button>
</Upload><br/>
</div>
<Text className={'needWrap'} type="warning">{l('rc.resource.noResource')}</Text>
</>
}
</>;
}
export default FileTree;
\ No newline at end of file
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React, {useState} from "react";
import {ProCard} from "@ant-design/pro-components";
import FileTree from "@/pages/RegCenter/Resource/components/FileTree";
import FileShow from "@/pages/RegCenter/Resource/components/FileShow";
import {Dropdown, Menu} from "antd";
import {DeleteOutlined, UploadOutlined} from "@ant-design/icons";
import {MenuInfo} from "rc-menu/es/interface";
import {l} from "@/utils/intl";
const ResourceOverView: React.FC = () => {
const [treeData, setTreeData] = useState<Partial<any>[]>([]);
const handleNodeClick = async (info: any) => {
const {node: {path, isLeaf}} = info;
if (isLeaf) {
console.log(path)
// setClickFileName(path);
// await queryLogContent(path);
}
};
const [rightClickedNode, setRightClickedNode] = useState(null);
const handleRightClick = (info: any) => {
// 阻止默认的右键菜单事件
info.event.preventDefault();
// 获取右键点击的节点信息
const {node} = info;
setRightClickedNode(node);
};
const handleUpload = () => {
if (rightClickedNode) {
// todo: upload
}
};
const handleDelete = () => {
if (rightClickedNode) {
// todo: delete
}
};
const handleMenuClick = (node: MenuInfo) => {
switch (node.key) {
case 'upload':
handleUpload();
break;
case 'delete':
handleDelete();
break;
default:
break;
}
};
const contextMenuItems = [
{
key: 'upload',
icon: <UploadOutlined/>,
label: l('button.upload'),
},
{
key: 'delete',
icon: <DeleteOutlined/>,
label: l('button.delete'),
},
]
const renderContextMenu = () => {
return (
<Menu
disabledOverflow
onClick={handleMenuClick}
items={contextMenuItems}
/>
);
};
return <>
<ProCard>
<ProCard hoverable colSpan={'18%'} className={"schemaTree"}>
<Dropdown overlay={renderContextMenu}>
<FileTree
treeData={treeData}
onRightClick={handleRightClick}
onNodeClick={(info: any) => handleNodeClick(info)}
/>
</Dropdown>
</ProCard>
<ProCard.Divider type={"vertical"}/>
<ProCard hoverable className={"schemaTree"}>
<FileShow
code={''}
refreshLogCallback={() => {
}}
/>
</ProCard>
</ProCard>
</>
}
export default ResourceOverView;
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import ResourceOverView from "@/pages/RegCenter/Resource/components/ResourceOverView";
export default () => {
return <>
<ResourceOverView/>
</>
}
\ No newline at end of file
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