Commit 7f796881 by zhaochengxiang

资源目录同步schema

parent 3c598fe3
...@@ -249,7 +249,7 @@ export function getPreviewRangeByDirId(payload) { ...@@ -249,7 +249,7 @@ export function getPreviewRangeByDirId(payload) {
} }
export function resourceTestSyncStrategy(payload) { export function resourceTestSyncStrategy(payload) {
return PostJSON("/dataassetmanager/resourceApi/testSyncStrategy", payload) return Post("/dataassetmanager/resourceApi/testSyncStrategy", payload)
} }
export function getDirectoryWithSyncStrategy(payload) { export function getDirectoryWithSyncStrategy(payload) {
......
...@@ -315,20 +315,22 @@ const FC = (props) => { ...@@ -315,20 +315,22 @@ const FC = (props) => {
} }
const onUpdateNodeCancel = (refresh = false, nodeId = undefined) => { const onUpdateNodeCancel = (refresh = false, nodeId = undefined) => {
setUpdateNodeParam({ setUpdateNodeParam(prevParam => {
visible: false,
action: undefined,
id: undefined
})
if (refresh) { if (refresh) {
if (nodeId) { if (prevParam.action !== 'add' && nodeId) {
setSelectedKey(nodeId) setSelectedKey(nodeId)
getTreeData() getTreeData()
} else { } else {
getTreeData(false) getTreeData(false)
} }
} }
return {
visible: false,
action: undefined,
id: undefined
}
})
} }
const onImportNodeCancel = (refresh = false, resetSelectedNode = false) => { const onImportNodeCancel = (refresh = false, resetSelectedNode = false) => {
......
...@@ -57,6 +57,7 @@ const FC = (props) => { ...@@ -57,6 +57,7 @@ const FC = (props) => {
if (action === 'add') { if (action === 'add') {
if (basicRef.current?.getType === 'child') { if (basicRef.current?.getType === 'child') {
parentPath = node?.directory?.path parentPath = node?.directory?.path
rows.resourceType = node?.directory?.resourceType
} }
} else { } else {
parentPath = node?.directory?.path.substring(0, node?.directory?.path.lastIndexOf("/")) parentPath = node?.directory?.path.substring(0, node?.directory?.path.lastIndexOf("/"))
...@@ -172,7 +173,7 @@ export const Basic = React.forwardRef(function ({ node, action }, ref) { ...@@ -172,7 +173,7 @@ export const Basic = React.forwardRef(function ({ node, action }, ref) {
<Form.Item <Form.Item
label="资源类型" label="资源类型"
name="resourceType" name="resourceType"
rules={[{ required: true, message: '请选择资源类型!' }]} rules={[{ required: (action==='add'&&type==='root')?true:false, message: '请选择资源类型!' }]}
> >
{ {
(action==='add'&&type==='root') ? <Select allowClear> (action==='add'&&type==='root') ? <Select allowClear>
...@@ -232,13 +233,7 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) { ...@@ -232,13 +233,7 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) {
React.useImperativeHandle(ref, () => ({ React.useImperativeHandle(ref, () => ({
validate: async () => { validate: async () => {
const rows = await form.validateFields() const rows = await form.validateFields()
if (!rows.blacklist) { convertRows(rows)
rows.blacklist = ''
}
if (!rows.whitelist) {
rows.whitelist = ''
}
return rows return rows
}, },
}), [form]) }), [form])
...@@ -251,19 +246,29 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) { ...@@ -251,19 +246,29 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) {
} }
}, [action, node]) }, [action, node])
const onTestClick = () => { const convertRows = (rows) => {
if (!testData) { if (!rows.schemas) {
showMessage('warn', '请先输入测试数据') rows.schemas = []
return }
if (!rows.autoSyncStatus) {
rows.autoSyncStatus = 0
} }
const rows = form?.getFieldsValue()
if (!rows.blacklist) { if (!rows.blacklist) {
rows.blacklist = '' rows.blacklist = ''
} }
if (!rows.whitelist) { if (!rows.whitelist) {
rows.whitelist = '' rows.whitelist = ''
} }
}
const onTestClick = () => {
if (!testData) {
showMessage('warn', '请先输入测试数据')
return
}
const rows = form?.getFieldsValue()
convertRows(rows)
dispatch({ dispatch({
type: 'assetmanage.resourceTestSyncStrategy', type: 'assetmanage.resourceTestSyncStrategy',
...@@ -274,7 +279,7 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) { ...@@ -274,7 +279,7 @@ export const SyncBasic = React.forwardRef(function ({ node, action }, ref) {
data: rows, data: rows,
}, },
callback: data => { callback: data => {
setTestResultData(data)
}, },
error: () => { error: () => {
......
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