From 3a3de0ff00773c325c6b584245187e96ae288c91 Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Mon, 17 Jun 2019 15:53:49 +0530 Subject: [PATCH] Remove redux from apps table component --- .../react-app/src/components/apps/AppCard.js | 60 ------------------- .../react-app/src/components/apps/AppList.js | 42 ------------- .../components/apps/list-apps/AppsTable.js | 9 +-- .../src/pages/dashboard/apps/Apps-old.js | 60 ------------------- 4 files changed, 1 insertion(+), 170 deletions(-) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js deleted file mode 100644 index 2d78b656970..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppCard.js +++ /dev/null @@ -1,60 +0,0 @@ -import { - Skeleton, Switch, Card, Icon, Avatar, Typography -} from 'antd'; -import React from "react"; -import config from "../../../public/conf/config.json"; -import {openReleasesModal} from "../../js/actions"; -import {connect} from "react-redux"; - -const { Meta } = Card; -const { Text } = Typography; - -const mapDispatchToProps = dispatch => ({ - openReleasesModal: (app) => dispatch(openReleasesModal(app)) -}); - -class ConnectedAppCard extends React.Component { - - constructor(props){ - super(props); - this.handleReleasesClick = this.handleReleasesClick.bind(this); - } - - handleReleasesClick(){ - this.props.openReleasesModal(this.props.app); - } - - - render() { - const defaultPlatformIcons = config.defaultPlatformIcons; - let icon = defaultPlatformIcons.default; - if(defaultPlatformIcons.hasOwnProperty(this.props.platform)){ - icon = defaultPlatformIcons[this.props.platform]; - } - let descriptionText = this.props.description; - if(descriptionText.length>50){ - descriptionText = descriptionText.substring(0,50)+"..."; - } - const description = ( -
-

{descriptionText}

- {this.props.type} - {this.props.subType} -
- ); - - return ( - , , ]}> - } - title={this.props.name} - description={description} - /> - - ); - } -} - -const AppCard = connect(null,mapDispatchToProps)(ConnectedAppCard); - -export default AppCard; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js deleted file mode 100644 index 00f715825f0..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/AppList.js +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react"; -import AppCard from "./AppCard"; -import {Col, Row} from "antd"; -import {connect} from "react-redux"; -import {getApps} from "../../js/actions"; - -// connecting state.apps with the component -const mapStateToProps= state => { - return {apps : state.apps} -}; - - -class ConnectedAppList extends React.Component { - constructor(props) { - super(props); - } - componentDidMount() { - this.props.getApps(); - } - - render() { - return ( - - {this.props.apps.map(app => ( - - - - ))} - - ); - } -} - -const AppList = connect(mapStateToProps,{getApps})(ConnectedAppList); - -export default AppList; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js index 89949eb56e9..16a6659af8a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/components/apps/list-apps/AppsTable.js @@ -7,11 +7,6 @@ import config from "../../../../public/conf/config.json"; const {Title} = Typography; -// connecting state.apps with the component -const mapStateToProps = state => { - return {apps: state.apps} -}; - const columns = [ { title: '', @@ -71,7 +66,7 @@ const columns = [ }, ]; -class ConnectedAppsTable extends React.Component { +class AppsTable extends React.Component { constructor(props) { super(props); this.state = { @@ -175,6 +170,4 @@ class ConnectedAppsTable extends React.Component { } } -const AppsTable = connect(mapStateToProps, {getApps})(ConnectedAppsTable); - export default AppsTable; \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js deleted file mode 100644 index e24f40a6eae..00000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/react-app/src/pages/dashboard/apps/Apps-old.js +++ /dev/null @@ -1,60 +0,0 @@ -import React from "react"; -import "antd/dist/antd.css"; -import {PageHeader, Typography,Input, Button, Row, Col} from "antd"; -import AppList from "../../../components/apps/AppList"; -import ReleaseModal from "../../../components/apps/ReleaseModal"; - -const Search = Input.Search; - -const routes = [ - { - path: 'index', - breadcrumbName: 'Publisher', - }, - { - path: 'first', - breadcrumbName: 'Dashboard', - }, - { - path: 'second', - breadcrumbName: 'Apps', - }, -]; - - -class Apps extends React.Component { - routes; - constructor(props) { - super(props); - this.routes = props.routes; - - } - - render() { - return ( -
- -
- - - console.log(value)} - style={{ width: 200}} - /> - - - - - -
- -
- - ); - } -} - -export default Apps;