aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-07-24 14:13:34 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-07-25 09:20:30 +0200
commit935ecc809124f311ecb17ee42ae82896b5028293 (patch)
tree78647833062d2086c2296a968c9e491898e0869c /server
parent10a850b95d08ecb8efe911cd23570fef3ab5733e (diff)
downloadsonarqube-935ecc809124f311ecb17ee42ae82896b5028293.tar.gz
sonarqube-935ecc809124f311ecb17ee42ae82896b5028293.zip
SONAR-9565 Display quality gate directly if there is only one and the user can't edit
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js
index 3ac0da688cc..e197e6f0f83 100644
--- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js
+++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatesApp.js
@@ -41,11 +41,17 @@ export default class QualityGatesApp extends Component {
}
fetchQualityGates() {
- Promise.all([fetchQualityGatesAppDetails(), fetchQualityGatesAPI()]).then(responses => {
- const [details, qualityGates] = responses;
- const { updateStore } = this.props;
-
+ Promise.all([
+ fetchQualityGatesAppDetails(),
+ fetchQualityGatesAPI()
+ ]).then(([details, qualityGates]) => {
+ const { organization, updateStore } = this.props;
updateStore({ ...details, qualityGates });
+ if (qualityGates && qualityGates.length === 1 && !details.edit) {
+ this.context.router.replace(
+ getQualityGateUrl(qualityGates[0].id, organization && organization.key)
+ );
+ }
});
}
@@ -62,7 +68,7 @@ export default class QualityGatesApp extends Component {
const defaultTitle = translate('quality_gates.page');
const top = organization ? 95 : 30;
return (
- <div className="layout-page">
+ <div id="quality-gates-page" className="layout-page">
<Helmet defaultTitle={defaultTitle} titleTemplate={'%s - ' + defaultTitle} />
<div className="layout-page-side-outer">