Unverified Commit 2cde200a authored by aiwenmo's avatar aiwenmo Committed by GitHub

[Feature-987][admin] ClusterConfig and jar add upload file (#988)

Co-authored-by: 's avatarwenmo <32723967+wenmo@users.noreply.github.com>
parent 4f04d9ad
...@@ -197,22 +197,9 @@ ...@@ -197,22 +197,9 @@
</dependency> </dependency>
<!-- hadoop --> <!-- hadoop -->
<dependency> <dependency>
<groupId>org.apache.hadoop</groupId> <groupId>com.dlink</groupId>
<artifactId>hadoop-hdfs</artifactId> <artifactId>dlink-client-hadoop</artifactId>
<version>3.3.2</version> <scope>${scope.runtime}</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs-client</artifactId>
<version>3.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-common</artifactId>
<version>3.3.2</version>
<scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -45,7 +45,7 @@ public class UploadFileConstant { ...@@ -45,7 +45,7 @@ public class UploadFileConstant {
// Upload file's dir constant---------------------------------------------------------------------------------------- // Upload file's dir constant----------------------------------------------------------------------------------------
static { static {
// Get admin jar's parent absolute path // Get admin jar's parent absolute path
DLINK_HOME_DIR = new ApplicationHome(UploadFileConstant.class).getSource().getParent(); DLINK_HOME_DIR = new ApplicationHome(UploadFileConstant.class).getSource().getParent() + "/../";
} }
public static final String DLINK_HOME_DIR; public static final String DLINK_HOME_DIR;
......
...@@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.bind.annotation.RequestPart;
...@@ -55,7 +55,7 @@ public class FileUploadController { ...@@ -55,7 +55,7 @@ public class FileUploadController {
* @param fileType Please refer {@link UploadFileConstant}, default is -1. If not provide, please provide the 'dir' value * @param fileType Please refer {@link UploadFileConstant}, default is -1. If not provide, please provide the 'dir' value
* @return {@link Result} * @return {@link Result}
*/ */
@PutMapping @PostMapping
public Result upload(@RequestPart("files") MultipartFile[] files, public Result upload(@RequestPart("files") MultipartFile[] files,
@RequestParam(value = "dir", defaultValue = "", required = false) String dir, @RequestParam(value = "dir", defaultValue = "", required = false) String dir,
@RequestParam(value = "fileType", defaultValue = "-1", required = false) Byte fileType) { @RequestParam(value = "fileType", defaultValue = "-1", required = false) Byte fileType) {
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--<scope.type>provided</scope.type>--> <!--<scope.type>provided</scope.type>-->
<hadoop.version>3.1.0</hadoop.version> <hadoop.version>3.3.2</hadoop.version>
<scope.type>compile</scope.type> <scope.type>compile</scope.type>
</properties> </properties>
......
...@@ -709,7 +709,7 @@ CREATE TABLE `dlink_fragment` ( ...@@ -709,7 +709,7 @@ CREATE TABLE `dlink_fragment` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='全局变量'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='全局变量';
-- 0.7.7-SNAPSHOT 2022-08-22 -- 0.6.7-SNAPSHOT 2022-09-02
-- ----------------------- -- -----------------------
-- DROP TABLE IF EXISTS `dlink_upload_file_record`; -- DROP TABLE IF EXISTS `dlink_upload_file_record`;
CREATE TABLE `dlink_upload_file_record` ( CREATE TABLE `dlink_upload_file_record` (
......
...@@ -19,14 +19,13 @@ ...@@ -19,14 +19,13 @@
import React, {useRef, useState} from "react"; import React, {useRef, useState} from "react";
import {DownOutlined, HeartOutlined, PlusOutlined, UserOutlined} from '@ant-design/icons'; import {DownOutlined, PlusOutlined} from '@ant-design/icons';
import {ActionType, ProColumns} from "@ant-design/pro-table"; import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {Button, message, Input, Drawer, Modal, Dropdown, Menu} from 'antd'; import {Button, Drawer, Dropdown, Menu, message, Modal, Upload} from 'antd';
import {PageContainer, FooterToolbar} from '@ant-design/pro-layout'; import {FooterToolbar, PageContainer} from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import ProDescriptions from '@ant-design/pro-descriptions'; import ProDescriptions from '@ant-design/pro-descriptions';
import {JarTableListItem} from "@/pages/Jar/data"; import {JarTableListItem} from "@/pages/Jar/data";
import {handleAddOrUpdate, handleRemove, queryData, updateEnabled} from "@/components/Common/crud"; import {CODE, handleAddOrUpdate, handleRemove, queryData, updateEnabled} from "@/components/Common/crud";
import JarForm from "@/pages/Jar/components/JarForm"; import JarForm from "@/pages/Jar/components/JarForm";
const url = '/api/jar'; const url = '/api/jar';
...@@ -57,6 +56,32 @@ const JarTableList: React.FC<{}> = (props: any) => { ...@@ -57,6 +56,32 @@ const JarTableList: React.FC<{}> = (props: any) => {
} }
}; };
const getUploadProps = (dir: string) => {
return {
name: 'files',
action: '/api/fileUpload',
accept: 'jar',
headers: {
authorization: 'authorization-text',
},
data: {
dir
},
showUploadList: true,
onChange(info) {
if (info.file.status === 'done') {
if (info.file.response.code == CODE.SUCCESS) {
message.success(info.file.response.msg);
} else {
message.warn(info.file.response.msg);
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败`);
}
},
}
};
const MoreBtn: React.FC<{ const MoreBtn: React.FC<{
item: JarTableListItem; item: JarTableListItem;
}> = ({item}) => ( }> = ({item}) => (
...@@ -132,7 +157,7 @@ const JarTableList: React.FC<{}> = (props: any) => { ...@@ -132,7 +157,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
title: '启动类', title: '启动类',
sorter: true, sorter: true,
dataIndex: 'mainClass', dataIndex: 'mainClass',
},{ }, {
title: '执行参数', title: '执行参数',
sorter: true, sorter: true,
dataIndex: 'paras', dataIndex: 'paras',
...@@ -194,6 +219,9 @@ const JarTableList: React.FC<{}> = (props: any) => { ...@@ -194,6 +219,9 @@ const JarTableList: React.FC<{}> = (props: any) => {
> >
配置 配置
</a>, </a>,
<Upload {...getUploadProps(record.path)}>
<a>上传</a>
</Upload>,
<MoreBtn key="more" item={record}/>, <MoreBtn key="more" item={record}/>,
], ],
}, },
...@@ -315,7 +343,7 @@ const JarTableList: React.FC<{}> = (props: any) => { ...@@ -315,7 +343,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
modalVisible={updateModalVisible} modalVisible={updateModalVisible}
values={formValues} values={formValues}
/> />
): null} ) : null}
<Drawer <Drawer
width={600} width={600}
visible={!!row} visible={!!row}
...@@ -339,7 +367,7 @@ const JarTableList: React.FC<{}> = (props: any) => { ...@@ -339,7 +367,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
)} )}
</Drawer> </Drawer>
</PageContainer> </PageContainer>
); );
}; };
export default JarTableList; export default JarTableList;
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