mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'application-mgt-new' into 'application-mgt-new'
Fix APPM publisher UI according to custom type app installation feature See merge request tcdlpds/carbon-device-mgt!5
This commit is contained in:
commit
6e8d139cbc
@ -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;
|
||||
|
||||
@ -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": [
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -474,7 +474,7 @@ class AppDetailsDrawer extends React.Component {
|
||||
<Text strong={true}>Releases </Text>
|
||||
{/*display add new release only if app type is 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>)}
|
||||
<List
|
||||
style={{paddingTop: 16}}
|
||||
|
||||
@ -42,7 +42,8 @@ class NewAppDetailsForm extends React.Component {
|
||||
categories: [],
|
||||
tags: [],
|
||||
deviceTypes:[]
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -146,18 +147,31 @@ class NewAppDetailsForm extends React.Component {
|
||||
|
||||
getDeviceTypes = () => {
|
||||
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 (
|
||||
<div>
|
||||
<Row>
|
||||
|
||||
@ -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";
|
||||
}
|
||||
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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
|
||||
},
|
||||
|
||||
@ -39,7 +39,7 @@ class AddNewRelease extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const {appId} = this.props.match.params;
|
||||
const {appId, deviceType} = this.props.match.params;
|
||||
return (
|
||||
<div>
|
||||
<PageHeader style={{paddingTop: 0}}>
|
||||
@ -51,11 +51,11 @@ class AddNewRelease extends React.Component {
|
||||
</Breadcrumb>
|
||||
<div className="wrap">
|
||||
<h3>Add New Release</h3>
|
||||
<Paragraph>Maintain and manage categories and tags here..</Paragraph>
|
||||
<Paragraph>Add new release for the application</Paragraph>
|
||||
</div>
|
||||
</PageHeader>
|
||||
<div style={{background: '#f0f2f5', padding: 24, minHeight: 720}}>
|
||||
<AddNewReleaseForm appId={appId}/>
|
||||
<AddNewReleaseForm deviceType={deviceType} appId={appId}/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user