From 138ed15dff6839a43fc633859e0f800056dcbabf Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Mon, 28 Oct 2019 11:59:12 +0530 Subject: [PATCH] Modify search by app field in APPM Publisher UI --- .../src/components/apps/list-apps/ListApps.js | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js index 401b35b79d..2af6f06975 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js @@ -31,10 +31,16 @@ class ListApps extends React.Component { super(props); this.state = { filters: {} - } + }; + this.appName = ''; } setFilters = (filters) => { + if (this.appName === '' && filters.hasOwnProperty("appName")) { + delete filters["appName"]; + } else { + filters.appName = this.appName; + } this.setState({ filters }); @@ -42,6 +48,7 @@ class ListApps extends React.Component { setSearchText = (appName) => { const filters = {...this.state.filters}; + this.appName = appName; if (appName === '' && filters.hasOwnProperty("appName")) { delete filters["appName"]; } 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() { const {isDrawerVisible, filters} = this.state; return ( @@ -67,9 +85,10 @@ class ListApps extends React.Component {