refactor(web): 优化部份显示效果
This commit is contained in:
@@ -34,6 +34,20 @@ function paginationCommonOptions(perPage = true, maxButtons = 5) {
|
|||||||
return option
|
return option
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function paginationTemplate(perPage = 20, maxButtons = 5) {
|
||||||
|
return {
|
||||||
|
perPage: perPage,
|
||||||
|
headerToolbar: [
|
||||||
|
"reload",
|
||||||
|
paginationCommonOptions(true, maxButtons),
|
||||||
|
],
|
||||||
|
footerToolbar: [
|
||||||
|
"statistics",
|
||||||
|
paginationCommonOptions(true, maxButtons),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function timeAndFrom(field, fromNow, emptyText = '未停止', showSource = true) {
|
function timeAndFrom(field, fromNow, emptyText = '未停止', showSource = true) {
|
||||||
let tpl = "${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE('<span class=\"font-bold\">'," + fromNow + ",'</span>'))}"
|
let tpl = "${IF(" + field + " === 0, '(" + emptyText + ")', CONCATENATE('<span class=\"font-bold\">'," + fromNow + ",'</span>'))}"
|
||||||
if (showSource) {
|
if (showSource) {
|
||||||
@@ -786,6 +800,7 @@ function timelineColumns() {
|
|||||||
label: '文件名',
|
label: '文件名',
|
||||||
type: 'wrapper',
|
type: 'wrapper',
|
||||||
size: 'none',
|
size: 'none',
|
||||||
|
className: 'nowrap',
|
||||||
body: [
|
body: [
|
||||||
{
|
{
|
||||||
type: 'tpl',
|
type: 'tpl',
|
||||||
@@ -794,10 +809,10 @@ function timelineColumns() {
|
|||||||
{
|
{
|
||||||
visibleOn: "action === 'compaction'",
|
visibleOn: "action === 'compaction'",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
icon: 'fa fa-eye',
|
icon: 'fa fa-eye ml-1',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
tooltip: '查看压缩计划',
|
tooltip: '查看压缩计划',
|
||||||
size: 'sm',
|
size: 'xs',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
title: '压缩计划详情',
|
title: '压缩计划详情',
|
||||||
@@ -833,6 +848,7 @@ function timelineColumns() {
|
|||||||
},
|
},
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
loadDataOnce: true,
|
loadDataOnce: true,
|
||||||
|
...paginationTemplate(20, 8),
|
||||||
columns: [
|
columns: [
|
||||||
{
|
{
|
||||||
name: 'fileId',
|
name: 'fileId',
|
||||||
@@ -867,6 +883,7 @@ function timelineColumns() {
|
|||||||
label: '数据文件名',
|
label: '数据文件名',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
|
size: 'xs',
|
||||||
actionType: 'copy',
|
actionType: 'copy',
|
||||||
content: '${dataFilePath}',
|
content: '${dataFilePath}',
|
||||||
tooltip: '复制 ${dataFilePath}',
|
tooltip: '复制 ${dataFilePath}',
|
||||||
@@ -875,6 +892,7 @@ function timelineColumns() {
|
|||||||
label: '日志文件',
|
label: '日志文件',
|
||||||
type: 'action',
|
type: 'action',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
|
size: 'xs',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
title: '操作日志文件列表',
|
title: '操作日志文件列表',
|
||||||
@@ -902,10 +920,10 @@ function timelineColumns() {
|
|||||||
{
|
{
|
||||||
visibleOn: "action === 'rollback'",
|
visibleOn: "action === 'rollback'",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
icon: 'fa fa-eye',
|
icon: 'fa fa-eye ml-1',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
tooltip: '查看回滚计划',
|
tooltip: '查看回滚计划',
|
||||||
size: 'sm',
|
size: 'xs',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
title: '回滚计划详情',
|
title: '回滚计划详情',
|
||||||
@@ -966,15 +984,15 @@ function timelineColumns() {
|
|||||||
{
|
{
|
||||||
visibleOn: "action === 'clean'",
|
visibleOn: "action === 'clean'",
|
||||||
type: 'action',
|
type: 'action',
|
||||||
icon: 'fa fa-eye',
|
icon: 'fa fa-eye ml-1',
|
||||||
level: 'link',
|
level: 'link',
|
||||||
tooltip: '查看清理计划',
|
tooltip: '查看清理计划',
|
||||||
size: 'sm',
|
size: 'xs',
|
||||||
actionType: 'dialog',
|
actionType: 'dialog',
|
||||||
dialog: {
|
dialog: {
|
||||||
title: '清理计划详情',
|
title: '清理计划详情',
|
||||||
actions: [],
|
actions: [],
|
||||||
size: 'lg',
|
size: 'xl',
|
||||||
body: {
|
body: {
|
||||||
type: 'service',
|
type: 'service',
|
||||||
api: {
|
api: {
|
||||||
@@ -992,10 +1010,10 @@ function timelineColumns() {
|
|||||||
let list = []
|
let list = []
|
||||||
Object.keys(map)
|
Object.keys(map)
|
||||||
.forEach(key => {
|
.forEach(key => {
|
||||||
list.push({
|
map[key].forEach(file => list.push({
|
||||||
partitionPath: key,
|
partitionPath: key,
|
||||||
files: map[key],
|
file: file['filePath'],
|
||||||
})
|
}))
|
||||||
})
|
})
|
||||||
payload.data['filePathsToBeDeletedPerPartition'] = list
|
payload.data['filePathsToBeDeletedPerPartition'] = list
|
||||||
}
|
}
|
||||||
@@ -1029,6 +1047,7 @@ function timelineColumns() {
|
|||||||
type: 'crud',
|
type: 'crud',
|
||||||
source: '${filePathsToBeDeletedPerPartition}',
|
source: '${filePathsToBeDeletedPerPartition}',
|
||||||
...crudCommonOptions(),
|
...crudCommonOptions(),
|
||||||
|
...paginationTemplate(20, 8),
|
||||||
loadDataOnce: true,
|
loadDataOnce: true,
|
||||||
title: '分区删除文件',
|
title: '分区删除文件',
|
||||||
columns: [
|
columns: [
|
||||||
@@ -1039,13 +1058,25 @@ function timelineColumns() {
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'files',
|
name: 'file',
|
||||||
label: '清理文件',
|
label: '清理文件',
|
||||||
type: 'list',
|
|
||||||
className: 'nowrap',
|
className: 'nowrap',
|
||||||
listItem: {
|
},
|
||||||
body: '${filePath}',
|
{
|
||||||
}
|
type: 'operation',
|
||||||
|
label: '操作',
|
||||||
|
width: 100,
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
label: '复制路经',
|
||||||
|
type: 'action',
|
||||||
|
level: 'link',
|
||||||
|
size: 'xs',
|
||||||
|
actionType: 'copy',
|
||||||
|
content: '${file}',
|
||||||
|
tooltip: '复制 ${file}',
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let debug = true
|
let debug = false
|
||||||
let server = amis.embed(
|
let server = amis.embed(
|
||||||
'#root',
|
'#root',
|
||||||
amisJSON,
|
amisJSON,
|
||||||
|
|||||||
Reference in New Issue
Block a user