From 14bae8def56f50d21653811d8c70f4a785894061 Mon Sep 17 00:00:00 2001 From: zmagod Date: Wed, 4 Oct 2017 14:42:38 +0200 Subject: [PATCH] trigger redirect to root page on team switch [fixes SCI-1641] --- .../Navigation/components/TeamSwitch.jsx | 14 +++++++++----- package.json | 4 ++-- yarn.lock | 6 +++--- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/app/javascript/src/components/Navigation/components/TeamSwitch.jsx b/app/javascript/src/components/Navigation/components/TeamSwitch.jsx index 1e8f4eed0..7ee9259ee 100644 --- a/app/javascript/src/components/Navigation/components/TeamSwitch.jsx +++ b/app/javascript/src/components/Navigation/components/TeamSwitch.jsx @@ -6,6 +6,7 @@ import { NavDropdown, MenuItem, Glyphicon } from "react-bootstrap"; import styled from "styled-components"; import _ from "lodash"; +import { ROOT_PATH } from "../../../config/routes"; import { BORDER_GRAY_COLOR } from "../../../config/constants/colors"; import { changeTeam } from "../../actions/TeamsActions"; import { getTeamsList } from "../../actions/TeamsActions"; @@ -27,15 +28,18 @@ class TeamSwitch extends Component { changeTeam(teamId) { this.props.changeTeam(teamId); + window.location = ROOT_PATH; } displayTeams() { if (!_.isEmpty(this.props.all_teams)) { - return this.props.all_teams.filter(team => !team.current_team).map(team => - this.changeTeam(team.id)} key={team.id}> - {team.name} - - ); + return this.props.all_teams + .filter(team => !team.current_team) + .map(team => ( + this.changeTeam(team.id)} key={team.id}> + {team.name} + + )); } } diff --git a/package.json b/package.json index 651b0ceb2..d8c878b50 100644 --- a/package.json +++ b/package.json @@ -68,8 +68,6 @@ "react-bootstrap-table": "^4.0.0", "react-bootstrap-timezone-picker": "^1.0.11", "react-data-grid": "^2.0.2", - "react-tagsinput": "^3.17.0", - "react-transition-group": "^2.2.0", "react-dom": "^15.6.1", "react-intl": "^2.3.0", "react-intl-redux": "^0.6.0", @@ -78,7 +76,9 @@ "react-router-bootstrap": "^0.24.2", "react-router-dom": "^4.1.2", "react-router-prop-types": "^0.0.1", + "react-tagsinput": "^3.17.0", "react-timezone": "^0.2.0", + "react-transition-group": "^2.2.1", "redux": "^3.7.2", "redux-thunk": "^2.2.0", "resolve-url-loader": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index 062e042d8..f01fa9d74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4829,9 +4829,9 @@ react-timezone@^0.2.0: dependencies: classnames "^2.2.1" -react-transition-group@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.2.0.tgz#793bf8cb15bfe91b3101b24bce1c1d2891659575" +react-transition-group@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.2.1.tgz#e9fb677b79e6455fd391b03823afe84849df4a10" dependencies: chain-function "^1.0.0" classnames "^2.2.5"