From c204e6f9b76927915b269f5bd8361d15a855fcc8 Mon Sep 17 00:00:00 2001 From: Jayasanka Weerasinghe Date: Sun, 15 Sep 2019 14:26:53 +0000 Subject: [PATCH] Fix server starting issue This issue is occurred as a result of having java8 codes in the source. Hence remove and replace the code. --- ...ApplicationManagementPublisherAPIImpl.java | 1 + .../react-app/public/conf/config.json | 24 +++++++++++++++++++ .../AppDetailsDrawer/AppDetailsDrawer.js | 2 +- .../new-app/subForms/NewAppDetailsForm.js | 21 +++++++++++++--- .../new-app/subForms/NewAppUploadForm.js | 2 +- .../components/new-release/AddReleaseForm.js | 4 ++-- .../react-app/src/index.js | 2 +- .../add-new-release/AddNewRelease.js | 6 ++--- 8 files changed, 51 insertions(+), 11 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java index 89721347c1..163ddc84a1 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/services/impl/ApplicationManagementPublisherAPIImpl.java @@ -48,6 +48,7 @@ import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManage import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; +import java.beans.Customizer; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json index 61464fb6f4..a79fbbc55a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/public/conf/config.json @@ -66,5 +66,29 @@ "RETIRED": { "text": "The final state of an application, where no transition of states will be allowed after this." } + }, + "installationTypes": { + "ENTERPRISE": { + "deviceTypes": [ + "android", + "ios" + ] + }, + "PUBLIC": { + "deviceTypes": [ + "android", + "ios" + ] + }, + "WEB_CLIP": { + "deviceTypes": [ + "android", + "ios" + ] + }, + "CUSTOM": { + "deviceTypes": [ + ] + } } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js index 1aa6b0bb91..b7751cf67b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.js @@ -474,7 +474,7 @@ class AppDetailsDrawer extends React.Component { Releases {/*display add new release only if app type is enterprise*/} {(app.type === "ENTERPRISE") && ( - )} { const config = this.props.context; + const {formConfig} = this.props; + console.log("test"); + + axios.get( window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types" ).then(res => { if (res.status === 200) { - const deviceTypes = JSON.parse(res.data.data); + const allDeviceTypes = JSON.parse(res.data.data); + const whitelistedDeviceTypes = config.installationTypes[formConfig.installationType].deviceTypes; + const allowedDeviceTypes = []; + allDeviceTypes.forEach(deviceType=>{ + if(whitelistedDeviceTypes.includes(deviceType.name)){ + allowedDeviceTypes.push(deviceType); + } + }); this.setState({ - deviceTypes, + deviceTypes: allowedDeviceTypes, loading: false, }); } + }).catch((error) => { + console.log(error); if (error.hasOwnProperty("response") && error.response.status === 401) { window.location.href = window.location.origin + '/publisher/login'; } else { @@ -179,6 +193,7 @@ class NewAppDetailsForm extends React.Component { const {categories, tags, deviceTypes} = this.state; const {getFieldDecorator} = this.props.form; + return (
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js index df1d2aab7c..196c058771 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/subForms/NewAppUploadForm.js @@ -77,7 +77,7 @@ class NewAppUploadForm extends React.Component { releaseType: releaseType }; - if (formConfig.installationType !== "WEB_CLIP") { + if (formConfig.installationType !== "WEB_CLIP" && formConfig.installationType !== "CUSTOM") { release.supportedOsVersions = "4.0-10.0"; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-release/AddReleaseForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-release/AddReleaseForm.js index ccb34f69d1..533d360a0a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-release/AddReleaseForm.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-release/AddReleaseForm.js @@ -69,7 +69,7 @@ class AddNewReleaseFormComponent extends React.Component { handleSubmit = e => { const config = this.props.context; e.preventDefault(); - const {appId} = this.props; + const {appId, deviceType} = this.props; this.props.form.validateFields((err, values) => { if (!err) { @@ -104,7 +104,7 @@ class AddNewReleaseFormComponent extends React.Component { data.append("applicationRelease", blob); - const url = window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/ent-app/" + appId; + const url = window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/"+deviceType+"/ent-app/" + appId; axios.post( url, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js index 998a140937..42542fa73b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js @@ -55,7 +55,7 @@ const routes = [ component: Release }, { - path: '/publisher/apps/:appId/add-release', + path: '/publisher/apps/:deviceType/:appId/add-release', component: AddNewRelease, exact: true }, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-release/AddNewRelease.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-release/AddNewRelease.js index 3a9a395850..fdc4d3623a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-release/AddNewRelease.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-release/AddNewRelease.js @@ -39,7 +39,7 @@ class AddNewRelease extends React.Component { } render() { - const {appId} = this.props.match.params; + const {appId, deviceType} = this.props.match.params; return (
@@ -51,11 +51,11 @@ class AddNewRelease extends React.Component {

Add New Release

- Maintain and manage categories and tags here.. + Add new release for the application
- +