Commit 12227dd8 by zhaochengxiang

服务属性搜索

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