Modify search by app field in APPM Publisher UI

feature/appm-store/pbac
Jayasanka 5 years ago
parent 1a7806e02d
commit 138ed15dff

@ -31,10 +31,16 @@ class ListApps extends React.Component {
super(props); super(props);
this.state = { this.state = {
filters: {} filters: {}
} };
this.appName = '';
} }
setFilters = (filters) => { setFilters = (filters) => {
if (this.appName === '' && filters.hasOwnProperty("appName")) {
delete filters["appName"];
} else {
filters.appName = this.appName;
}
this.setState({ this.setState({
filters filters
}); });
@ -42,6 +48,7 @@ class ListApps extends React.Component {
setSearchText = (appName) => { setSearchText = (appName) => {
const filters = {...this.state.filters}; const filters = {...this.state.filters};
this.appName = appName;
if (appName === '' && filters.hasOwnProperty("appName")) { if (appName === '' && filters.hasOwnProperty("appName")) {
delete filters["appName"]; delete filters["appName"];
} else { } else {
@ -52,6 +59,17 @@ class ListApps extends React.Component {
}); });
}; };
onChangeSearchText = (e) => {
const filters = {...this.state.filters};
const appName = e.target.value;
if (appName === '' && filters.hasOwnProperty("appName")) {
delete filters["appName"];
this.setState({
filters
});
}
};
render() { render() {
const {isDrawerVisible, filters} = this.state; const {isDrawerVisible, filters} = this.state;
return ( return (
@ -67,9 +85,10 @@ class ListApps extends React.Component {
</Col> </Col>
<Col span={18} style={{textAlign: "right"}}> <Col span={18} style={{textAlign: "right"}}>
<Search <Search
placeholder="input search text" placeholder="Search by app name"
onSearch={this.setSearchText} onSearch={this.setSearchText}
style={{width: 170, zIndex:0}} onChange={this.onChangeSearchText}
style={{width: 240, zIndex: 0}}
/> />
</Col> </Col>
</Row> </Row>

Loading…
Cancel
Save