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 bd7a2ef8a8..8100a25a05 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
@@ -10,12 +10,12 @@ const {Option} = Select;
const {Title, Text} = Typography;
const Search = Input.Search;
// connecting state.apps with the component
-const mapStateToProps = state => {
- return {apps: state.apps}
-};
+// const mapStateToProps = state => {
+// return {apps: state.apps}
+// };
-class ConnectedListApps extends React.Component {
+class ListApps extends React.Component {
constructor(props) {
super(props);
this.state = {
@@ -70,6 +70,6 @@ class ConnectedListApps extends React.Component {
}
}
-const ListApps = connect(mapStateToProps, {getApps})(ConnectedListApps);
+// const ListApps = connect(mapStateToProps, {getApps})(ConnectedListApps);
export default ListApps;
\ 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-app/AddNewAppForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js
new file mode 100644
index 0000000000..61b9e93d97
--- /dev/null
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/AddNewAppForm.js
@@ -0,0 +1,485 @@
+import React from "react";
+import "antd/dist/antd.css";
+import {
+ PageHeader,
+ Typography,
+ Card,
+ Steps,
+ Button,
+ message,
+ Row,
+ Col,
+ Tag,
+ Tooltip,
+ Input,
+ Icon,
+ Select,
+ Switch,
+ Form,
+ Upload,
+ Divider, notification
+} from "antd";
+import IconImage from "./IconImg";
+import UploadScreenshots from "./UploadScreenshots";
+import axios from "axios";
+import config from "../../../public/conf/config.json";
+
+const Paragraph = Typography;
+const Dragger = Upload.Dragger;
+
+const props = {
+ name: 'file',
+ multiple: false,
+ action: '//jsonplaceholder.typicode.com/posts/',
+ onChange(info) {
+ const status = info.file.status;
+ if (status !== 'uploading') {
+ console.log(info.file, info.fileList);
+ }
+ if (status === 'done') {
+ message.success(`${info.file.name} file uploaded successfully.`);
+ } else if (status === 'error') {
+ message.error(`${info.file.name} file upload failed.`);
+ }
+ },
+};
+
+//
+// const steps = [{
+// title: 'First',
+// content: Step1
+// }, {
+// title: 'Second',
+// content: Step2,
+// }, {
+// title: 'Last',
+// content: Step3,
+// }];
+
+
+const {Option} = Select;
+const {TextArea} = Input;
+const InputGroup = Input.Group;
+
+const formItemLayout = {
+ labelCol: {
+ span: 4,
+ },
+ wrapperCol: {
+ span: 20,
+ },
+};
+
+class AddNewAppFormComponent extends React.Component {
+
+ constructor(props) {
+ super(props);
+ this.state = {
+ current: 0,
+ categories: [],
+ tags: [],
+ icons: [],
+ screenshots: []
+ };
+ }
+
+ componentDidMount() {
+ this.getCategories();
+ this.getTags();
+ }
+
+ getCategories = () => {
+ axios.get(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/categories",
+ {
+ headers: {'X-Platform': config.serverConfig.platform}
+ }).then(res => {
+ if (res.status === 200) {
+ let categories = JSON.parse(res.data.data);
+ this.setState({
+ categories: categories,
+ loading: false
+ });
+ }
+
+ }).catch((error) => {
+ if (error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
+ } else {
+ message.warning('Something went wrong');
+
+ }
+ this.setState({
+ loading: false
+ });
+ });
+ };
+
+ getTags = () => {
+ axios.get(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/tags",
+ {
+ headers: {'X-Platform': config.serverConfig.platform}
+ }).then(res => {
+ if (res.status === 200) {
+ let tags = JSON.parse(res.data.data);
+ this.setState({
+ tags: tags,
+ loading: false,
+ });
+ }
+
+ }).catch((error) => {
+ if (error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
+ } else {
+ message.warning('Something went wrong');
+
+ }
+ this.setState({
+ loading: false
+ });
+ });
+ };
+
+ handleCategoryChange = (value) => {
+ console.log(`selected ${value}`);
+ };
+
+ handleSubmit = e => {
+ e.preventDefault();
+ this.props.form.validateFields((err, values) => {
+ if (!err) {
+ const {name, description, appCategories, tags, deviceType, price, isSharedWithAllTenants, binaryFile, icon, screenshots} = values;
+ const payload = {
+ binaryFile,
+ icon,
+ screenshot1: screenshots[0],
+ screenshot2: screenshots[1],
+ screenshot3: screenshots[2],
+ application:{
+ name,
+ description,
+ appCategories,
+ subType: (price === undefined || parseInt(price) === 0) ? "FREE" : "PAID",
+ tags,
+ unrestrictedRoles: [],
+ deviceType,
+ applicationReleaseWrappers: {
+ description,
+ price: (price === undefined) ? 0 : parseInt(price),
+ isSharedWithAllTenants,
+ metaData: "string",
+ supportedOsVersions: "4.0"
+ }
+ }
+
+ };
+
+ axios.post(
+ config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invoker.uri + config.serverConfig.invoker.publisher + "/applications/ent-app",
+ payload,
+ {
+ headers: {
+ 'X-Platform': config.serverConfig.platform,
+ 'Content-Type': 'multipart/mixed'
+ }
+ }).then(res => {
+ if (res.status === 201) {
+ this.setState({
+ loading: false,
+ });
+
+ notification["success"]({
+ message: "Done!",
+ description:
+ "New app was added successfully",
+ });
+ }
+
+ }).catch((error) => {
+ if (error.response.status === 401) {
+ window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + '/publisher/login';
+ } else {
+ message.warning('Something went wrong');
+
+ }
+ this.setState({
+ loading: false
+ });
+ });
+
+ console.log(payload);
+ }
+ });
+ };
+
+ normFile = e => {
+ console.log('Upload event:', e);
+ if (Array.isArray(e)) {
+ return e;
+ }
+ return e && e.fileList;
+ };
+
+ handleIconChange = ({fileList}) => this.setState({icons: fileList});
+
+ handleScreenshotChange = ({fileList}) => this.setState({screenshots: fileList});
+
+ validateIcon = (rule, value, callback) => {
+ const {icons} = this.state;
+ if (icons.length !== 1) {
+ callback("Please select icon file");
+ }
+ callback();
+ };
+
+ render() {
+ const {categories, tags, icons, screenshots} = this.state;
+ const {getFieldDecorator} = this.props.form;
+ return (
+
+
+ );
+ }
+}
+
+const AddNewAppForm = Form.create({name: 'add-new-app'})(AddNewAppFormComponent);
+export default AddNewAppForm;
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-app/IconImg.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/IconImg.js
similarity index 98%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-app/IconImg.js
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/IconImg.js
index b56dedb034..0afc7e16b3 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-app/IconImg.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/IconImg.js
@@ -37,7 +37,7 @@ class IconImage extends React.Component {
loading: false,
}));
}
- }
+ };
render() {
const uploadButton = (
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-app/UploadScreenshots.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/UploadScreenshots.js
similarity index 100%
rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/add-new-app/UploadScreenshots.js
rename to components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/new-app/UploadScreenshots.js
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js
index 4e19de369c..a60f68d707 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/index.js
@@ -9,8 +9,6 @@ import Release from "./pages/dashboard/apps/release/Release";
import AddNewApp from "./pages/dashboard/add-new-app/AddNewApp";
import Mange from "./pages/dashboard/manage/Manage";
import './index.css';
-import store from "./js/store/index";
-import {Provider} from "react-redux";
const routes = [
@@ -20,7 +18,7 @@ const routes = [
component: Login
},
{
- path: '/publisher/apps',
+ path: '/publisher/',
exact: false,
component: Dashboard,
routes: [
@@ -30,21 +28,25 @@ const routes = [
exact: true
},
{
- path: '/publisher/apps/new-app',
+ path: '/publisher/apps/releases/:uuid',
+ exact: true,
+ component: Release
+ },
+ {
+ path: '/publisher/add-new-app/enterprise',
component: AddNewApp,
exact: true
},
{
- path: '/publisher/apps/releases/:uuid',
- exact: true,
- component: Release
- }
- ]
- },{
- path: '/publisher/manage',
- exact: false,
- component: Dashboard,
- routes: [
+ path: '/publisher/add-new-app/public',
+ component: AddNewApp,
+ exact: true
+ },
+ {
+ path: '/publisher/add-new-app/web-clip',
+ component: AddNewApp,
+ exact: true
+ },
{
path: '/publisher/manage',
component: Mange,
@@ -56,9 +58,7 @@ const routes = [
ReactDOM.render(
-
-
- ,
+ ,
document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js
index 58f562f14e..32803b36a5 100644
--- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js
+++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/Dashboard.js
@@ -1,14 +1,14 @@
import React from "react";
import {Layout, Menu, Icon} from 'antd';
-
-const {Header, Content, Footer} = Layout;
-
import Logo from "../../../public/images/logo.svg";
-import {BrowserRouter,Switch,Link, NavLink} from "react-router-dom";
+import {Switch, Link} from "react-router-dom";
import RouteWithSubRoutes from "../../components/RouteWithSubRoutes"
import {Redirect} from 'react-router'
import "../../App.css";
+const {Header, Content, Footer} = Layout;
+const {SubMenu} = Menu;
+
class Dashboard extends React.Component {
constructor(props) {
super(props);
@@ -32,8 +32,18 @@ class Dashboard extends React.Component {
style={{lineHeight: '64px'}}
>
Apps
- Add New
- App
+
+
+ Add New App
+
+ }
+ >
+ Public APP
+ Enterprise APP
+ Web Clip
+
Manage
@@ -41,15 +51,13 @@ class Dashboard extends React.Component {
-
-
-
- {this.state.routes.map((route) => (
-
- ))}
+
+
+ {this.state.routes.map((route) => (
+
+ ))}
-
-
+