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 @@
</dependency>
<!-- hadoop -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdfs</artifactId>
<version>3.3.2</version>
<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>
<groupId>com.dlink</groupId>
<artifactId>dlink-client-hadoop</artifactId>
<scope>${scope.runtime}</scope>
</dependency>
</dependencies>
......
......@@ -45,7 +45,7 @@ public class UploadFileConstant {
// Upload file's dir constant----------------------------------------------------------------------------------------
static {
// 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;
......
......@@ -27,7 +27,7 @@ import org.apache.commons.lang3.StringUtils;
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.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
......@@ -55,7 +55,7 @@ public class FileUploadController {
* @param fileType Please refer {@link UploadFileConstant}, default is -1. If not provide, please provide the 'dir' value
* @return {@link Result}
*/
@PutMapping
@PostMapping
public Result upload(@RequestPart("files") MultipartFile[] files,
@RequestParam(value = "dir", defaultValue = "", required = false) String dir,
@RequestParam(value = "fileType", defaultValue = "-1", required = false) Byte fileType) {
......
......@@ -30,7 +30,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--<scope.type>provided</scope.type>-->
<hadoop.version>3.1.0</hadoop.version>
<hadoop.version>3.3.2</hadoop.version>
<scope.type>compile</scope.type>
</properties>
......
......@@ -709,7 +709,7 @@ CREATE TABLE `dlink_fragment` (
) 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`;
CREATE TABLE `dlink_upload_file_record` (
......
......@@ -19,14 +19,13 @@
import React, {useRef, useState} from "react";
import {DownOutlined, HeartOutlined, PlusOutlined, UserOutlined} from '@ant-design/icons';
import {ActionType, ProColumns} from "@ant-design/pro-table";
import {Button, message, Input, Drawer, Modal, Dropdown, Menu} from 'antd';
import {PageContainer, FooterToolbar} from '@ant-design/pro-layout';
import ProTable from '@ant-design/pro-table';
import {DownOutlined, PlusOutlined} from '@ant-design/icons';
import ProTable, {ActionType, ProColumns} from "@ant-design/pro-table";
import {Button, Drawer, Dropdown, Menu, message, Modal, Upload} from 'antd';
import {FooterToolbar, PageContainer} from '@ant-design/pro-layout';
import ProDescriptions from '@ant-design/pro-descriptions';
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";
const url = '/api/jar';
......@@ -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<{
item: JarTableListItem;
}> = ({item}) => (
......@@ -132,7 +157,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
title: '启动类',
sorter: true,
dataIndex: 'mainClass',
},{
}, {
title: '执行参数',
sorter: true,
dataIndex: 'paras',
......@@ -194,6 +219,9 @@ const JarTableList: React.FC<{}> = (props: any) => {
>
配置
</a>,
<Upload {...getUploadProps(record.path)}>
<a>上传</a>
</Upload>,
<MoreBtn key="more" item={record}/>,
],
},
......@@ -315,7 +343,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
modalVisible={updateModalVisible}
values={formValues}
/>
): null}
) : null}
<Drawer
width={600}
visible={!!row}
......@@ -339,7 +367,7 @@ const JarTableList: React.FC<{}> = (props: any) => {
)}
</Drawer>
</PageContainer>
);
);
};
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