From 6849222774b45d35ebeae68b736cdbce142ac41d Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Wed, 17 Jul 2019 15:11:17 +0530 Subject: [PATCH] Fix device load issue in APPM store --- .../components/apps/release/ReleaseView.js | 10 +++++++--- .../apps/release/install/AppInstallModal.js | 3 ++- .../apps/release/install/DeviceInstall.js | 19 +++++-------------- .../pages/dashboard/apps/release/Release.js | 4 +++- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js index 72b2db0e060..3597036318e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/ReleaseView.js @@ -91,12 +91,16 @@ class ReleaseView extends React.Component { }; render() { - const app = this.props.app; + const {app,deviceType} = this.props; const release = app.applicationReleases[0]; return (
- +
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js index 17636f7e7a2..c6bd55d9fb5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/AppInstallModal.js @@ -12,6 +12,7 @@ class AppInstallModal extends React.Component{ data:[] }; render() { + const {deviceType} = this.props; return (
- + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js index 01e02901365..60a69960fcb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/components/apps/release/install/DeviceInstall.js @@ -113,7 +113,7 @@ class DeviceInstall extends React.Component { //fetch data from api fetch = (params = {}) => { this.setState({loading: true}); - + const {deviceType} = this.props; // get current page const currentPage = (params.hasOwnProperty("page")) ? params.page : 1; @@ -121,25 +121,16 @@ class DeviceInstall extends React.Component { offset: 10 * (currentPage - 1), //calculate the offset limit: 10, status: "ACTIVE", - requireDeviceInfo: true + requireDeviceInfo: true, + type: deviceType }; // note: encode with '%26' not '&' - const encodedExtraParams = Object.keys(extraParams).map(key => key + '=' + extraParams[key]).join('%26'); - - const parameters = { - method: "get", - 'content-type': "application/json", - payload: "{}", - 'api-endpoint': "/device-mgt/v1.0/devices?" + encodedExtraParams - }; - - //url-encode parameters - const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&'); + const encodedExtraParams = Object.keys(extraParams).map(key => key + '=' + extraParams[key]).join('&'); //send request to the invoker axios.get( - config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"devices?" + encodedExtraParams, + config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt+"/devices?" + encodedExtraParams, ).then(res => { if (res.status === 200) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/release/Release.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/release/Release.js index acd6ded3005..6135faf9509 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/release/Release.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/dashboard/apps/release/Release.js @@ -71,10 +71,12 @@ class Release extends React.Component { render() { const {app, loading} = this.state; + const {deviceType} = this.props.match.params; + let content = No Releases Found; if (app != null && app.applicationReleases.length!==0) { - content = ; + content = ; }