diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/favicon.ico b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/favicon.ico new file mode 100644 index 0000000000..a11777cc47 Binary files /dev/null and b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/favicon.ico differ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/index.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/index.html new file mode 100644 index 0000000000..7bee027101 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + + React App + + + +
+ + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/manifest.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/manifest.json new file mode 100644 index 0000000000..be607e4177 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "React App", + "name": "Create React App Sample", + "icons": [ + { + "src": "favicon.ico", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "./index.html", + "display": "standalone", + "theme_color": "#000000", + "background_color": "#ffffff" +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/App.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/App.jsx index 8325bbc957..16f66083d4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/App.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/App.jsx @@ -18,7 +18,7 @@ import React, {Component} from 'react'; import createHistory from 'history/createBrowserHistory'; -import {BrowserRouter as Router, Redirect, Route, Switch} from 'react-router-dom' +import {BrowserRouter as Router, Route, Switch} from 'react-router-dom' import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; import getMuiTheme from 'material-ui/styles/getMuiTheme'; import Login from './components/Login'; @@ -36,9 +36,6 @@ let muiTheme = null; if (theme.current === "default") { let defaultTheme = require("material-ui/styles/baseThemes/" + theme.default); muiTheme = getMuiTheme(defaultTheme.default); -} else { - let customTheme = require("./themes/" + theme.custom); - muiTheme = getMuiTheme(customTheme.default); } /** @@ -55,17 +52,10 @@ if (theme.current === "default") { * not want to serve the URL. * */ class Base extends Component { - - constructor() { - super(); - this.state = {}; - } - render() { - this.setState(); return (
- + @@ -73,16 +63,12 @@ class Base extends Component {
) } - - setState() { - if (this.props.location.state){ - this.state = this.props.location.state; - } else { - this.state = {}; - } - } } +Base.propTypes = { + updateState: React.PropTypes.func.isRequired +}; + /** * This component is referred by the index.js to initiate the application. * TODO: Currently the URL shows like https://localhost:9443/publisher/#/publisher/assets/apps/create. this needs to @@ -93,6 +79,11 @@ class Store extends Component { constructor() { super(); + if (!this.state) { + this.state = {}; + this.state.store = {}; + } + this.updateState = this.updateState.bind(this); } render() { @@ -101,15 +92,22 @@ class Store extends Component { - - - + }/> + }/> + }/> ); } + + updateState(data) { + this.setState(data); + } } export default Store; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/BaseLayout.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/BaseLayout.jsx index d446c7556d..acaab4d88d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/BaseLayout.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/BaseLayout.jsx @@ -26,7 +26,7 @@ import {List, ListItem} from 'material-ui/List'; import Apps from 'material-ui/svg-icons/navigation/apps'; import NotificationsIcon from 'material-ui/svg-icons/social/notifications'; import ActionAccountCircle from 'material-ui/svg-icons/action/account-circle'; -import { Link } from 'react-router-dom'; +import {Link, withRouter} from 'react-router-dom'; /** * Base Layout: @@ -36,15 +36,6 @@ import { Link } from 'react-router-dom'; * */ class BaseLayout extends Component { - constructor(props) { - super(props); - this.state = this.props.state; - } - - componentWillMount() { - - } - handleApplicationClick() { this.handleHistory('/assets/apps'); } @@ -59,9 +50,9 @@ class BaseLayout extends Component { } handleUserLogin() { - if (this.state.user) { + if (this.props.state.store.user) { return ( - + ); @@ -73,10 +64,10 @@ class BaseLayout extends Component { } handleNotification() { - if (this.state.user) { + if (this.props.state.store.user) { return ( @@ -134,11 +125,8 @@ class BaseLayout extends Component { } -BaseLayout - .propTypes = { +BaseLayout.propTypes = { children: PropTypes.element }; -export -default -BaseLayout; +export default withRouter(BaseLayout); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/Login.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/Login.jsx index 31d3404d39..f7938349a8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/Login.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/Login.jsx @@ -61,14 +61,18 @@ class Login extends Component { handleLogin(event) { event.preventDefault(); + console.log(this.props); //TODO: send authentication request. let location = { - pathname: this.state.referrer, - state: { - notifications: 0, - user: this.state.userName + pathname: this.state.referrer + }; + let storeState = { + store : { + user: this.state.userName, + notifications: 0 } }; + this.props.updateState(storeState); this.props.history.push(location); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/themes/custom-theme.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/index.js similarity index 58% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/themes/custom-theme.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/index.js index f8cfdff1bf..de55ff9eed 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/themes/custom-theme.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/components/index.js @@ -16,24 +16,10 @@ * under the License. */ + +import BaseLayout from './BaseLayout'; /** - * This a sample custom theme file. In config.json, if the following changes are done, this theme will be applied. - * { - * "theme" : { - * "type" : "custom", - * "value" : "custom-theme" - * } - * } + * Contains all UI components related to Application, Login and Platform */ -import { - indigo500, indigo700, redA200, -} from 'material-ui/styles/colors'; -export default { - palette: { - primary1Color: indigo500, - primary2Color: indigo700, - accent1Color: redA200, - pickerHeaderColor: indigo500, - }, -}; +export default {BaseLayout}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.css b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.css deleted file mode 100644 index 79d5feec51..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.css +++ /dev/null @@ -1,51 +0,0 @@ -body { - font: 14px "Century Gothic", Futura, sans-serif; - margin: 20px; -} - -ol, ul { - padding-left: 30px; -} - -.board-row:after { - clear: both; - content: ""; - display: table; -} - -.status { - margin-bottom: 10px; -} - -.square { - background: #fff; - border: 1px solid #999; - float: left; - font-size: 24px; - font-weight: bold; - line-height: 34px; - height: 34px; - margin-right: -1px; - margin-top: -1px; - padding: 0; - text-align: center; - width: 34px; -} - -.square:focus { - outline: none; -} - -.kbd-navigation .square:focus { - background: #ddd; -} - -.game { - display: flex; - flex-direction: row; -} - -.game-info { - margin-left: 20px; -} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js index 12795d528e..4f0bad39fa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js @@ -1,8 +1,6 @@ import React from 'react'; import ReactDOM from 'react-dom'; import Store from './App'; -import './index.css'; - ReactDOM.render(, document.getElementById('root')); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/themes/custom-theme.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/themes/custom-theme.js deleted file mode 100644 index e69de29bb2..0000000000