Fix server starting issue

This issue is occurred as a result of having java8 codes in the source. Hence remove and replace the code.
feature/appm-store/pbac
Jayasanka Weerasinghe 5 years ago committed by Dharmakeerthi Lasantha
parent cfd0f709ef
commit c204e6f9b7

@ -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.common.services.ApplicationManager;
import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException; import org.wso2.carbon.device.application.mgt.core.exception.NotFoundException;
import java.beans.Customizer;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;

@ -66,5 +66,29 @@
"RETIRED": { "RETIRED": {
"text": "The final state of an application, where no transition of states will be allowed after this." "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": [
]
}
} }
} }

@ -474,7 +474,7 @@ class AppDetailsDrawer extends React.Component {
<Text strong={true}>Releases </Text> <Text strong={true}>Releases </Text>
{/*display add new release only if app type is enterprise*/} {/*display add new release only if app type is enterprise*/}
{(app.type === "ENTERPRISE") && ( {(app.type === "ENTERPRISE") && (
<Link to={`/publisher/apps/${app.id}/add-release`}><Button htmlType="button" size="small">Add <Link to={`/publisher/apps/${app.deviceType}/${app.id}/add-release`}><Button htmlType="button" size="small">Add
new release</Button></Link>)} new release</Button></Link>)}
<List <List
style={{paddingTop: 16}} style={{paddingTop: 16}}

@ -42,7 +42,8 @@ class NewAppDetailsForm extends React.Component {
categories: [], categories: [],
tags: [], tags: [],
deviceTypes:[] deviceTypes:[]
} };
} }
@ -146,18 +147,31 @@ class NewAppDetailsForm extends React.Component {
getDeviceTypes = () => { getDeviceTypes = () => {
const config = this.props.context; const config = this.props.context;
const {formConfig} = this.props;
console.log("test");
axios.get( axios.get(
window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types" window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + "/device-types"
).then(res => { ).then(res => {
if (res.status === 200) { 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({ this.setState({
deviceTypes, deviceTypes: allowedDeviceTypes,
loading: false, loading: false,
}); });
} }
}).catch((error) => { }).catch((error) => {
console.log(error);
if (error.hasOwnProperty("response") && error.response.status === 401) { if (error.hasOwnProperty("response") && error.response.status === 401) {
window.location.href = window.location.origin + '/publisher/login'; window.location.href = window.location.origin + '/publisher/login';
} else { } else {
@ -179,6 +193,7 @@ class NewAppDetailsForm extends React.Component {
const {categories, tags, deviceTypes} = this.state; const {categories, tags, deviceTypes} = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
return ( return (
<div> <div>
<Row> <Row>

@ -77,7 +77,7 @@ class NewAppUploadForm extends React.Component {
releaseType: releaseType releaseType: releaseType
}; };
if (formConfig.installationType !== "WEB_CLIP") { if (formConfig.installationType !== "WEB_CLIP" && formConfig.installationType !== "CUSTOM") {
release.supportedOsVersions = "4.0-10.0"; release.supportedOsVersions = "4.0-10.0";
} }

@ -69,7 +69,7 @@ class AddNewReleaseFormComponent extends React.Component {
handleSubmit = e => { handleSubmit = e => {
const config = this.props.context; const config = this.props.context;
e.preventDefault(); e.preventDefault();
const {appId} = this.props; const {appId, deviceType} = this.props;
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (!err) { if (!err) {
@ -104,7 +104,7 @@ class AddNewReleaseFormComponent extends React.Component {
data.append("applicationRelease", blob); 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( axios.post(
url, url,

@ -55,7 +55,7 @@ const routes = [
component: Release component: Release
}, },
{ {
path: '/publisher/apps/:appId/add-release', path: '/publisher/apps/:deviceType/:appId/add-release',
component: AddNewRelease, component: AddNewRelease,
exact: true exact: true
}, },

@ -39,7 +39,7 @@ class AddNewRelease extends React.Component {
} }
render() { render() {
const {appId} = this.props.match.params; const {appId, deviceType} = this.props.match.params;
return ( return (
<div> <div>
<PageHeader style={{paddingTop: 0}}> <PageHeader style={{paddingTop: 0}}>
@ -51,11 +51,11 @@ class AddNewRelease extends React.Component {
</Breadcrumb> </Breadcrumb>
<div className="wrap"> <div className="wrap">
<h3>Add New Release</h3> <h3>Add New Release</h3>
<Paragraph>Maintain and manage categories and tags here..</Paragraph> <Paragraph>Add new release for the application</Paragraph>
</div> </div>
</PageHeader> </PageHeader>
<div style={{background: '#f0f2f5', padding: 24, minHeight: 720}}> <div style={{background: '#f0f2f5', padding: 24, minHeight: 720}}>
<AddNewReleaseForm appId={appId}/> <AddNewReleaseForm deviceType={deviceType} appId={appId}/>
</div> </div>
</div> </div>

Loading…
Cancel
Save