Browse Source

(*)查询适配器列表提交

master
peng.peng 2 years ago
parent
commit
6ac1791d54
  1. 24
      api/app/lib/controllers/metadataAcquisition/adapter.js
  2. 4
      api/app/lib/routes/metadataAcquisition/adapter.js
  3. 9
      web/client/src/sections/metadataAcquisition/containers/adapter.js

24
api/app/lib/controllers/metadataAcquisition/adapter.js

@ -44,8 +44,30 @@ function addAdapter(opts) {
}
}
function getAdapters(opts) {
return async function (ctx, next) {
const models = ctx.fs.dc.models;
let errMsg = { message: '获取适配器失败' }
try {
let option = {
where: {},
order: [["id", "desc"]],
}
const res = await models.Adapter.findAll(option);
ctx.status = 200;
ctx.body = res;
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = errMsg
}
}
}
module.exports = {
checkConnect,
addAdapter
addAdapter,
getAdapters
}

4
api/app/lib/routes/metadataAcquisition/adapter.js

@ -10,5 +10,7 @@ module.exports = function (app, router, opts, AuthCode) {
app.fs.api.logAttr['POST/adapter'] = { content: '增加适配器', visible: true };
router.post('/meta/acq/adapter', adapter.addAdapter(opts))
//获取适配器列表
app.fs.api.logAttr['GET/meta/acq/adapters'] = { content: '获取适配器列表', visible: true };
router.get('/meta/acq/adapters', adapter.getAdapters(opts));
};

9
web/client/src/sections/metadataAcquisition/containers/adapter.js

@ -14,7 +14,7 @@ const RELATION_DATABASE_TOOL_CONFIG = [{
}]
const LatestMetadata = (props) => {
const { history } = props;
const { history, actions, dispatch } = props;
const [isModalOpen, setIsModalOpen] = useState(false);
const renderRelationalDatabase = () => {
@ -36,7 +36,12 @@ const LatestMetadata = (props) => {
const onFinish = (values) => {
const { stepOneValues, stepTwoValues } = values;
dispatch(actions.metadataAcquisition.addDataSource({
name: stepOneValues?.name,
audited: true,
adapter: 1,
mountPath: 1,
description: stepOneValues?.description,
config: stepTwoValues
}))
}

Loading…
Cancel
Save