From f1f7a3d9e3f6c7fe3b2b4c298342ca4a00406282 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Mon, 7 Oct 2019 15:01:05 +0530 Subject: [PATCH] Add supported OS versions to add new release form in APPM UI --- .../AppDetailsDrawer/AppDetailsDrawer.js | 2 +- .../components/new-release/AddReleaseForm.js | 77 +++++++++++++++---- 2 files changed, 63 insertions(+), 16 deletions(-) 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 d42a2a8a097..edfe0e73de1 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 @@ -490,7 +490,7 @@ class AppDetailsDrawer extends React.Component {
{(app.type === "ENTERPRISE") && ( - )} { + getSupportedOsVersions = (deviceType) => { const config = this.props.context; axios.get( - window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + - "/admin/device-types/{deviceTypeName}/versions" + window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.deviceMgt + + `/admin/device-types/${deviceType}/versions` ).then(res => { if (res.status === 200) { - - // let tags = JSON.parse(res.data.data); - // this.setState({ - // tags: tags, - // loading: false, - // }); + let supportedOsVersions = JSON.parse(res.data.data); + this.setState({ + supportedOsVersions, + loading: false, + }); } }).catch((error) => { handleApiError(error, "Error occurred while trying to load supported OS versions."); @@ -116,9 +117,8 @@ class AddNewReleaseFormComponent extends React.Component { isSharedWithAllTenants, metaData: "string", releaseType: releaseType, - supportedOsVersions: "4-30" + supportedOsVersions: `${this.lowerOsVersion}-${this.upperOsVersion}` }; - data.append('binaryFile', binaryFile[0].originFileObj); data.append('icon', icon[0].originFileObj); data.append('screenshot1', screenshots[0].originFileObj); @@ -132,7 +132,7 @@ class AddNewReleaseFormComponent extends React.Component { data.append("applicationRelease", blob); - const url = window.location.origin+ config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/"+deviceType+"/ent-app/" + appId; + const url = window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/" + deviceType + "/ent-app/" + appId; axios.post( url, @@ -151,7 +151,7 @@ class AddNewReleaseFormComponent extends React.Component { const uuid = res.data.data.uuid; - this.props.history.push('/publisher/apps/releases/'+uuid); + this.props.history.push('/publisher/apps/releases/' + uuid); } }).catch((error) => { @@ -182,8 +182,16 @@ class AddNewReleaseFormComponent extends React.Component { }); }; + handleLowerOsVersionChange = (lowerOsVersion) => { + this.lowerOsVersion = lowerOsVersion; + }; + + handleUpperOsVersionChange = (upperOsVersion) => { + this.upperOsVersion = upperOsVersion; + }; + render() { - const {isFree, icons, screenshots, loading, binaryFiles} = this.state; + const {isFree, icons, screenshots, loading, binaryFiles, supportedOsVersions} = this.state; const {getFieldDecorator} = this.props.form; return (
@@ -291,6 +299,45 @@ class AddNewReleaseFormComponent extends React.Component { )} + + {getFieldDecorator('supportedOS')( +
+ + + + + + +

-

+ + + + +
+
+
+ )} +
+ {getFieldDecorator('select', { rules: [{required: true, message: 'Please select price Type'}],