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 0ea6c3218c..5d9f074d94 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
@@ -13,7 +13,7 @@
"store": "/application-mgt-store/v1.0",
"admin" : ""
},
- "loginUri": "/ui-request-handler/login",
+ "loginUri": "/publisher-ui-request-handler/login",
"platform": "publisher"
},
"defaultPlatformIcons": {
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/ReleaseModal.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/ReleaseModal.js
deleted file mode 100644
index 661ba1efbd..0000000000
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/ReleaseModal.js
+++ /dev/null
@@ -1,85 +0,0 @@
-import React from "react";
-import {Modal, Typography,List, Avatar} from 'antd';
-import {connect} from 'react-redux';
-import {Link} from "react-router-dom";
-
-// connecting state.releaseView with the component
-const mapStateToProps = state => {
- return {releaseView: state.releaseView}
-};
-
-const Text = Typography;
-
-class ConnectedReleaseModal extends React.Component {
- constructor(props) {
- super(props);
- this.state = {
- visible: false,
- app: null
- };
- }
-
- componentWillReceiveProps(nextProps) {
- if (nextProps !== this.props) {
- this.setState({
- visible: nextProps.releaseView.visible,
- app: nextProps.releaseView.app
- })
- }
- }
-
- showModal = () => {
- this.setState({
- visible: true,
- });
- };
-
- handleOk = (e) => {
- this.setState({
- visible: false,
- });
- };
-
- handleCancel = (e) => {
- this.setState({
- visible: false,
- });
- };
-
- render() {
- if (this.props.releaseView.app != null) {
- const app = this.props.releaseView.app;
- return (
-
-
- Some contents...
- (
-
- }
- title={{release.version}}
- description={release.description}
- />
-
- )}
- />
-
-
- );
- } else {
- return null;
- }
- }
-}
-
-const ReleaseModal = connect(mapStateToProps, null)(ConnectedReleaseModal);
-
-export default ReleaseModal;
\ No newline at end of file
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 31290b0a89..17b3f7364e 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
@@ -5,6 +5,7 @@ import Reviews from "./review/Reviews";
import "../../../App.css";
import config from "../../../../public/conf/config.json";
import DetailedRating from "../detailed-rating/DetailedRating";
+import EditRelease from "./edit-release/EditRelease";
const {Title, Text, Paragraph} = Typography;
@@ -12,7 +13,7 @@ class ReleaseView extends React.Component {
render() {
const app = this.props.app;
const release = (app !== null) ? app.applicationReleases[0] : null;
- if(release == null){
+ if (release == null) {
return null;
}
return (
@@ -24,7 +25,7 @@ class ReleaseView extends React.Component {
{app.name}
- Version : {release.version}
+ Version : {release.version}
+
-
-
-
-
+
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js
new file mode 100644
index 0000000000..00d89a7df4
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/release/edit-release/EditRelease.js
@@ -0,0 +1,312 @@
+import React from "react";
+import {Modal, Button, Icon, notification, Spin, Row, Col, Card, Upload, Input, Switch, Form} from 'antd';
+import config from "../../../../../public/conf/config.json";
+import axios from "axios";
+
+const {TextArea} = Input;
+
+const formItemLayout = {
+ labelCol: {
+ span: 8,
+ },
+ wrapperCol: {
+ span: 16,
+ },
+};
+
+
+class EditReleaseModal extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ visible: false,
+ current: 0,
+ categories: [],
+ tags: [],
+ icons: [],
+ screenshots: [],
+ loading: false,
+ binaryFiles: []
+ };
+ }
+
+ showModal = () => {
+ this.setState({
+ visible: true,
+ });
+ };
+
+ handleOk = e => {
+ console.log(e);
+ this.setState({
+ visible: false,
+ });
+ };
+
+ handleCancel = e => {
+ console.log(e);
+ this.setState({
+ visible: false,
+ });
+ };
+
+ normFile = e => {
+ console.log('Upload event:', 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});
+
+
+ handleSubmit = e => {
+ e.preventDefault();
+ const {appId} = this.props;
+
+ this.props.form.validateFields((err, values) => {
+ if (!err) {
+ this.setState({
+ loading: true
+ });
+ 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: "string",
+ releaseType: releaseType,
+ supportedOsVersions: "4.0-10.0"
+ };
+
+ 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'
+ });
+
+ data.append("applicationRelease", blob);
+
+ const url = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/ent-app/" + appId;
+
+ axios.put(
+ url,
+ data,
+ {
+ headers: {
+ 'X-Platform': config.serverConfig.platform
+ },
+ }
+ ).then(res => {
+ if (res.status === 201) {
+ this.setState({
+ loading: false,
+ });
+
+ notification["success"]({
+ message: "Done!",
+ description:
+ "Saved!",
+ });
+
+ console.log(res);
+
+ const uuid = res.data.data.uuid;
+
+ this.props.history.push('/publisher/apps/releases/' + uuid);
+ }
+
+ }).catch((error) => {
+ console.log(error);
+ if (error.hasOwnProperty("response") && error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
+ } else {
+ notification["error"]({
+ message: "Something went wrong!",
+ description:
+ "Sorry, we were unable to complete your request.",
+ });
+
+ }
+ this.setState({
+ loading: false
+ });
+ console.log(error);
+ });
+ }
+ });
+ };
+
+
+ render() {
+ const {categories, tags, icons, screenshots, loading, binaryFiles} = this.state;
+ const {getFieldDecorator} = this.props.form;
+ 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'
+ }],
+ })(
+
+
+
+ {getFieldDecorator('price', {
+ rules: [{
+ required: false
+ }],
+ })(
+
+ )}
+
+
+
+ {getFieldDecorator('isSharedWithAllTenants', {
+ rules: [{
+ required: true,
+ message: 'Please select'
+ }],
+ initialValue: false
+ })(
+ }
+ unCheckedChildren={}
+ />
+ )}
+
+
+
+
+
+
+
+
+
+
+ );
+ }
+
+}
+
+const EditRelease = Form.create({name: 'add-new-release'})(EditReleaseModal);
+
+export default EditRelease;
\ No newline at end of file
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 35ac487e60..7cae042f05 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
@@ -1,5 +1,4 @@
import React from "react";
-import "antd/dist/antd.css";
import {
Card,
Button,
@@ -155,7 +154,6 @@ class AddNewReleaseFormComponent extends React.Component {
render() {
const {categories, tags, icons, screenshots, loading, binaryFiles} = this.state;
const {getFieldDecorator} = this.props.form;
- const {formConfig} = this.props;
return (
@@ -305,5 +303,5 @@ class AddNewReleaseFormComponent extends React.Component {
}
}
-const AddReleaseForm = withRouter(Form.create({name: 'add-new-app'})(AddNewReleaseFormComponent));
+const AddReleaseForm = withRouter(Form.create({name: 'add-new-release'})(AddNewReleaseFormComponent));
export default AddReleaseForm;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js
index 4a740f73e3..1ba489a6ac 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js
@@ -2,7 +2,7 @@ import React from "react";
import "antd/dist/antd.css";
import {PageHeader, Typography,Input, Button, Row, Col} from "antd";
import AppList from "../../../components/apps/AppList";
-import ReleaseModal from "../../../components/apps/ReleaseModal";
+// import ReleaseModal from "../../../components/apps/ReleaseModal";
const Search = Input.Search;
@@ -47,7 +47,7 @@ class Apps extends React.Component {
-
+ {/**/}
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
index 67a3d92085..bac349fe2f 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps.js
@@ -2,7 +2,6 @@ import React from "react";
import "antd/dist/antd.css";
import {PageHeader, Typography,Input, Button, Row, Col} from "antd";
import ListApps from "../../../components/apps/list-apps/ListApps";
-import ReleaseModal from "../../../components/apps/ReleaseModal";
const Search = Input.Search;