From 6b944a4e9f8ccd418b16ad465a226b59a4eea2ee Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Thu, 5 Oct 2017 21:39:38 +0530 Subject: [PATCH] Added material design button styles. --- .../Application/ApplicationListing.jsx | 2 +- .../Application/Create/CreateSteps/Step1.jsx | 8 +- .../Application/Create/CreateSteps/Step2.jsx | 6 +- .../Application/Create/CreateSteps/Step3.jsx | 6 +- .../Application/Create/CreateSteps/Step4.jsx | 6 +- .../Edit/GenenralInfo/GeneralInfo.jsx | 112 ++++++++++++++++-- .../src/components/Platform/Platform.jsx | 10 +- .../components/Platform/PlatformCreate.jsx | 4 +- .../components/Platform/PlatformListing.jsx | 2 +- 9 files changed, 124 insertions(+), 32 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx index a3e5d3571c..f830c88058 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx @@ -249,7 +249,7 @@ class ApplicationListing extends Component { className="data-table-row-cell">{application.currentLifecycle.lifecycleState.name} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx index 8c1a5dce1d..ce5fc7f1e1 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step1.jsx @@ -253,7 +253,9 @@ class Step1 extends Component { {this.state.errors.name} - + - - + + ); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step2.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step2.jsx index d6d627cee0..f25c0a17c8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step2.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step2.jsx @@ -173,9 +173,9 @@ class Step2 extends Component { {this.state.errors.platform} - - - + + + ); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step3.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step3.jsx index 76384d2214..76cce9508b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step3.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step3.jsx @@ -225,9 +225,9 @@ class Step3 extends Component { - - - + + + ); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step4.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step4.jsx index 318a7116b0..9672c98986 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step4.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Create/CreateSteps/Step4.jsx @@ -147,9 +147,9 @@ class Step4 extends Component { - - - + + + ); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Edit/GenenralInfo/GeneralInfo.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Edit/GenenralInfo/GeneralInfo.jsx index 8e252a01d8..521f91ef1b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Edit/GenenralInfo/GeneralInfo.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/Edit/GenenralInfo/GeneralInfo.jsx @@ -17,16 +17,24 @@ */ import React, {Component} from 'react'; -import {Badge, Button, FormGroup, Input, Label, Row} from 'reactstrap'; +import {Button, FormGroup, Input, Label, Row} from 'reactstrap'; import Dropzone from 'react-dropzone'; import {FormattedMessage} from 'react-intl'; +import Chip from "../../../UIComponents/Chip/Chip"; class GeneralInfo extends Component { constructor() { super(); + this.onTextFieldChange = this.onTextFieldChange.bind(this); + this.addTags = this.addTags.bind(this); + this.handleRequestDelete = this.handleRequestDelete.bind(this); + this.handleTagChange = this.handleTagChange.bind(this); this.state = { defValue: "", + title: "", + description: "", + shortDescription: "", tags: [], screenshots: [], icon: [], @@ -34,6 +42,62 @@ class GeneralInfo extends Component { } } + /** + * Set text field values to state. + * */ + onTextFieldChange(event) { + let field = event.target.name; + console.log(event.target.value); + switch (field) { + case "appName": { + this.setState({name: event.target.value}); + break; + } + case "appDescription": { + this.setState({description: event.target.value}); + break; + } + case "appShortDescription": { + this.setState({shortDescription: event.target.value}); + } + } + }; + + /** + * Create a tag on Enter key press and set it to the state. + * Clears the tags text field. + * Chip gets two parameters: Key and value. + * */ + 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(tags)); + } + } + + /** + * Set the value for tag. + * */ + handleTagChange(event) { + let defaultValue = this.state.defValue; + defaultValue = event.target.value; + this.setState({defValue: defaultValue}) + } + + /** + * Handles Chip delete function. + * Removes the tag from state.tags + * */ + handleRequestDelete(key) { + let chipData = this.state.tags; + const chipToDelete = chipData.map((chip) => chip.key).indexOf(key); + chipData.splice(chipToDelete, 1); + this.setState({tags: chipData}); + }; + + //TODO: Remove Console logs. render() { return ( @@ -44,13 +108,31 @@ class GeneralInfo extends Component { - + + + + + - + - - + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx index 147677a3c1..94f4c10619 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx @@ -54,7 +54,7 @@ class PlatformListing extends Component {
-