diff --git a/api/app/lib/controllers/metadataSearch/index.js b/api/app/lib/controllers/metadataSearch/index.js new file mode 100644 index 0000000..21166ee --- /dev/null +++ b/api/app/lib/controllers/metadataSearch/index.js @@ -0,0 +1,39 @@ +'use strict'; + +function searchMeta(opts) { + return async function (ctx, next) { + let errMsg = { message: '搜索元数据失败' } + try { + const models = ctx.fs.dc.models; + const { keywords } = ctx.query; + const where = {}; + + if (keywords) { + where['$or'] = [{ name: { $iLike: `%${keywords}%` } } + ] + } + const findObj = { + include: [ + { + model: models.TagDatabase, + include: [{ + model: models.Tag, + }] + }], + where: where + } + + const rslt = await models.MetadataDatabase.findAndCountAll(findObj); + ctx.status = 200; + ctx.body = rslt; + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); + ctx.status = 400; + ctx.body = errMsg + } + } +} + +module.exports = { + searchMeta +} \ No newline at end of file diff --git a/api/app/lib/routes/metadataSearch/index.js b/api/app/lib/routes/metadataSearch/index.js new file mode 100644 index 0000000..53d0f65 --- /dev/null +++ b/api/app/lib/routes/metadataSearch/index.js @@ -0,0 +1,9 @@ +'use strict'; + +const search = require('../../controllers/metadataSearch/index'); + +module.exports = function (app, router, opts, AuthCode) { + //获取适配器列表 + app.fs.api.logAttr['GET/meta/data/search'] = { content: '获取适配器列表', visible: true }; + router.get('/meta/data/search', search.searchMeta(opts)); +}; diff --git a/web/client/src/sections/resourceRetrieval/containers/retrieval.js b/web/client/src/sections/resourceRetrieval/containers/retrieval.js index fc69057..362adae 100644 --- a/web/client/src/sections/resourceRetrieval/containers/retrieval.js +++ b/web/client/src/sections/resourceRetrieval/containers/retrieval.js @@ -1,7 +1,50 @@ import React, { useEffect, useState } from 'react' +import { Input } from 'antd' +import { InsertRowBelowOutlined, DatabaseOutlined, FileOutlined, PullRequestOutlined } from '@ant-design/icons'; +import './style.less'; +function Retrieval(props) { + const renderMetaData = (type) => { + switch (type) { + case '库': + return