From 9ce111b724a14404cbcb278b2b7f9ee8d38da35a Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Mon, 28 Aug 2017 12:17:12 +0530 Subject: [PATCH] Fixed application listing and form formatting. --- .../src/main/resources/publisher/src/App.js | 16 ++-- .../Application/ApplicationListing.js | 77 ++++++++++--------- .../src/components/Application/Forms/Step1.js | 22 +++--- .../src/components/Application/Forms/Step2.js | 29 ++++--- .../src/components/Application/Forms/Step3.js | 12 +-- 5 files changed, 80 insertions(+), 76 deletions(-) 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 141d64f233..c1c824a616 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 @@ -17,11 +17,18 @@ */ import './App.css'; -import PropTypes from 'prop-types'; import React, {Component} from 'react'; import createHistory from 'history/createHashHistory'; import {HashRouter as Router, Redirect, Route, Switch} from 'react-router-dom' -import {BaseLayout, ApplicationCreate, ApplicationListing, Login, NotFound, PublisherOverview, PlatformCreate} from './components' +import { + ApplicationCreate, + ApplicationListing, + BaseLayout, + Login, + NotFound, + PlatformCreate, + PlatformListing +} from './components'; const history = createHistory({basename: '/publisher'}); @@ -51,9 +58,9 @@ class Base extends Component { - {/**/} + @@ -67,7 +74,6 @@ class Base extends Component { ) } - return () } } @@ -91,6 +97,4 @@ class Publisher extends Component { } } -Publisher.propTypes = {}; - export default Publisher; 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 29e51ae512..e3f4e60819 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 @@ -39,43 +39,43 @@ class ApplicationListing extends Component { } } - // data = [ - // { - // id: Math.random(), - // applicationName:"Cne", - // platform:'Android', - // category:"Public", - // status: "Created" - // }, - // { - // id: Math.random(), - // applicationName:"Gone", - // platform:'IOS', - // category:"Public", - // status: "Created" - // }, - // { - // id: Math.random(), - // applicationName:"Ane", - // platform:'Android', - // category:"Public", - // status: "Created" - // }, - // { - // id: Math.random(), - // applicationName:"one", - // platform:'Android', - // category:"Public", - // status: "Created" - // }, - // { - // id: Math.random(), - // applicationName:"one", - // platform:'Android', - // category:"Public", - // status: "Created" - // }, - // ]; + data = [ + { + id: Math.random(), + applicationName:"Cne", + platform:'Android', + category:"Public", + status: "Created" + }, + { + id: Math.random(), + applicationName:"Gone", + platform:'IOS', + category:"Public", + status: "Created" + }, + { + id: Math.random(), + applicationName:"Ane", + platform:'Android', + category:"Public", + status: "Created" + }, + { + id: Math.random(), + applicationName:"one", + platform:'Android', + category:"Public", + status: "Created" + }, + { + id: Math.random(), + applicationName:"one", + platform:'Android', + category:"Public", + status: "Created" + }, + ]; headers = [ { @@ -156,7 +156,8 @@ class ApplicationListing extends Component { + handleRowClick={this._onRowClick.bind(this)} + noDataMessage={{type: 'button', text: 'Create Application'}}/> ); 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 ff9247f324..c5964f068a 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 @@ -51,16 +51,16 @@ class Step1 extends Component { /** * Invokes the handleNext function in Create component. * */ - handleNext = () => { + _handleNext = () => { this.props.handleNext(); }; /** * Persist the current form data to the state. * */ - setStepData() { + _setStepData() { this.props.setData("step1", {step: "Dfds"}); - this.handleNext.bind(this); + this._handleNext.bind(this); } /** @@ -69,22 +69,22 @@ class Step1 extends Component { * Sets the data to the state. * Invokes the handleNext method of Create component. * */ - handleClick() { - this.setStepData(); - this.handleNext(); + _handleClick() { + this._setStepData(); + this._handleNext(); } /** * Triggers when changing the Platform selection. * */ - onChangePlatform = (event, index, value) => { + _onChangePlatform = (event, index, value) => { this.setState({platform: value}); }; /** * Triggers when changing the Store selection. * */ - onChangeStore = (event, index, value) => { + _onChangeStore = (event, index, value) => { this.setState({store: value}); }; @@ -104,7 +104,7 @@ class Step1 extends Component { floatingLabelText="Store Type*" value={this.state.store} floatingLabelFixed={true} - onChange={this.onChangeStore.bind(this)} + onChange={this._onChangeStore.bind(this)} > @@ -113,7 +113,7 @@ class Step1 extends Component { floatingLabelText="Platform*" value={this.state.platform} floatingLabelFixed={true} - onChange={this.onChangePlatform.bind(this)} + onChange={this._onChangePlatform.bind(this)} > @@ -127,7 +127,7 @@ class Step1 extends Component { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step2.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step2.js index e54bc522d8..131f267670 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step2.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step2.js @@ -73,19 +73,19 @@ class Step2 extends Component { * Clears the tags text field. * Chip gets two parameters: Key and value. * */ - addTags(event) { + _addTags(event) { let tags = this.state.tags; if (event.charCode === 13) { event.preventDefault(); tags.push({key: Math.floor(Math.random() * 1000), value: event.target.value}); - this.setState({tags, defValue: ""}, console.log(this.state.tags)); + this.setState({tags, defValue: ""}); } } /** - * + * Set the value for tag. * */ - handleTagChange(event) { + _handleTagChange(event) { let defaultValue = this.state.defValue; defaultValue = event.target.value; this.setState({defValue: defaultValue}) @@ -94,14 +94,14 @@ class Step2 extends Component { /** * Invokes the handleNext function in Create component. * */ - handleNext() { + _handleNext() { this.props.handleNext(); } /** * Invokes the handlePrev function in Create component. * */ - handlePrev() { + _handlePrev() { this.props.handlePrev(); } @@ -109,7 +109,7 @@ class Step2 extends Component { * Handles Chip delete function. * Removes the tag from state.tags * */ - handleRequestDelete = (key) => { + _handleRequestDelete = (key) => { this.chipData = this.state.tags; const chipToDelete = this.chipData.map((chip) => chip.key).indexOf(key); this.chipData.splice(chipToDelete, 1); @@ -119,12 +119,11 @@ class Step2 extends Component { /** * Creates Chip array from state.tags. * */ - renderChip(data) { - console.log(data); + _renderChip(data) { return ( this.handleRequestDelete(data.key)} + onRequestDelete={() => this._handleRequestDelete(data.key)} style={this.styles.chip} > {data.value} @@ -172,11 +171,11 @@ class Step2 extends Component { floatingLabelText="Tags*" floatingLabelFixed={true} value={this.state.defValue} - onChange={this.handleTagChange.bind(this)} - onKeyPress={this.addTags.bind(this)} + onChange={this._handleTagChange.bind(this)} + onKeyPress={this._addTags.bind(this)} />
- {this.state.tags.map(this.renderChip, this)} + {this.state.tags.map(this._renderChip, this)}

diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step3.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step3.js index 8d3d436abc..677f7e309d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step3.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Forms/Step3.js @@ -61,21 +61,21 @@ class Step3 extends Component { * Handles finish button click. * This invokes handleNext function in parent component. * */ - handleFinish() { + _handleFinish() { this.props.handleFinish(); } /** * Invokes Prev button click. * */ - handlePrev() { + _handlePrev() { this.props.handlePrev(); } /** * Handles release application selection. * */ - handleToggle() { + _handleToggle() { let hide = this.state.showForm; this.setState({showForm: !hide}); } @@ -88,7 +88,7 @@ class Step3 extends Component { {/*If toggle is true, the release form will be shown.*/} @@ -114,13 +114,13 @@ class Step3 extends Component {