下载
+
}
+ visible={true}
form={form}
layout='horizontal'
autoFocusFirstInput
modalProps={{
destroyOnClose: true,
+ onCancel: () => { props.onCancel() }
}}
onFinish={async (values) => {
console.log(values.name);
diff --git a/web/client/src/sections/resourceRetrieval/containers/retrieval.js b/web/client/src/sections/resourceRetrieval/containers/retrieval.js
index 3edb9db..63011ec 100644
--- a/web/client/src/sections/resourceRetrieval/containers/retrieval.js
+++ b/web/client/src/sections/resourceRetrieval/containers/retrieval.js
@@ -1,9 +1,9 @@
import React, { useEffect, useState } from 'react'
-import { Input, Tooltip, Empty, Pagination, Modal, Form } from 'antd'
+import { Input, Tooltip, Empty, Pagination, Popover, message } from 'antd'
import { InsertRowBelowOutlined, DatabaseOutlined, FileOutlined, PullRequestOutlined, KeyOutlined } from '@ant-design/icons';
import { useFsRequest, ApiTable } from '$utils';
import { connect } from 'react-redux';
-import { downloadImg } from '../utils/index'
+import { downloadImg, markRedKeywords } from '../utils/index'
import KeyModal from '../components/keyModal';
const METADTA_TYPE = {
'库': 'databases',
@@ -11,12 +11,21 @@ const METADTA_TYPE = {
'文件': 'files',
'接口': 'restapis',
}
+
+const METADTA_TYPE_NAMES = {
+ '库': '库表/库(Schema)',
+ '表': '库表/表(Table)',
+ '文件': '文件(File)',
+ '接口': '接口(Api)',
+}
+
import './style.less';
function Retrieval(props) {
const { user, catalogs, dispatch, actions } = props;
const [keywords, setKeywords] = useState()
const [firstInput, setFirstInput] = useState()
const [page, setPage] = useState(1)
+ const [currentData, setCurrentData] = useState(null)
const formRef = React.createRef();
// const { data: catalogs = [] } = useFsRequest({
// url: ApiTable.getResourceCatalog,
@@ -77,6 +86,17 @@ function Retrieval(props) {
: text
}
+ const renderName = (text) => {
+ function createMarkup(textFilter) {
+ return { __html: textFilter.length == text.length ? markRedKeywords(textFilter, keywords) : markRedKeywords(textFilter, keywords) + '...' };
+ }
+ return text?.length > 16 ?
+ }>
+
+
+ :
+ }
+
const downloadData = (s) => {
if (s?.type == '文件') {
const suffix = s?.fileName?.substring(s?.fileName?.length - 3, s?.fileName?.length)
@@ -109,21 +129,23 @@ function Retrieval(props) {
{renderIcon(s?.type)}
{s?.code && 代码:{renderText(s?.code)}}
- 名称:{renderText(s?.name)}
- 类型:{s?.type}
+ 名称:{renderName(s?.name)}
+ 类型:{METADTA_TYPE_NAMES[s?.type]}
路径:{renderText(catalogText)}
标签:{renderText(tagText)}
@@ -137,6 +159,16 @@ function Retrieval(props) {
}}
/>}
{!result?.rows?.length > 0 && }
+
+ {currentData && {
+ downloadData(currentData)
+ setCurrentData(null)
+ }}
+ onCancel={() => { setCurrentData(null) }}
+ />}
>
}
diff --git a/web/client/src/sections/resourceRetrieval/utils/index.js b/web/client/src/sections/resourceRetrieval/utils/index.js
index ae547ef..9fb6f47 100644
--- a/web/client/src/sections/resourceRetrieval/utils/index.js
+++ b/web/client/src/sections/resourceRetrieval/utils/index.js
@@ -28,3 +28,10 @@ export const downloadImg = (fileName) => {
}
}
+
+
+export const markRedKeywords = (str, key) => {
+ var reg = new RegExp((`(${key})`), "gi");
+ var replace = '$1';
+ return str.replace(reg, replace);
+}
\ No newline at end of file