diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css index 532442bc09..d52de9d8dc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/App.css @@ -35,7 +35,7 @@ .release .release-screenshot img{ height:450px; - border-radius: 15px; + border-radius: 25px; padding: 15px; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css index b85db7892f..3aadbfe3d6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppDetailsDrawer/AppDetailsDrawer.css @@ -30,4 +30,8 @@ width: 210%; } + .app-release-cards{ + display: grid; + } + } 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 edfe0e73de..7b453a4098 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 @@ -446,7 +446,7 @@ class AppDetailsDrawer extends React.Component {
( +
@@ -521,6 +522,7 @@ class AppDetailsDrawer extends React.Component { +
)} /> diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js index 38582664dc..2c7b4f5e25 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/ListApps.js @@ -69,7 +69,7 @@ class ListApps extends React.Component { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js index dcf97a2204..0c208c776b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/ReleaseView.js @@ -127,9 +127,9 @@ class ReleaseView extends React.Component { - {release.screenshots.map((screenshotUrl) => { + {release.screenshots.map((screenshotUrl, index) => { return ( -
+
) 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 200cf9e741..1fa47170e9 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 @@ -17,38 +17,19 @@ */ import React from "react"; -import { - Card, - Button, - message, - Row, - Col, - Input, - Icon, - Select, - Switch, - Form, - Upload, - Divider, - notification, - Spin, InputNumber -} from "antd"; +import {Form, notification, Spin, Card, Row, Col} from "antd"; import axios from "axios"; import {withRouter} from 'react-router-dom' import {withConfigContext} from "../../context/ConfigContext"; import {handleApiError} from "../../js/Utils"; +import NewAppUploadForm from "../new-app/subForms/NewAppUploadForm"; -const {Option} = Select; -const {TextArea} = Input; -const InputGroup = Input.Group; - -const formItemLayout = { - labelCol: { - span: 8, - }, - wrapperCol: { - span: 16, - }, +const formConfig = { + specificElements: { + binaryFile: { + required: true + } + } }; class AddNewReleaseFormComponent extends React.Component { @@ -56,18 +37,12 @@ class AddNewReleaseFormComponent extends React.Component { constructor(props) { super(props); this.state = { - current: 0, - categories: [], - tags: [], - icons: [], - screenshots: [], loading: false, - binaryFiles: [], - isFree: true, - supportedOsVersions: [] + supportedOsVersions: [], + application: null, + release: null, + deviceType: null }; - this.lowerOsVersion = null; - this.upperOsVersion = null; } componentDidMount() { @@ -95,309 +70,76 @@ class AddNewReleaseFormComponent extends React.Component { }); }; - handleSubmit = e => { + onSuccessReleaseData = (releaseData) => { const config = this.props.context; - e.preventDefault(); const {appId, deviceType} = this.props; + this.setState({ + loading: true + }); + const {data, release} = releaseData; + + const json = JSON.stringify(release); + const blob = new Blob([json], { + type: 'application/json' + }); + data.append("applicationRelease", blob); - this.props.form.validateFields((err, values) => { - if (!err) { + const url = window.location.origin + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + + "/applications/" + deviceType + "/ent-app/" + appId; + axios.post( + url, + data + ).then(res => { + if (res.status === 201) { this.setState({ - loading: true + loading: false, }); - const {price, isSharedWithAllTenants, icon, screenshots, releaseDescription, releaseType, binaryFile} = values; - const data = new FormData(); - //add release data - const release = { - description: releaseDescription, - price: (price === undefined) ? 0 : parseInt(price), - isSharedWithAllTenants, - metaData: "[]", - releaseType: releaseType, - supportedOsVersions: `${this.lowerOsVersion}-${this.upperOsVersion}` - }; - data.append('binaryFile', binaryFile[0].originFileObj); - data.append('icon', icon[0].originFileObj); - data.append('screenshot1', screenshots[0].originFileObj); - data.append('screenshot2', screenshots[1].originFileObj); - data.append('screenshot3', screenshots[2].originFileObj); - - const json = JSON.stringify(release); - const blob = new Blob([json], { - type: 'application/json' + notification["success"]({ + message: "Done!", + description: + "New release was added successfully", }); + const uuid = res.data.data.uuid; + this.props.history.push('/publisher/apps/releases/' + uuid); - data.append("applicationRelease", blob); - - const url = window.location.origin + config.serverConfig.invoker.uri + - config.serverConfig.invoker.publisher + "/applications/" + deviceType + "/ent-app/" + appId; - - axios.post( - url, - data - ).then(res => { - if (res.status === 201) { - this.setState({ - loading: false, - }); - - notification["success"]({ - message: "Done!", - description: - "New release was added successfully", - }); - - const uuid = res.data.data.uuid; - - this.props.history.push('/publisher/apps/releases/' + uuid); - } - - }).catch((error) => { - handleApiError(error, "Sorry, we were unable to complete your request."); - this.setState({ - loading: false - }); + } else { + this.setState({ + loading: false }); } + }).catch((error) => { + handleApiError(error, "Sorry, we were unable to complete your request."); + this.setState({ + loading: false + }); }); - }; - - normFile = e => { - if (Array.isArray(e)) { - return e; - } - return e && e.fileList; - }; - - handleIconChange = ({fileList}) => this.setState({icons: fileList}); - handleBinaryFileChange = ({fileList}) => this.setState({binaryFiles: fileList}); - - handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList}); - - handlePriceTypeChange = (value) => { - this.setState({ - isFree: (value === 'free') - }); - }; - handleLowerOsVersionChange = (lowerOsVersion) => { - this.lowerOsVersion = lowerOsVersion; }; - handleUpperOsVersionChange = (upperOsVersion) => { - this.upperOsVersion = upperOsVersion; + onClickBackButton = () => { + this.props.history.push('/publisher/apps/'); }; render() { - const {isFree, icons, screenshots, loading, binaryFiles, supportedOsVersions} = this.state; - const {getFieldDecorator} = this.props.form; + const {loading, supportedOsVersions} = this.state; return (
- + -
- - - - {getFieldDecorator('binaryFile', { - valuePropName: 'binaryFile', - getValueFromEvent: this.normFile, - required: true, - message: 'Please select application' - })( - false} - > - {binaryFiles.length !== 1 && ( - - )} - , - )} - - - - {getFieldDecorator('icon', { - valuePropName: 'icon', - getValueFromEvent: this.normFile, - required: true, - message: 'Please select a icon' - })( - false} - > - {icons.length !== 1 && ( - - )} - , - )} - - - - - - - - - - {getFieldDecorator('screenshots', { - valuePropName: 'icon', - getValueFromEvent: this.normFile, - required: true, - message: 'Please select a icon' - })( - false} - multiple - > - - {screenshots.length < 3 && ( - - )} - - - , - )} - - - - {getFieldDecorator('releaseType', { - rules: [{ - required: true, - message: 'Please input the Release Type' - }], - })( - - )} - - - - {getFieldDecorator('releaseDescription', { - rules: [{ - required: true, - message: 'Please enter a description for release' - }], - })( -