wenlele 2 years ago
parent
commit
b91fccb1ff
  1. 2
      api/app/lib/controllers/backups/index.js
  2. 30
      api/app/lib/controllers/homepage/index.js
  3. 8
      api/app/lib/controllers/metadataAcquisition/taskHandle.js
  4. 94
      api/app/lib/models/restful_api_record.js
  5. 5
      api/app/lib/routes/homepage/index.js
  6. 2
      api/sequelize-automate.config.js
  7. 0
      web/client/assets/images/homePage/bigscreen/headertitlebg.png
  8. BIN
      web/client/assets/images/homePage/bigscreen/分组 13 copy(1).png
  9. BIN
      web/client/assets/images/homePage/bigscreen/分组 13 copy(2).png
  10. BIN
      web/client/assets/images/homePage/bigscreen/分组 13 copy.png
  11. 2
      web/client/src/sections/homePage/components/public/table-card.js

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

@ -6,7 +6,7 @@ function getBackupsList(opts) {
const models = ctx.fs.dc.models;
const { page, limit, name } = ctx.query;
const Op = ctx.fs.dc.ORM.Op;
let errMsg = { message: '获取数据备份失败' }
try {
let searchWhere = {

30
api/app/lib/controllers/homepage/index.js

@ -156,8 +156,36 @@ function getClusterInfo(opts) {
}
}
function getRestfulInfo(opts) {
return async function (ctx, next) {
const models = ctx.fs.dc.models;
try {
const Op = ctx.fs.dc.ORM.Op;
let allApis = await models.RestfulApiRecord.findAndCount({
order: [["id", "desc"]],
where: {
id: { [Op.gt]: 0 }
},
include: [
{
model: models.RestfulApi,
}]
})
ctx.status = 200;
ctx.body = { allApis };
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = { message: '获取restful统计信息失败' }
}
}
}
module.exports = {
getNodeResources,
getDataTotalTop5,
getClusterInfo
getClusterInfo,
getRestfulInfo
}

8
api/app/lib/controllers/metadataAcquisition/taskHandle.js

@ -21,7 +21,13 @@ async function handleTask(app, task) {
if (dataSource) {
const dbOptions = createDbOptions(dataSource.config);
const automate = new Automate(dbOptions, {});
const tables = await automate.getTables(); //获取当前采集任务数据源pg库表字段索引外键数据
const tablesOrign = await automate.getTables(); //获取当前采集任务数据源pg库表字段索引外键数据
const tables = {}
Object.keys(tablesOrign).forEach(key => {
if (key.indexOf('_airbyte_raw') < 0) { //过滤掉临时表 后端同步的库里存在临时表(_airbyte_raw开头)
tables[key] = tablesOrign[key]
}
})
const dataToSave = {
code: dataSource.config.database,
name: dataSource.config.database,

94
api/app/lib/models/restful_api_record.js

@ -3,51 +3,51 @@
'use strict';
module.exports = dc => {
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RestfulApiRecord = sequelize.define("restfulApiRecord", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "唯一标识",
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "t_restful_api_record_id_uindex"
},
restServiceId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "rest服务Id",
primaryKey: false,
field: "rest_service_id",
autoIncrement: false
},
visitTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: "访问时间",
primaryKey: false,
field: "visit_time",
autoIncrement: false
},
token: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "令牌",
primaryKey: false,
field: "token",
autoIncrement: false
},
}, {
tableName: "t_restful_api_record",
comment: "",
indexes: []
});
dc.models.RestfulApiRecord = RestfulApiRecord;
return RestfulApiRecord;
const DataTypes = dc.ORM;
const sequelize = dc.orm;
const RestfulApiRecord = sequelize.define("restfulApiRecord", {
id: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: null,
primaryKey: true,
field: "id",
autoIncrement: true,
unique: "t_resful_api_record_id_uindex"
},
restServiceId: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: null,
comment: "rest服务id",
primaryKey: false,
field: "rest_service_id",
autoIncrement: false
},
visitTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: null,
comment: "访问时间",
primaryKey: false,
field: "visit_time",
autoIncrement: false
},
token: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: null,
comment: "令牌",
primaryKey: false,
field: "token",
autoIncrement: false
}
}, {
tableName: "t_restful_api_record",
comment: "",
indexes: []
});
dc.models.RestfulApiRecord = RestfulApiRecord;
return RestfulApiRecord;
};

5
api/app/lib/routes/homepage/index.js

@ -10,8 +10,9 @@ module.exports = function (app, router, opts, AuthCode) {
app.fs.api.logAttr['GET/homepage/datatotal/top5'] = { content: '获取数据总量和top5', visible: true };
router.get('/homepage/datatotal/top5', backups.getDataTotalTop5(opts))
app.fs.api.logAttr['GET/homepage/cluters'] = { content: '获取集群资源节点信息', visible: true };
app.fs.api.logAttr['GET/homepage/datatotal/cluters'] = { content: '获取集群资源节点信息', visible: true };
router.get('/homepage/datatotal/cluters', backups.getClusterInfo(opts))
app.fs.api.logAttr['GET/homepage/restful/info'] = { content: '获取restful统计信息', visible: true };
router.get('/homepage/restful/info', backups.getRestfulInfo(opts))
};

2
api/sequelize-automate.config.js

@ -26,7 +26,7 @@ module.exports = {
dir: './app/lib/models', // 指定输出 models 文件的目录
typesDir: 'models', // 指定输出 TypeScript 类型定义的文件目录,只有 TypeScript / Midway 等会有类型定义
emptyDir: false, // !!! 谨慎操作 生成 models 之前是否清空 `dir` 以及 `typesDir`
tables: ['dbStatistics'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
tables: ['t_restful_api_record'], // 指定生成哪些表的 models,如 ['user', 'user_post'];如果为 null,则忽略改属性
skipTables: [], // 指定跳过哪些表的 models,如 ['user'];如果为 null,则忽略改属性
tsNoCheck: false, // 是否添加 `@ts-nocheck` 注释到 models 文件中
ignorePrefix: ['t_',], // 生成的模型名称忽略的前缀,因为 项目中有以下表名是以 t_ 开头的,在实际模型中不需要, 可以添加多个 [ 't_data_', 't_',] ,长度较长的 前缀放前面

0
web/client/assets/images/homePage/bigscreen/header-title-bg.png → web/client/assets/images/homePage/bigscreen/headertitlebg.png

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
web/client/assets/images/homePage/bigscreen/分组 13 copy(1).png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

BIN
web/client/assets/images/homePage/bigscreen/分组 13 copy(2).png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

BIN
web/client/assets/images/homePage/bigscreen/分组 13 copy.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

2
web/client/src/sections/homePage/components/public/table-card.js

@ -7,7 +7,7 @@ class Box extends React.Component {
const { title, height = '100%', children, bodyPaddingTop = 1, titlePaddingTop, margin, overflow } = this.props
const headerbg = {
background: 'url(/assets/images/homepage/bigscreen/header-title-bg.png) no-repeat',
background: 'url(/assets/images/homepage/bigscreen/headertitlebg.png) no-repeat',
backgroundSize: '100% 100%',
}

Loading…
Cancel
Save