Commit 12227dd8 by zhaochengxiang

服务属性搜索

parent d4063f55
...@@ -75,12 +75,16 @@ class Model extends React.Component { ...@@ -75,12 +75,16 @@ class Model extends React.Component {
jdbcInformationVisible: false, jdbcInformationVisible: false,
isRoot: false, isRoot: false,
importServicesVisible: false, importServicesVisible: false,
loadingAttrs: false,
attrs: [],
currentAttr: undefined,
} }
} }
componentDidMount() { componentDidMount() {
this.getModelStates(); this.getModelStates();
this.getPreference(); this.getPreference();
this.getAttrs();
window?.addEventListener("storage", this.modelEventChange); window?.addEventListener("storage", this.modelEventChange);
} }
...@@ -127,6 +131,23 @@ class Model extends React.Component { ...@@ -127,6 +131,23 @@ class Model extends React.Component {
}) })
} }
getAttrs = () => {
this.setState({ loadingAttrs: true }, () => {
dispatch({
type: 'pds.getAttrs',
payload: {
modelName: 'DataService'
},
callback: data => {
this.setState({ loadingAttrs: false, attrs: data })
},
error: () => {
this.setState({ loadingAttrs: false })
}
})
})
}
onViewChange = (value) => { onViewChange = (value) => {
this.setState({ currentView: value }); this.setState({ currentView: value });
} }
...@@ -154,7 +175,7 @@ class Model extends React.Component { ...@@ -154,7 +175,7 @@ class Model extends React.Component {
} }
onTableChange = () => { onTableChange = () => {
const { currentView, catalogId, keyword, currentModelState, currentODataState } = this.state; const { currentView, catalogId, keyword, currentModelState, currentODataState, currentAttr } = this.state;
this.setState({ loadingTableData: true }, () => { this.setState({ loadingTableData: true }, () => {
if (keyword === '') { if (keyword === '') {
...@@ -218,7 +239,8 @@ class Model extends React.Component { ...@@ -218,7 +239,8 @@ class Model extends React.Component {
const params = { const params = {
term: encodeURIComponent(keyword), term: encodeURIComponent(keyword),
namespace: `${this.props.app?.env?.domainId}`, namespace: `${this.props.app?.env?.domainId}`,
isExcludeOtherOwner: !this.props.isOnlyEnding isExcludeOtherOwner: !this.props.isOnlyEnding,
fieldName: currentAttr?.key??'',
}; };
if (currentModelState !== '') { if (currentModelState !== '') {
...@@ -777,10 +799,9 @@ class Model extends React.Component { ...@@ -777,10 +799,9 @@ class Model extends React.Component {
<Space> <Space>
{ {
(currentView==='dir'||keyword!=='') && <Space> (currentView==='dir'||keyword!=='') &&
<span>发布状态:</span>
<Select <Select
style={{ width: 120 }} style={{ width: 160 }}
onChange={(value) => { onChange={(value) => {
this.onModelStateChange(value); this.onModelStateChange(value);
}} }}
...@@ -795,31 +816,43 @@ class Model extends React.Component { ...@@ -795,31 +816,43 @@ class Model extends React.Component {
}) })
} }
</Select> </Select>
</Space> }
}
<Space> <Select allowClear
{/* <span>OData状态:</span> loading={this.state.loadingAttrs}
<Select value={this.state.currentAttr?.key}
style={{ width: 120 }} placeholder='请选择搜索属性'
onChange={(value) => { style={{ width: 160 }}
this.onODataStateChange(value); onChange={(value) => {
}} let newCurrentAttr = undefined
value={currentODataState} if (value) {
> const index = (this.state.attrs??[]).findIndex(item => item.key === value)
<Option value='0'>所有状态</Option> if (index !== -1) {
<Option value='1'>已启动</Option> newCurrentAttr = this.state.attrs[index]
<Option value='2'>未启动</Option> }
</Select> */} }
</Space>
<Space> this.setState({ currentAttr: newCurrentAttr }, () => {
<InputDebounce this.onTableChange()
placeholder="通过服务名称全文搜索" })
allowClear }}
value={keyword} >
onChange={(value) => { this.onSearchInputChange(value); }} {
style={{ width: inputWidth, marginLeft: 'auto' }} (this.state.attrs??[]).map(item => {
/> return (
</Space> <Option key={item.key} value={item.key}>{item.name}</Option>
);
})
}
</Select>
<InputDebounce
placeholder="通过服务名称全文搜索"
allowClear
value={keyword}
onChange={(value) => { this.onSearchInputChange(value); }}
style={{ width: inputWidth, marginLeft: 'auto' }}
/>
</Space> </Space>
......
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