aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-09-01 11:37:52 +0200
committerJanos Gyerik <janos.gyerik@sonarsource.com>2017-09-12 11:34:56 +0200
commit0b19295ac587b4d7b62495df5d1591a4741b27da (patch)
treef3db42bed104e66f654ba8a8c37afe75e2fb4c60 /server/sonar-web
parent7e4aac6e3e592e0909bbdfd7a93716778dc67fad (diff)
downloadsonarqube-0b19295ac587b4d7b62495df5d1591a4741b27da.tar.gz
sonarqube-0b19295ac587b4d7b62495df5d1591a4741b27da.zip
fix redirection on activity page
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js
index 2abe61ee16d..acec2a25fa1 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.js
@@ -73,7 +73,7 @@ export default class ProjectActivityAppContainer extends React.PureComponent {
/*:: state: State; */
static contextTypes = {
- router: PropTypes.object
+ router: PropTypes.object.isRequired
};
constructor(props /*: Props */) {
@@ -87,27 +87,25 @@ export default class ProjectActivityAppContainer extends React.PureComponent {
metrics: [],
query: parseQuery(props.location.query)
};
+ }
+ componentDidMount() {
+ this.mounted = true;
+ const elem = document.querySelector('html');
+ elem && elem.classList.add('dashboard-page');
if (this.shouldRedirect()) {
const newQuery = { ...this.state.query, graph: getGraph() };
if (isCustomGraph(newQuery.graph)) {
newQuery.customMetrics = getCustomGraph();
}
this.context.router.replace({
- pathname: props.location.pathname,
+ pathname: this.props.location.pathname,
query: {
...serializeUrlQuery(newQuery),
- branch: props.branch && getBranchName(props.branch)
+ branch: this.props.branch && getBranchName(this.props.branch)
}
});
- }
- }
-
- componentDidMount() {
- this.mounted = true;
- const elem = document.querySelector('html');
- elem && elem.classList.add('dashboard-page');
- if (!this.shouldRedirect()) {
+ } else {
this.firstLoadData(this.state.query);
}
}
@@ -317,6 +315,10 @@ export default class ProjectActivityAppContainer extends React.PureComponent {
};
render() {
+ if (this.shouldRedirect()) {
+ return null;
+ }
+
return (
<ProjectActivityApp
addCustomEvent={this.addCustomEvent}