From 9f402d5f91cc5cf20aa5fab8b54eebd1b301465e Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Tue, 23 Apr 2019 21:47:44 +0530 Subject: [PATCH] Publisher: added default child route --- .../react-app/package.json | 3 +- .../react-app/src/index.js | 8 ++--- .../react-app/src/pages/Login.js | 4 --- .../src/pages/dashboard/Dashboard.js | 29 +++++++++++-------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json index 3aa97aca33..3029a00c3f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/package.json @@ -18,7 +18,8 @@ "react-highlight-words": "^0.16.0", "react-router-config": "^5.0.0", "react-router-dom": "latest", - "react-scripts": "2.1.8" + "react-scripts": "2.1.8", + "react-router": "latest" }, "devDependencies": { "@babel/core": "^7.0.0", 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 3fc404c07d..df386140c4 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 @@ -13,19 +13,19 @@ import {Provider} from "react-redux"; const routes = [ { - path: '/publisher/Login', + path: '/publisher/login', component: Login }, { - path: '/publisher/application-mgt', + path: '/publisher', component: Dashboard, routes: [ { - path: '/publisher/application-mgt/apps', + path: '/publisher/apps', component: Apps }, { - path: '/publisher/application-mgt/new-app', + path: '/publisher/new-app', component: AddNewApp } ] diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js index f3d10d1631..e49b031118 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/Login.js @@ -43,12 +43,8 @@ class NormalLoginForm extends React.Component { inValid: false, loading : false }; - } - - - handleSubmit = (e) => { const thisForm = this; e.preventDefault(); 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 7e963d7ef9..9d8569b12a 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,19 +1,20 @@ import React from "react"; -import { Layout, Menu, Icon } from 'antd'; +import {Layout, Menu, Icon} from 'antd'; -const { Header, Content, Footer } = Layout; +const {Header, Content, Footer} = Layout; import styles from './Dashboard.less'; import Logo from "../../../public/images/logo.svg"; import {Link, NavLink} from "react-router-dom"; import RouteWithSubRoutes from "../../components/RouteWithSubRoutes" +import { Switch, Redirect } from 'react-router' class Dashboard extends React.Component { constructor(props) { super(props); this.state = { - routes : props.routes + routes: props.routes } } @@ -28,20 +29,24 @@ class Dashboard extends React.Component { theme="light" mode="horizontal" defaultSelectedKeys={['2']} - style={{ lineHeight: '64px' }} + style={{lineHeight: '64px'}} > - Apps - Apps - Add New App + Apps + Apps + Add New App - - {this.state.routes.map((route) => ( - - ))} + + + + {this.state.routes.map((route) => ( + + ))} + + -