diff --git a/api/app/lib/controllers/backups/index.js b/api/app/lib/controllers/backups/index.js index b2fa242..743e5fd 100644 --- a/api/app/lib/controllers/backups/index.js +++ b/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 = { diff --git a/api/app/lib/controllers/homepage/index.js b/api/app/lib/controllers/homepage/index.js index 84a9ae4..2eb7c6c 100644 --- a/api/app/lib/controllers/homepage/index.js +++ b/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 } diff --git a/api/app/lib/controllers/metadataAcquisition/taskHandle.js b/api/app/lib/controllers/metadataAcquisition/taskHandle.js index 1670aba..c08e403 100644 --- a/api/app/lib/controllers/metadataAcquisition/taskHandle.js +++ b/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, diff --git a/api/app/lib/models/restful_api_record.js b/api/app/lib/models/restful_api_record.js index 854df05..146cc6f 100644 --- a/api/app/lib/models/restful_api_record.js +++ b/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; }; \ No newline at end of file diff --git a/api/app/lib/routes/homepage/index.js b/api/app/lib/routes/homepage/index.js index 1b12fb6..9fd7603 100644 --- a/api/app/lib/routes/homepage/index.js +++ b/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)) }; diff --git a/api/sequelize-automate.config.js b/api/sequelize-automate.config.js index b0ae7dd..bdfad14 100644 --- a/api/sequelize-automate.config.js +++ b/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_',] ,长度较长的 前缀放前面 diff --git a/web/client/assets/images/homePage/bigscreen/header-title-bg.png b/web/client/assets/images/homePage/bigscreen/headertitlebg.png similarity index 100% rename from web/client/assets/images/homePage/bigscreen/header-title-bg.png rename to web/client/assets/images/homePage/bigscreen/headertitlebg.png diff --git a/web/client/assets/images/homePage/bigscreen/分组 13 copy(1).png b/web/client/assets/images/homePage/bigscreen/分组 13 copy(1).png deleted file mode 100644 index 8aaa039..0000000 Binary files a/web/client/assets/images/homePage/bigscreen/分组 13 copy(1).png and /dev/null differ diff --git a/web/client/assets/images/homePage/bigscreen/分组 13 copy(2).png b/web/client/assets/images/homePage/bigscreen/分组 13 copy(2).png deleted file mode 100644 index 0cb8669..0000000 Binary files a/web/client/assets/images/homePage/bigscreen/分组 13 copy(2).png and /dev/null differ diff --git a/web/client/assets/images/homePage/bigscreen/分组 13 copy.png b/web/client/assets/images/homePage/bigscreen/分组 13 copy.png deleted file mode 100644 index 99eb7a1..0000000 Binary files a/web/client/assets/images/homePage/bigscreen/分组 13 copy.png and /dev/null differ diff --git a/web/client/src/sections/homePage/components/public/table-card.js b/web/client/src/sections/homePage/components/public/table-card.js index ea83d8c..f2bd9df 100644 --- a/web/client/src/sections/homePage/components/public/table-card.js +++ b/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%', }