feat(web): 增加HDFS文件管理器

在页面直接查看HDFS文件和目录,还可以查看和下载
This commit is contained in:
v-zhangjc9
2024-04-28 16:28:48 +08:00
parent 9913943a27
commit 572a1dab9f
11 changed files with 581 additions and 34 deletions

View File

@@ -55,6 +55,176 @@ function toolTab() {
}
]
},
{
type: 'form',
title: 'HDFS文件管理器',
actions: [
{
label: '直接下载',
type: 'action',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
script: (context, action, event) => {
let downloadUrl = `${event.data.base}/hudi/hdfs_download?root=${encodeURI(event.data.hdfs)}`
window.open(downloadUrl, '_blank')
},
}
]
}
}
},
{
type: 'submit',
label: '查看',
actionType: 'dialog',
dialog: {
title: {
type: 'tpl',
tpl: '${hdfs}'
},
...readOnlyDialogOptions(),
size: 'xl',
body: {
type: 'crud',
api: {
method: 'get',
url: '${base}/hudi/hdfs_list',
data: {
root: '${hdfs|default:undefined}',
},
},
deferApi: {
method: 'get',
url: '${base}/hudi/hdfs_list_children',
data: {
root: '${path|default:undefined}',
},
},
...crudCommonOptions(),
perPage: 10,
headerToolbar: [
"reload",
paginationCommonOptions(undefined, 10),
],
footerToolbar: [
paginationCommonOptions(undefined, 10),
],
columns: [
{
name: 'name',
label: '文件名',
className: 'font-mono',
},
{
name: 'group',
label: '组',
width: 70,
},
{
name: 'owner',
label: '用户',
width: 70,
},
{
label: '大小',
width: 90,
type: 'tpl',
tpl: "${sizeText}",
},
{
label: '修改时间',
width: 140,
type: 'tpl',
tpl: "${DATETOSTR(DATE(modifyTime), 'YYYY-MM-DD HH:mm:ss')}",
},
{
type: 'operation',
label: '操作',
width: 160,
fixed: 'right',
buttons: [
{
label: '完整路径',
type: 'action',
level: 'link',
size: 'xs',
actionType: 'copy',
content: '${path}',
tooltip: '复制 ${path}',
},
{
disabledOn: 'folder || size > 1048576',
label: '查看',
type: 'action',
level: 'link',
size: 'xs',
actionType: 'dialog',
dialog: {
title: {
type: 'tpl',
tpl: '文件内容:${path}'
},
size: 'md',
...readOnlyDialogOptions(),
body: {
type: 'service',
api: {
method: 'get',
url: '${base}/hudi/hdfs_read',
data: {
root: '${path|default:undefined}'
}
},
body: {
type: 'textarea',
name: 'text',
readOnly: true,
}
}
}
},
{
disabledOn: 'folder',
label: '下载',
type: 'action',
level: 'link',
size: 'xs',
onEvent: {
click: {
actions: [
{
actionType: 'custom',
script: (context, action, event) => {
let downloadUrl = `${event.data.base}/hudi/hdfs_download?root=${encodeURI(event.data.path)}`
window.open(downloadUrl, '_blank')
},
}
]
}
}
},
]
}
]
}
}
}
],
body: [
{
type: 'input-text',
name: 'hdfs',
label: 'HDFS根路经',
required: true,
clearable: true,
description: '输入表HDFS路径',
autoComplete: '${base}/table/all_hdfs?key=$term',
},
]
},
{
type: 'form',
title: '查询时间线',