From cbc061f739128dae9ba2cbda65eefb503b47eeb5 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Mon, 21 Aug 2017 14:14:34 +0530 Subject: [PATCH] Changes as per the comments. --- .../pom.xml | 74 +++++-------------- .../src/main/resources/publisher/.babelrc | 2 +- .../src/main/resources/publisher/package.json | 2 + .../resources/publisher/public/index.html | 17 +++++ .../src/main/resources/publisher/src/App.js | 40 +++++++--- .../{Create.js => ApplicationCreate.js} | 52 ++++++++++++- .../Application/ApplicationListing.js | 13 ++++ .../{AppView.js => ApplicationView.js} | 13 ++++ .../src/components/Application/Forms/Step1.js | 47 +++++++++--- .../src/components/Application/Forms/Step2.js | 56 ++++++++++++-- .../src/components/Application/Forms/Step3.js | 36 ++++++++- .../src/components/Base/BaseLayout.js | 3 +- .../src/components/Error/NotFound.js | 13 ++-- .../components/Overview/PublisherOverview.js | 8 +- .../Platform/{Create.js => PlatformCreate.js} | 21 ++++++ .../components/Platform/PlatformListing.js | 21 ++++++ .../src/components/Platform/PlatformView.js | 21 ++++++ .../src/components/Reviews/ReviewListing.js | 21 ++++++ .../src/components/Reviews/ReviewView.js | 21 ++++++ .../src/components/UIComponents/DataTable.js | 21 ++++++ .../src/components/UIComponents/SimpleForm.js | 17 ----- .../src/components/User/Login/Login.js | 28 +++++-- .../src/components/User/Logout/Logout.js | 0 .../publisher/src/components/index.js | 13 ++-- .../src/main/resources/publisher/src/index.js | 7 +- .../publisher/src/stores/ApplicationStore.js | 19 +++++ .../publisher/src/stores/PlatformStore.js | 1 + .../publisher/src/stores/ReviewStore.js | 2 + .../resources/publisher/src/stores/index.js | 9 ++- .../resources/publisher/webpack.config.js | 17 +++++ 30 files changed, 479 insertions(+), 136 deletions(-) rename components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/{Create.js => ApplicationCreate.js} (79%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/{AppView.js => ApplicationView.js} (72%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/{Create.js => PlatformCreate.js} (67%) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/SimpleForm.js delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Logout/Logout.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml index cb06ef0980..8f8412c9af 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml @@ -1,4 +1,21 @@ + @@ -9,18 +26,9 @@ application-mgt 3.0.46-SNAPSHOT - org.wso2.carbon.device.application.mgt.publisher.ui 3.0.46-SNAPSHOT - - - - - - - - @@ -77,36 +85,6 @@ - - - npm run build (compile) @@ -122,21 +100,6 @@ - - - - - - - - - - - - - - - ${npm.working.dir} @@ -165,5 +128,4 @@ build_prod ./src/main/ - - \ No newline at end of file + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/.babelrc b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/.babelrc index 02f08fb6c0..3c078e9f99 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/.babelrc +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/.babelrc @@ -2,4 +2,4 @@ "presets": [ "es2015" ] -} \ No newline at end of file +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/package.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/package.json index fe5f46e421..804eea3d0d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/package.json +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/package.json @@ -15,9 +15,11 @@ "latest-version": "^3.1.0", "material-ui": "^0.19.0", "material-ui-datatables": "^0.18.2", + "prop-types": "^15.5.10", "qs": "^6.5.0", "react": "^15.6.1", "react-dom": "^15.6.1", + "react-dropzone": "^4.1.0", "react-images-uploader": "^1.1.0", "react-material-ui-form-validator": "^0.5.0", "react-modal": "^2.2.2", diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/public/index.html b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/public/index.html index e684fd6f87..b7e1fc8d4d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/public/index.html +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/public/index.html @@ -1,4 +1,21 @@ + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.js index 771422d0c1..faa4e14359 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.js @@ -20,15 +20,26 @@ import './App.css' import React, {Component} from 'react'; import createHistory from 'history/createHashHistory'; import {HashRouter as Router, Redirect, Route, Switch} from 'react-router-dom' -import {BaseLayout, Create, Login, NotFound, PublisherOverview} from './components' +import {BaseLayout, ApplicationCreate, Login, NotFound, PublisherOverview, PlatformCreate} from './components' const history = createHistory({basename: '/publisher'}); +/** + * This component defines the layout and the routes for the app. + * All the content will be loaded inside the Base component. + * The base component includes the Core layout and the routers according to which the content will be displayed. + * + * The Router and Route components. + * The Router and Route is used for navigation. + * We specify the component which needs to be rendered for an URL. + * Ex: When navigate to publisher/overview, the overview component will be rendered inside the main layout. + * */ + class Base extends Component { constructor() { super(); this.state = { - user: "s" + user: "admin" } } @@ -40,15 +51,15 @@ class Base extends Component { - {/**/} - {/**/} - - {/**/} - - - - - + + + + + + + + + @@ -60,6 +71,9 @@ class Base extends Component { } } +/** + * This component is referred by the index.js to initiate the application. + * */ class Publisher extends Component { render() { return ( @@ -76,4 +90,8 @@ class Publisher extends Component { } } +Publisher.propTypes = { + user: Object +}; + export default Publisher; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.js similarity index 79% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.js index 58fa7aa8ec..849a994663 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.js @@ -25,7 +25,16 @@ import RaisedButton from 'material-ui/RaisedButton'; import {Card, CardActions, CardTitle} from 'material-ui/Card'; import {Step, StepLabel, Stepper,} from 'material-ui/Stepper'; -class Create extends Component { + +/** + * The App Create Component. + * + * Application creation is handled through a Wizard. (We use Material UI Stepper.) + * + * In each step, data will be set to the state separately. + * When the wizard is completed, data will be arranged and sent to the api. + * */ +class ApplicationCreate extends Component { constructor() { super(); this.setStepData.bind(this); @@ -42,6 +51,9 @@ class Create extends Component { }; } + /** + * Handles next button click event. + * */ handleNext = () => { const {stepIndex} = this.state; this.setState({ @@ -50,14 +62,25 @@ class Create extends Component { }); }; + /** + * Handles form submit. + * */ handleSubmit = () => { console.log(this.state.stepData); }; + /** + * Handles cancel button click event. + * This will show a confirmation dialog to cancel the application creation process. + * */ handleCancel = () => { this.setState({isDialogOpen: true}); }; + /** + * Handled [ < Prev ] button click. + * This clears the data in the current step and returns to the previous step. + * */ handlePrev = () => { const {stepIndex} = this.state; if (stepIndex > 0) { @@ -66,6 +89,9 @@ class Create extends Component { } }; + /** + * Saves form data in each step in to the state. + * */ setStepData = (step, data) => { console.log(step, data, this.state.stepData); let tmpStepData = this.state.stepData; @@ -83,14 +109,31 @@ class Create extends Component { this.setState({stepData: tempData}); }; + /** + * Handles the Yes button in app creation cancellation dialog. + * Clears all the form data and reset the wizard. + * */ handleYes = () => { this.setState({finished: false, stepIndex: 0, stepData: [], isDialogOpen: false}); }; + /** + * Handles No button in app creation cancellation dialog. + * Returns to the same step. + * */ handleNo = () => { this.setState({isDialogOpen: false}); }; + /** + * Defines all the Steps in the stepper. (Wizard) + * + * Extension Point: If any extra steps needed, follow the instructions below. + * 1. Create the required form ./Forms directory. + * 2. Add defined case statements. + * 3. Define the Step in render function. + * + * */ getStepContent(stepIndex) { switch (stepIndex) { case 0: @@ -117,6 +160,9 @@ class Create extends Component { const {finished, stepIndex} = this.state; const contentStyle = {margin: '0 16px'}; + /** + * Defines the dialog box actions. [Yes][No] + * */ const actions = [

Create App?

-
+ @@ -182,4 +228,4 @@ class Create extends Component { } } -export default withRouter(Create); +export default withRouter(ApplicationCreate); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js index 9eb827eb70..d81c32a790 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.js @@ -15,3 +15,16 @@ * specific language governing permissions and limitations * under the License. */ + +import React, {Component} from 'react'; +import {withRouter} from 'react-router-dom'; + + +/** + * Application List Component. + * */ +class ApplicationListing extends Component{ + +} + +export default withRouter(ApplicationListing); \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/AppView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationView.js similarity index 72% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/AppView.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationView.js index 9eb827eb70..3959357f2e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/AppView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationView.js @@ -15,3 +15,16 @@ * specific language governing permissions and limitations * under the License. */ + +import React, {Component} from 'react'; +import {withRouter} from 'react-router-dom'; + +/** + * Application view component. + * Shows the details of the application. + * */ +class ApplicationView extends Component{ + +} + +export default withRouter(ApplicationView); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step1.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step1.js index ca3e050c1c..8ce132ba24 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step1.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step1.js @@ -23,6 +23,19 @@ import FlatButton from 'material-ui/FlatButton'; import SelectField from 'material-ui/SelectField'; import RaisedButton from 'material-ui/RaisedButton'; +/** + * The first step of the application creation wizard. + * This contains following components: + * * Application Title + * * Store Type + * * Application Platform + * + * Parent Component: Create + * Props: + * 1. handleNext: {type: function, Invokes handleNext function of parent component} + * 2. setData : {type: function, Sets current form data to the state of the parent component} + * 3. removeData: {type: function, Invokes the removeStepData function click of parent} + * */ class Step1 extends Component { constructor() { super(); @@ -35,34 +48,47 @@ class Step1 extends Component { }; } + /** + * Invokes the handleNext function in Create component. + * */ handleNext = () => { this.props.handleNext(); }; + /** + * Persist the current form data to the state. + * */ setStepData() { this.props.setData("step1", {step: "Dfds"}); this.handleNext.bind(this); } + /** + * Handles Next button click. + * Validates the form. + * Sets the data to the state. + * Invokes the handleNext method of Create component. + * */ handleClick() { this.setStepData(); this.handleNext(); } - handlePrev() { - this.props.handlePrev(); - } - + /** + * Triggers when changing the Platform selection. + * */ onChangePlatform = (event, index, value) => { this.setState({platform: value}); }; + /** + * Triggers when changing the Store selection. + * */ onChangeStore = (event, index, value) => { this.setState({store: value}); }; render() { - const {finished, stepIndex} = this.state; const contentStyle = {margin: '0 16px'}; return (
@@ -94,13 +120,10 @@ class Step1 extends Component {
+ +
+
- { - if (key === 3) { - alert('Why would you want to delete React?! :)'); - return; - } - this.chipData = this.state.tags; const chipToDelete = this.chipData.map((chip) => chip.key).indexOf(key); this.chipData.splice(chipToDelete, 1); this.setState({tags: this.chipData}); }; + /** + * Creates Chip array from state.tags. + * */ renderChip(data) { console.log(data); return ( @@ -143,8 +179,14 @@ class Step2 extends Component { >
+ {/*Platform Specific Properties.*/} +
+ fdfdfd +
+
+
{/*If toggle is true, the release form will be shown.*/} - {!this.state.showForm ?
:
+ {!this.state.showForm ?
:
- 404 not found + 404 not found
); } } -export default Error; \ No newline at end of file +export default Error; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Overview/PublisherOverview.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Overview/PublisherOverview.js index d4230f44d3..c9640bab15 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Overview/PublisherOverview.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Overview/PublisherOverview.js @@ -17,6 +17,13 @@ */ import React, {Component} from 'react'; +/** + * + * ***NEW*** + * The Publisher overview component. + * This component could be used to view app analytics. + * i.e number of overall downloads, ratings ect. + * */ class PublisherOverview extends Component { constructor() { @@ -24,7 +31,6 @@ class PublisherOverview extends Component { } componentWillMount() { - console.log("In Crate") } render() { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Create.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.js similarity index 67% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Create.js rename to components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.js index 9eb827eb70..0928586b5a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/Create.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Platform Create component + * */ +class PlatformCreate extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Create Platform +
+ ); + } +} + +export default PlatformCreate; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.js index 9eb827eb70..e51137e453 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Platform Listing component. + * */ +class PlatformListing extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Platform View +
+ ); + } +} + +export default PlatformListing; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformView.js index 9eb827eb70..dce6e9f716 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformView.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Platform view component. + * */ +class PlatformView extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Platform View +
+ ); + } +} + +export default PlatformView; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewListing.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewListing.js index 9eb827eb70..2575b736f7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewListing.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewListing.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Review Listing. + * */ +class ReviewListing extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Reviews List +
+ ); + } +} + +export default ReviewListing; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewView.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewView.js index 9eb827eb70..da5bdac607 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewView.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Reviews/ReviewView.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Review details view. + * */ +class ReviewView extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Review +
+ ); + } +} + +export default ReviewView; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js index 9eb827eb70..649d93f32b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.js @@ -15,3 +15,24 @@ * specific language governing permissions and limitations * under the License. */ +import React, {Component} from 'react'; + +/** + * Error page. + * */ +class DataTable extends Component { + + constructor() { + super(); + } + + render() { + return ( +
+ Data Table +
+ ); + } +} + +export default DataTable; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/SimpleForm.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/SimpleForm.js deleted file mode 100644 index 9eb827eb70..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/SimpleForm.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Login/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Login/Login.js index 67b4e31719..72255be8dd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Login/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Login/Login.js @@ -26,6 +26,15 @@ import {TextValidator, ValidatorForm} from 'react-material-ui-form-validator'; //todo: remove the {TextValidator, ValidatorForm} and implement it manually. + +/** + * The Login Component. + * + * This component contains the Login form and methods to handle field change events. + * The user name and password will be set to the state and sent to the api. + * + * If the user is already logged in, it will redirect to the last point where the user was. + * */ class Login extends Component { constructor() { super(); @@ -53,6 +62,9 @@ class Login extends Component { event.preventDefault(); } + /** + * Handles the username field change event. + * */ onUserNameChange(event) { this.setState( { @@ -61,6 +73,9 @@ class Login extends Component { ); } + /** + * Handles the password field change event. + * */ onPasswordChange(event) { this.setState( { @@ -69,12 +84,15 @@ class Login extends Component { ); } - rememberMe() { + /** + * Handles the remember me check. + * */ + handleRememberMe() { this.setState( { rememberMe: !this.state.rememberMe } - ) + ); } render() { @@ -87,13 +105,11 @@ class Login extends Component { - console.log(errors)}> -

-
); @@ -132,7 +147,6 @@ class Login extends Component { ); } - } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Logout/Logout.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/User/Logout/Logout.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/index.js index dde690556b..3ed7d23ef6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/index.js @@ -16,14 +16,15 @@ * under the License. */ -import Login from './User/Login/Login' -import BaseLayout from './Base/BaseLayout' -import Create from './Application/Create' -import NotFound from './Error/NotFound' -import PublisherOverview from './Overview/PublisherOverview' +import Login from './User/Login/Login'; +import NotFound from './Error/NotFound'; +import BaseLayout from './Base/BaseLayout'; +import PlatformCreate from './Platform/PlatformCreate'; +import PublisherOverview from './Overview/PublisherOverview'; +import ApplicationCreate from './Application/ApplicationCreate'; /** * Contains all UI components related to Application, Login and Platform */ -export {Login, BaseLayout, Create, NotFound, PublisherOverview}; \ No newline at end of file +export {Login, BaseLayout, ApplicationCreate, NotFound, PublisherOverview, PlatformCreate}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/index.js index d5ab4c3fe2..e94b572737 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/index.js @@ -16,12 +16,15 @@ * under the License. */ -import React from 'react'; -import ReactDOM from 'react-dom'; import './index.css'; +import React from 'react'; import Publisher from './App'; +import ReactDOM from 'react-dom'; import registerServiceWorker from './registerServiceWorker'; import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; +/** + * This is the base js file of the app. All the content will be rendered in the root element. + * */ ReactDOM.render(, document.getElementById('root')); registerServiceWorker(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ApplicationStore.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ApplicationStore.js index e69de29bb2..8d3763b6f0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ApplicationStore.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ApplicationStore.js @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +export class ApplicationStore {}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/PlatformStore.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/PlatformStore.js index 9eb827eb70..51babc360d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/PlatformStore.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/PlatformStore.js @@ -15,3 +15,4 @@ * specific language governing permissions and limitations * under the License. */ +export class PlatformStore{}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ReviewStore.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ReviewStore.js index 9eb827eb70..08ce7b2504 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ReviewStore.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/ReviewStore.js @@ -15,3 +15,5 @@ * specific language governing permissions and limitations * under the License. */ + +export class ReviewStore{}; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/index.js index cc77f8a78c..7416155217 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/stores/index.js @@ -14,4 +14,11 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - */ \ No newline at end of file + */ + +import ReviewStore from './ReviewStore'; +import PlatformStore from './PlatformStore'; +import ApplicationStore from './ApplicationStore'; + + +export {ApplicationStore, PlatformStore, ReviewStore}; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/webpack.config.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/webpack.config.js index c03279bd3d..c6483f4aaa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/webpack.config.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/webpack.config.js @@ -1,3 +1,20 @@ +/* + * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ var path = require('path'); const config = {