diff --git a/api/app/lib/controllers/metadataAcquisition/dataSource.js b/api/app/lib/controllers/metadataAcquisition/dataSource.js
index bd56972..6ef2c0a 100644
--- a/api/app/lib/controllers/metadataAcquisition/dataSource.js
+++ b/api/app/lib/controllers/metadataAcquisition/dataSource.js
@@ -42,7 +42,10 @@ function getDataSource(opts) {
let option = {
where: searchWhere,
order: [["id", "desc"]],
- include: [{ model: models.Adapter }]
+ include: [
+ { model: models.Adapter },
+ { model: models.ResourceCatalog },
+ ]
}
if (name) {
diff --git a/api/app/lib/index.js b/api/app/lib/index.js
index 4ff9474..3b1e32b 100644
--- a/api/app/lib/index.js
+++ b/api/app/lib/index.js
@@ -55,13 +55,15 @@ module.exports.models = function (dc) {
});
const {
- DataSource, AcquisitionTask, Adapter, User, MetadataDatabase, MetadataFile, MetadataRestapi, AcquisitionLog
+ DataSource, AcquisitionTask, Adapter, User, MetadataDatabase, MetadataFile, MetadataRestapi, AcquisitionLog, ResourceCatalog
} = dc.models;
AcquisitionTask.belongsTo(DataSource, { foreignKey: 'dataSourceId', targetKey: 'id' });
DataSource.hasMany(AcquisitionTask, { foreignKey: 'dataSourceId', sourceKey: 'id' });
AcquisitionLog.belongsTo(AcquisitionTask, { foreignKey: 'task', targetKey: 'id' });
AcquisitionTask.hasMany(AcquisitionLog, { foreignKey: 'task', sourceKey: 'id' });
+ DataSource.belongsTo(ResourceCatalog, { foreignKey: 'mountPath', targetKey: 'id' });
+ ResourceCatalog.hasMany(DataSource, { foreignKey: 'mountPath', sourceKey: 'id' });
DataSource.belongsTo(Adapter, { foreignKey: 'adapterId', targetKey: 'id' });
Adapter.hasMany(DataSource, { foreignKey: 'adapterId', sourceKey: 'id' });
diff --git a/scripts/0.0.3/schema/04_update_t_adapter.sql b/scripts/0.0.3/schema/04_update_t_adapter.sql
new file mode 100644
index 0000000..673a6d7
--- /dev/null
+++ b/scripts/0.0.3/schema/04_update_t_adapter.sql
@@ -0,0 +1 @@
+update t_adapter set mode = '数据库连接' where id = 1;
\ No newline at end of file
diff --git a/web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js b/web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js
index 2d58a5a..8a0c4a7 100644
--- a/web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js
+++ b/web/client/src/sections/metadataAcquisition/components/steps/postgre/stepOne.js
@@ -40,72 +40,84 @@ function StepOne(props) {
}
return treeData
}
- const treeDataFilter = treeData && dataSources?.rows?.length > 0 ? getTreeNodeData(treeData, null, 'rc') : []
+ const renderAddonAfter = () => {
+ return !editData && <>
+ {
+ dispatch(push(`/metadataManagement/latestMetadata`));
+ }} style={{ marginRight: 8 }}>新建
+ {
+ formRef?.current?.setFieldsValue({
+ catalogKey: null
+ })
+ refresh && refresh()
+ }}>刷新
+ >
+ }
+ const treeDataFilter = treeData ? getTreeNodeData(treeData, null, 'rc') : []
const formRef = useRef();
- return
- { },
- }}
- onFinish={async (values) => {
- values.mountPath = values.catalogKey.split('-')[values.catalogKey.split('-')?.length - 1]
- next()
- stepOneValuesFinish(values)
- return true;
- }}
- style={{ marginTop: 20 }}
- submitter={{
- render: (props, defaultDoms) => {
- return null;
- },
- }}
- >
+ return { },
+ }}
+ onFinish={async (values) => {
+ values.mountPath = values.catalogKey.split('-')[values.catalogKey.split('-')?.length - 1]
+ next()
+ stepOneValuesFinish(values)
+ return true;
+ }}
+ style={{ marginTop: 20 }}
+ submitter={{
+ render: (props, defaultDoms) => {
+ return null;
+ },
+ }}
+ >
-
+
-
+
-
-
- {/*
+
+ {/* */}
- {treeDataFilter.length > 0 ? {
- return treeDataFilter || [];
- }}
- // tree-select args
- fieldProps={{
- showArrow: false,
- filterTreeNode: true,
- showSearch: true,
- dropdownMatchSelectWidth: false,
- labelInValue: false,
- autoClearSearchValue: true,
- multiple: false,
- treeNodeFilterProp: 'title',
- fieldNames: {
- label: 'title',
- },
- }}
- addonAfter={!editData && <>
- {
- dispatch(push(`/metadataManagement/latestMetadata`));
- }} style={{ marginRight: 8 }}>新建
- {
- formRef?.current?.setFieldsValue({
- catalogKey: null
- })
- refresh()
- }}>刷新
- >}
- disabled={editData}
- /> : }
+ {treeDataFilter.length > 0 ? {
+ return treeDataFilter || [];
+ }}
+ // tree-select args
+ fieldProps={{
+ showArrow: false,
+ filterTreeNode: true,
+ showSearch: true,
+ dropdownMatchSelectWidth: false,
+ labelInValue: false,
+ autoClearSearchValue: true,
+ multiple: false,
+ treeNodeFilterProp: 'title',
+ fieldNames: {
+ label: 'title',
+ },
+ }}
+ addonAfter={renderAddonAfter()}
+ disabled={editData}
+ /> : }
-
+
-
-
-
-
-
+
+
+
+
}
export default StepOne
\ No newline at end of file
diff --git a/web/client/src/sections/metadataAcquisition/containers/adapter.js b/web/client/src/sections/metadataAcquisition/containers/adapter.js
index 9d533a8..5855927 100644
--- a/web/client/src/sections/metadataAcquisition/containers/adapter.js
+++ b/web/client/src/sections/metadataAcquisition/containers/adapter.js
@@ -10,7 +10,13 @@ import { useFsRequest, ApiTable } from '$utils';
const LatestMetadata = (props) => {
const { history, actions, dispatch, adapters } = props;
const [isModalOpen, setIsModalOpen] = useState(false);
- const { data: treeData = [] } = useFsRequest({ url: ApiTable.getResourceCatalog });
+ const [refreshTree, setRefreshTree] = useState(1);
+
+ const { data: treeData = [] } = useFsRequest({
+ url: ApiTable.getResourceCatalog,
+ refreshDeps: [refreshTree]
+ });
+
useEffect(() => {
dispatch(actions.metadataAcquisition.getAdapters())
dispatch(actions.metadataAcquisition.getDataSources());
@@ -35,6 +41,11 @@ const LatestMetadata = (props) => {
{ label: '关系型数据库', key: '关系型数据库', children: renderRelationalDatabase() },
];
+ const refresh = () => {
+ // queryData();
+ setRefreshTree(refreshTree + 1)
+ }
+
const onFinish = (values) => {
const { stepOneValues, stepTwoValues, stepThreeValue } = values;
const adapterInfo = adapters?.find(x => x.adapterName == stepOneValues?.adapterName)
@@ -86,6 +97,7 @@ const LatestMetadata = (props) => {
type={isModalOpen} //当前卡片的key (目前只有postgre,支持后续扩展)
onFinish={onFinish}
treeData={treeData}
+ refresh={refresh}
{...props}
/>
diff --git a/web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js b/web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js
index 98bdd0a..75ae425 100644
--- a/web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js
+++ b/web/client/src/sections/metadataAcquisition/containers/dataSourceManagement.js
@@ -47,6 +47,7 @@ function DataSourceManagement(props) {
{
title: '挂载点',
dataIndex: 'mountPath',
+ render: (text, record) => record?.resourceCatalog?.name
},
{
title: '适配器类型',