Commit bf480497 by zhaochengxiang

bug fix

parent 703643b0
...@@ -120,7 +120,7 @@ class Model extends React.Component { ...@@ -120,7 +120,7 @@ class Model extends React.Component {
canBatchAddTag canBatchAddTag
}); });
} }
if (catalogId !== prevState.catalogId || permissions !== prevState.permissions) { if (catalogId !== prevState.catalogId || permissions !== prevState.permissions) {
let canAdd = true; let canAdd = true;
const index = (permissions||[]).findIndex(item => item.privilegedObjectId === catalogId); const index = (permissions||[]).findIndex(item => item.privilegedObjectId === catalogId);
...@@ -212,10 +212,42 @@ class Model extends React.Component { ...@@ -212,10 +212,42 @@ class Model extends React.Component {
} }
onTableChange = () => { onTableChange = () => {
const { currentView, catalogId, keyword, currentModelState } = this.state; const { currentView, catalogId, keyword, currentModelState, searchProperties } = this.state;
this.setState({ loadingTableData: true }, () => { this.setState({ loadingTableData: true }, () => {
if (keyword === '') { if (keyword) {
const params = {
term: keyword,
};
if (currentModelState !== '') {
params.stateId = currentModelState;
}
dispatchLatestHomepage({
type: 'datamodel.searchModel',
payload: params,
callback: data => {
this.setState({ loadingTableData: false, tableData: data||[], filterTableData: data||[] });
},
error: () => {
this.setState({ loadingTableData: false });
}
})
} else if (!catalogId) {
dispatch({
type: 'datamodel.searchModelBySearchProperties',
payload: {
data: searchProperties
},
callback: data => {
this.setState({ loadingTableData: false, tableData: data||[], filterTableData: data||[] });
},
error: () => {
this.setState({ loadingTableData: false });
}
})
} else {
if (currentView === 'dir') { if (currentView === 'dir') {
const params = { const params = {
...@@ -250,28 +282,7 @@ class Model extends React.Component { ...@@ -250,28 +282,7 @@ class Model extends React.Component {
} }
}) })
} }
} else {
const params = {
term: keyword,
};
if (currentModelState !== '') {
params.stateId = currentModelState;
}
dispatchLatestHomepage({
type: 'datamodel.searchModel',
payload: params,
callback: data => {
this.setState({ loadingTableData: false, tableData: data||[], filterTableData: data||[] });
},
error: () => {
this.setState({ loadingTableData: false });
}
})
} }
}) })
} }
...@@ -307,18 +318,7 @@ class Model extends React.Component { ...@@ -307,18 +318,7 @@ class Model extends React.Component {
this.setState({ selectSearchPropertiesVisible: false }) this.setState({ selectSearchPropertiesVisible: false })
if ((searchProperties??[]).length > 0) { if ((searchProperties??[]).length > 0) {
this.setState({ loadingTableData: true, keyword: '', catalogId: '', searchProperties }, () => { this.setState({ loadingTableData: true, keyword: '', catalogId: '', searchProperties }, () => {
dispatch({ this.onTableChange()
type: 'datamodel.searchModelBySearchProperties',
payload: {
data: searchProperties
},
callback: data => {
this.setState({ loadingTableData: false, tableData: data||[], filterTableData: data||[] });
},
error: () => {
this.setState({ loadingTableData: false });
}
})
}) })
} }
} }
......
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