Commit 03499704 by zhaochengxiang

资产同步schema支持es ne neo4j

parent 19d9fd4f
...@@ -491,13 +491,25 @@ const SelectSchemas = ({ visible, onCancel }) => { ...@@ -491,13 +491,25 @@ const SelectSchemas = ({ visible, onCancel }) => {
onCancel={() => { close() }} onCancel={() => { close() }}
> >
<Config onState={(state) => { <Config onState={(state) => {
const newSchemas = (state.schema??[]).map(item => { let newSchemas = []
return { console.log('state', state)
idPath: item.idPath, if (state.database?._class==='Catalog,EsDatabase' || state.database?._class==='Catalog,Neo4jDatabase') {
newSchemas = [{
idPath: state.database?.idPath,
catalog: state.env?.domainId?.toString(), catalog: state.env?.domainId?.toString(),
namePath: `${state.env?.domainName}/${state.datasource?.scopeName}/${state.database?.name}/${item.name}` namePath: `${state.env?.domainName}/${state.datasource?.scopeName}/${state.database?.name}`
} }]
}) } else {
newSchemas = (state.schema??[]).map(item => {
return {
idPath: item.idPath,
catalog: state.env?.domainId?.toString(),
namePath: `${state.env?.domainName}/${state.datasource?.scopeName}/${state.database?.name}/${item.name}`
}
})
}
console.log('newSchemas', newSchemas)
setSchemas(newSchemas) setSchemas(newSchemas)
}} /> }} />
</Modal> </Modal>
...@@ -713,24 +725,26 @@ function Config({ onState }) { ...@@ -713,24 +725,26 @@ function Config({ onState }) {
> >
{dbs?.map((item, i) => <Select.Option key={i} value={item._id} >{getValidString([undefined, item.cnName, item.name])}</Select.Option>)} {dbs?.map((item, i) => <Select.Option key={i} value={item._id} >{getValidString([undefined, item.cnName, item.name])}</Select.Option>)}
</Select> </Select>
<Select {
placeholder="请选择Schema" database?._class!=='Catalog,EsDatabase' && database?._class!=='Catalog,Neo4jDatabase' && <Select
value={schemas?.length>0?(schema??[]).map(item => item._id):undefined} placeholder="请选择Schema"
loading={loadingSchemas} value={schemas?.length>0?(schema??[]).map(item => item._id):undefined}
allowClear={true} loading={loadingSchemas}
disabled={disabled} allowClear={true}
mode="multiple" disabled={disabled}
onChange={(val) => { mode="multiple"
if ((val??[]).length > 0) { onChange={(val) => {
selectSchema((schemas??[]).filter(item => val.indexOf(item._id)!==-1)) if ((val??[]).length > 0) {
} else { selectSchema((schemas??[]).filter(item => val.indexOf(item._id)!==-1))
selectSchema(undefined) } else {
} selectSchema(undefined)
}} }
style={{ width: 250 }} }}
> style={{ width: 250 }}
{schemas?.map((item, i) => <Select.Option key={i} value={item._id} >{item.name}</Select.Option>)} >
</Select> {schemas?.map((item, i) => <Select.Option key={i} value={item._id} >{item.name}</Select.Option>)}
</Select>
}
</Space> </Space>
</Spin> </Spin>
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment