Browse Source

(*)备份恢复修改

master
peng.peng 1 year ago
parent
commit
b9ca312d91
  1. 3
      api/app/lib/controllers/backups/index.js
  2. 2
      api/app/lib/controllers/metadataSearch/index.js
  3. 27
      api/app/lib/models/backups.js
  4. 38
      web/client/src/sections/backups/containers/backupTask.js

3
api/app/lib/controllers/backups/index.js

@ -141,7 +141,8 @@ function restore(opts) {
const { code, message } = res.body
models.Backups.update({
state: code == 200 ? '恢复成功' : '恢复失败',
log: code == 200 ? '' : message
log: code == 200 ? '' : message,
restoreDatabases: ctx.request.body.databases
}, { where: { id: id } })
if (code != 200) ctx.fs.logger.error(`path: ${ctx.path}, error: ${message}`);
})

2
api/app/lib/controllers/metadataSearch/index.js

@ -67,7 +67,7 @@ function searchMeta(opts) {
}
}
// 新增模型
// 下载表数据
function getTableData(opts) {
return async function (ctx, next) {

27
api/app/lib/models/backups.js

@ -88,6 +88,33 @@ module.exports = dc => {
field: "log",
autoIncrement: false
},
restoreDatabases: {
type: DataTypes.JSONB,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "restore_databases",
autoIncrement: false
},
restoreStart: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: "恢复开始时间",
primaryKey: false,
field: "restore_start",
autoIncrement: false
},
restoreEnd: {
type: DataTypes.DATE,
allowNull: true,
defaultValue: null,
comment: "恢复结束时间",
primaryKey: false,
field: "restore_end",
autoIncrement: false
},
}, {
tableName: "backups",

38
web/client/src/sections/backups/containers/backupTask.js

@ -49,46 +49,77 @@ function Member(props) {
{
title: '序号',
dataIndex: 'index',
fixed: 'left',
width: '7%',
render: (text, record, index) => { return index + 1 }
},
{
title: '备份数据源',
dataIndex: 'database',
fixed: 'left',
width: '7%',
render: (text, record) => record?.databases?.database
},
{
title: '备份信息',
dataIndex: 'note',
fixed: 'left',
width: '7%',
},
{
title: '备份大小',
dataIndex: 'size',
fixed: 'left',
width: '7%',
},
{
title: '备份时间',
dataIndex: 'createTime',
fixed: 'left',
width: '7%',
render: (text, record) => { return moment(record?.createTime).format('YYYY-MM-DD HH:mm:ss') }
},
{
title: '备份完成时间',
dataIndex: 'completeTime',
fixed: 'left',
width: '7%',
render: (text, record) => { return record?.completeTime ? moment(record?.completeTime).format('YYYY-MM-DD HH:mm:ss') : '-' }
},
{
title: '状态',
dataIndex: 'state',
fixed: 'left',
width: '7%',
},
{
title: '恢复数据源',
dataIndex: 'restoreDatabases',
width: '8%',
render: (text, record) => record?.restoreDatabases?.database
},
{
title: '恢复开始时间',
width: '7%',
dataIndex: 'restoreStart',
},
{
title: '恢复结束时间',
width: '7%',
dataIndex: 'restoreEnd',
},
{
title: '异常日志',
dataIndex: 'log',
width: '7%',
ellipsis: true,
},
{
title: '操作',
width: 160,
width: '8%',
key: 'option',
valueType: 'option',
fixed: 'right',
render: (text, record) => {
const options = [];
options.push(
@ -208,7 +239,8 @@ function Member(props) {
scroll={
{
scrollToFirstRowOnChange: true,
y: clientHeight - 260
y: clientHeight - 260,
x: 1800
}
}
pagination={{

Loading…
Cancel
Save