From 900e9a43695cc2ca3ae829abbafa746e59e03d50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 1 Mar 2017 19:27:59 +0000 Subject: [PATCH] remove `routerPush` fixes #337 --- frontend/src/components/services/view.js | 20 ++++++++++---------- frontend/src/containers/services/index.js | 2 -- frontend/src/containers/services/list.js | 1 - 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/frontend/src/components/services/view.js b/frontend/src/components/services/view.js index a21b5534..b708f1a0 100644 --- a/frontend/src/components/services/view.js +++ b/frontend/src/components/services/view.js @@ -24,8 +24,8 @@ const ServicesView = ({ org = {}, match = {}, project = {}, - routerPush = {}, - services = [] + services = [], + router = {} }) => { const toggle = () => { if(!services) { @@ -37,11 +37,10 @@ const ServicesView = ({ const onToggleChange = (evt) => { evt.preventDefault(); - const value = evt.target.value; - const path = `/${org.id}/projects/${project.id}/services${ - value === 'list' ? '/list' : '' - }`; - routerPush(path); + + router.push(`/${org.id}/projects/${project.id}/services${ + evt.target.value === 'list' ? '/list' : '' + }`); }; return ( @@ -55,8 +54,9 @@ const ServicesView = ({ ); }; - const content = services.length ? - children : ; + const content = services.length ? children : ( + + ); return ( @@ -74,7 +74,7 @@ ServicesView.propTypes = { match: React.PropTypes.object.isRequired, org: PropTypes.org, project: PropTypes.project, - routerPush: React.PropTypes.func.isRequired, + router: React.PropTypes.object, services: React.PropTypes.arrayOf(PropTypes.service) }; diff --git a/frontend/src/containers/services/index.js b/frontend/src/containers/services/index.js index b3fe4d7f..30ccadbe 100644 --- a/frontend/src/containers/services/index.js +++ b/frontend/src/containers/services/index.js @@ -11,7 +11,6 @@ import { } from '@state/selectors'; const Services = (props) => { - const { services = [] } = props; @@ -35,7 +34,6 @@ const mapStateToProps = (state, { }) => ({ org: orgByIdSelector(match.params.org)(state), project: projectByIdSelector(match.params.projectId)(state), - routerPush: push, services: servicesForTopologySelector(match.params.projectId)(state) }); diff --git a/frontend/src/containers/services/list.js b/frontend/src/containers/services/list.js index 5bf57cac..c65e4c20 100644 --- a/frontend/src/containers/services/list.js +++ b/frontend/src/containers/services/list.js @@ -47,7 +47,6 @@ const mapStateToProps = (state, { }) => ({ org: orgByIdSelector(match.params.org)(state), project: projectByIdSelector(match.params.projectId)(state), - routerPush: push, services: servicesByProjectIdSelector(match.params.projectId)(state) });