Browse Source

(*) 数据备份增加错误日志 数据源列表增加属性字段

master
peng.peng 1 year ago
parent
commit
3347965b8f
  1. 6
      api/app/lib/controllers/backups/index.js
  2. 12
      api/app/lib/models/backups.js
  3. 2
      scripts/0.0.7/04_alter_backups.sql
  4. 11
      web/client/src/sections/backups/containers/backupTask.js
  5. 8
      web/client/src/sections/homePage/components/style.less
  6. 3
      web/client/src/sections/homePage/containers/style.less
  7. 5
      web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js

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

@ -58,9 +58,10 @@ function addBackups(opts) {
// const url = '10.8.30.160:8085/dumpDB?dbHost=10.8.30.75&dbPort=5432&user=postgres&password=1234&dbName=Anxinyun0916'//测试使用
const url = backupsUrl + `/dumpDB?dbHost=${host}&dbPort=${port}&user=${user}&password=${password}&dbName=${database}`;
request.post(url).then(res => {
const { fileInfo: { name, size }, code } = res.body
const { fileInfo: { name, size }, code, message } = res.body
models.Backups.update({
size, source: name, state: code == 200 ? '备份成功' : '备份失败', completeTime: moment()
size, source: name, state: code == 200 ? '备份成功' : '备份失败', completeTime: moment(),
log: code == 200 ? '' : message
}, { where: { id: backup.id } })
if (code != 200) ctx.fs.logger.error(`path: ${ctx.path}, error: ${message}`);
})
@ -140,6 +141,7 @@ function restore(opts) {
const { code, message } = res.body
models.Backups.update({
state: code == 200 ? '恢复成功' : '恢复失败',
log: code == 200 ? '' : message
}, { where: { id: id } })
if (code != 200) ctx.fs.logger.error(`path: ${ctx.path}, error: ${message}`);
})

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

@ -78,7 +78,17 @@ module.exports = dc => {
primaryKey: false,
field: "source",
autoIncrement: false
}
},
log: {
type: DataTypes.TEXT,
allowNull: true,
defaultValue: null,
comment: "备份日志",
primaryKey: false,
field: "log",
autoIncrement: false
},
}, {
tableName: "backups",
comment: "",

2
scripts/0.0.7/04_alter_backups.sql

@ -0,0 +1,2 @@
alter table backups
add log text;

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

@ -51,6 +51,12 @@ function Member(props) {
dataIndex: 'index',
render: (text, record, index) => { return index + 1 }
},
{
title: '备份数据源',
dataIndex: 'database',
render: (text, record) => record?.databases?.database
},
{
title: '备份信息',
dataIndex: 'note',
@ -73,6 +79,11 @@ function Member(props) {
title: '状态',
dataIndex: 'state',
},
{
title: '异常日志',
dataIndex: 'log',
ellipsis: true,
},
{
title: '操作',
width: 160,

8
web/client/src/sections/homePage/components/style.less

@ -304,7 +304,7 @@
letter-spacing: 0.46px;
text-align: center;
position: absolute;
top: 2%;
top: -3%;
left: 32%;
background: url(/assets/images/homePage/bigscreen/centerdatabg1.png);
background-repeat: no-repeat;
@ -323,7 +323,7 @@
letter-spacing: 0.46px;
text-align: center;
position: absolute;
top: 25%;
top: 26%;
left: 42%;
background: url(/assets/images/homePage/bigscreen/centerdatabg2.png);
background-repeat: no-repeat;
@ -342,7 +342,7 @@
letter-spacing: 0.46px;
text-align: center;
position: absolute;
top: 45%;
top: 52%;
left: 42%;
background: url(/assets/images/homePage/bigscreen/centerdatabg2.png);
background-repeat: no-repeat;
@ -361,7 +361,7 @@
letter-spacing: 0.46px;
text-align: center;
position: absolute;
top: 62%;
top: 74%;
left: 42%;
background: url(/assets/images/homePage/bigscreen/centerdatabg2.png);
background-repeat: no-repeat;

3
web/client/src/sections/homePage/containers/style.less

@ -55,11 +55,12 @@
z-index: 400;
._top {
margin-top: 50px;
margin-top: 5%;
height: calc(100% - 200px);
background: url('/assets/images/homePage/bigscreen/centerbg.png');
background-repeat: no-repeat;
background-size: 100% 100%;
position: relative;
}
}

5
web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js

@ -49,6 +49,11 @@ function DataSourceManagement(props) {
dataIndex: 'mountPath',
render: (text, record) => record?.resourceCatalog?.name
},
{
title: '数据源属性',
dataIndex: 'type',
render: (text, record) => record?.type == '备份数据库' ? '备份数据库' : '原数据库'
},
{
title: '适配器类型',
dataIndex: 'adapter',

Loading…
Cancel
Save