aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-20 14:08:36 +0200
committerssjenka <ssjenka@ops-slave-centos7-1.internal.sonarsource.com>2016-07-20 14:08:36 +0200
commitdf745897a5324ab8e758c41a061c60ef1ebeafa4 (patch)
tree342838623da8c5c11c8976a6fb5636543feeab8a /server
parent8de259eee63931e09904c924e20d6caa5f6e8a87 (diff)
parentdeb971fda70db26fc00932db6cb0cfdad95d3299 (diff)
downloadsonarqube-df745897a5324ab8e758c41a061c60ef1ebeafa4.tar.gz
sonarqube-df745897a5324ab8e758c41a061c60ef1ebeafa4.zip
Automatic merge from branch-6.0
* origin/branch-6.0: do not display 0 on overview page when no profiles SONAR-7492 display rating tooltips on measures page Improve Authentication ITs SONAR-7761 Restore error in login page when not even privilege [maven-release-plugin] prepare for next development iteration [maven-release-plugin] prepare release 6.0-RC1
Diffstat (limited to 'server')
-rw-r--r--server/sonar-ce/pom.xml3
-rw-r--r--server/sonar-process/pom.xml3
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/Measure.js19
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/utils.js14
-rw-r--r--server/sonar-web/src/main/js/apps/overview/main/enhance.js29
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/Meta.js2
-rw-r--r--server/sonar-web/src/main/js/helpers/measures.js29
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb11
8 files changed, 71 insertions, 39 deletions
diff --git a/server/sonar-ce/pom.xml b/server/sonar-ce/pom.xml
index 4f698206011..1f9475d8974 100644
--- a/server/sonar-ce/pom.xml
+++ b/server/sonar-ce/pom.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonarsource.sonarqube</groupId>
diff --git a/server/sonar-process/pom.xml b/server/sonar-process/pom.xml
index 6856c68f396..a7b919bc341 100644
--- a/server/sonar-process/pom.xml
+++ b/server/sonar-process/pom.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonarsource.sonarqube</groupId>
diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/Measure.js b/server/sonar-web/src/main/js/apps/component-measures/components/Measure.js
index a83267a0242..d8e8253130a 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/components/Measure.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/components/Measure.js
@@ -18,17 +18,30 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import React from 'react';
-
import Rating from '../../../components/ui/Rating';
import Level from '../../../components/ui/Level';
import { formatMeasure } from '../../../helpers/measures';
-import { formatLeak, isDiffMetric } from '../utils';
+import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin';
+import { formatLeak, isDiffMetric, getRatingTooltip } from '../utils';
const Measure = ({ measure, metric }) => {
const finalMetric = metric || measure.metric;
if (finalMetric.type === 'RATING') {
- return <Rating value={measure.value}/>;
+ const tooltip = getRatingTooltip(finalMetric.key, measure.value);
+ const rating = <Rating value={measure.value}/>;
+ if (tooltip) {
+ return (
+ <TooltipsContainer>
+ <span>
+ <span title={tooltip} data-toggle="tooltip">
+ {rating}
+ </span>
+ </span>
+ </TooltipsContainer>
+ );
+ }
+ return rating;
}
if (finalMetric.type === 'LEVEL') {
diff --git a/server/sonar-web/src/main/js/apps/component-measures/utils.js b/server/sonar-web/src/main/js/apps/component-measures/utils.js
index c7bd18ca7e3..076053498ab 100644
--- a/server/sonar-web/src/main/js/apps/component-measures/utils.js
+++ b/server/sonar-web/src/main/js/apps/component-measures/utils.js
@@ -18,7 +18,11 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
import bubbles from './config/bubbles';
-import { formatMeasure, formatMeasureVariation } from '../../helpers/measures';
+import {
+ formatMeasure,
+ formatMeasureVariation,
+ getRatingTooltip as nextGetRatingTooltip
+} from '../../helpers/measures';
export function isDiffMetric (metric) {
return metric.key.indexOf('new_') === 0;
@@ -113,3 +117,11 @@ export function hasTreemap (metric) {
export function filterOutEmptyMeasures (components) {
return components.filter(component => component.value !== null || component.leak !== null);
}
+
+export function getRatingTooltip (metricKey, value) {
+ const KNOWN_RATINGS = ['sqale_rating', 'reliability_rating', 'security_rating'];
+ if (KNOWN_RATINGS.includes(metricKey)) {
+ return nextGetRatingTooltip(metricKey, value);
+ }
+ return null;
+}
diff --git a/server/sonar-web/src/main/js/apps/overview/main/enhance.js b/server/sonar-web/src/main/js/apps/overview/main/enhance.js
index 91f3b8a37b4..26e57e1afa7 100644
--- a/server/sonar-web/src/main/js/apps/overview/main/enhance.js
+++ b/server/sonar-web/src/main/js/apps/overview/main/enhance.js
@@ -34,7 +34,7 @@ import {
import { translateWithParameters, translate } from '../../../helpers/l10n';
import { getPeriodDate } from '../../../helpers/periods';
import { getComponentIssuesUrl } from '../../../helpers/urls';
-import { getMaintainabilityRatingGrid } from '../../../helpers/measures';
+import { getRatingTooltip } from '../../../helpers/measures';
export default function enhance (ComposedComponent) {
return class extends React.Component {
@@ -132,27 +132,6 @@ export default function enhance (ComposedComponent) {
);
}
- getMaintainabilityRatingTooltip (rating) {
- const maintainabilityGrid = getMaintainabilityRatingGrid();
- const maintainabilityRatingThreshold =
- maintainabilityGrid[Math.floor(rating) - 2];
-
- console.log(maintainabilityGrid[0]);
-
- if (rating < 2) {
- return translateWithParameters(
- 'metric.sqale_rating.tooltip.A',
- `${maintainabilityGrid[0]}%`);
- }
-
- const ratingLetter = formatMeasure(rating, 'RATING');
-
- return translateWithParameters(
- 'metric.sqale_rating.tooltip',
- ratingLetter,
- `${maintainabilityRatingThreshold}%`);
- }
-
renderRating (metricKey) {
const { component, measures } = this.props;
const measure = measures.find(measure => measure.metric.key === metricKey);
@@ -161,11 +140,7 @@ export default function enhance (ComposedComponent) {
return null;
}
- const ratingLetter = formatMeasure(measure.value, 'RATING');
-
- const title = metricKey === 'sqale_rating' ?
- this.getMaintainabilityRatingTooltip(measure.value) :
- translate('metric', metricKey, 'tooltip', ratingLetter);
+ const title = getRatingTooltip(metricKey, measure.value);
return (
<div className="overview-domain-measure-sup"
diff --git a/server/sonar-web/src/main/js/apps/overview/meta/Meta.js b/server/sonar-web/src/main/js/apps/overview/meta/Meta.js
index 70d5a4d6be0..34fd17dc77a 100644
--- a/server/sonar-web/src/main/js/apps/overview/meta/Meta.js
+++ b/server/sonar-web/src/main/js/apps/overview/meta/Meta.js
@@ -34,7 +34,7 @@ const Meta = ({ component }) => {
const hasDescription = !!description;
const hasLinks = Array.isArray(links) && !!links.length;
- const hasQualityProfiles = Array.isArray(profiles) && profiles.length;
+ const hasQualityProfiles = Array.isArray(profiles) && profiles.length > 0;
const hasQualityGate = !!gate;
const shouldShowQualityProfiles = !isView && !isDeveloper && hasQualityProfiles;
diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js
index a3e181e04cb..064c7733cf8 100644
--- a/server/sonar-web/src/main/js/helpers/measures.js
+++ b/server/sonar-web/src/main/js/helpers/measures.js
@@ -370,7 +370,7 @@ function shortDurationVariationFormatter (value) {
let maintainabilityRatingGrid;
-export function getMaintainabilityRatingGrid () {
+function getMaintainabilityRatingGrid () {
if (maintainabilityRatingGrid) {
return maintainabilityRatingGrid;
}
@@ -388,3 +388,30 @@ export function getMaintainabilityRatingGrid () {
return maintainabilityRatingGrid;
}
+
+function getMaintainabilityRatingTooltip (rating) {
+ const maintainabilityGrid = getMaintainabilityRatingGrid();
+ const maintainabilityRatingThreshold =
+ maintainabilityGrid[Math.floor(rating) - 2];
+
+ if (rating < 2) {
+ return translateWithParameters(
+ 'metric.sqale_rating.tooltip.A',
+ `${maintainabilityGrid[0]}%`);
+ }
+
+ const ratingLetter = formatMeasure(rating, 'RATING');
+
+ return translateWithParameters(
+ 'metric.sqale_rating.tooltip',
+ ratingLetter,
+ `${maintainabilityRatingThreshold}%`);
+}
+
+export function getRatingTooltip (metricKey, value) {
+ const ratingLetter = formatMeasure(value, 'RATING');
+
+ return metricKey === 'sqale_rating' ?
+ getMaintainabilityRatingTooltip(value) :
+ translate('metric', metricKey, 'tooltip', ratingLetter);
+}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
index 4495fffa997..3cb6a3187e0 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/sessions/_form.html.erb
@@ -22,7 +22,13 @@
<form id="login_form" action="<%= ApplicationController.root_context -%>/api/authentication/login" method="post">
<input type="hidden" name="return_to_anchor" value="<%= h @return_to_anchor %>">
- <div class="alert alert-danger hidden"><%= message('session.flash_notice.authentication_failed') %></div>
+ <div class="alert alert-danger alert-authentication-failed hidden"><%= message('session.flash_notice.authentication_failed') %></div>
+ <% if flash[:loginerror] %>
+ <div class="alert alert-danger alert-flash"> <%= flash[:loginerror] %></div>
+ <% end %>
+ <% if flash[:notice] %>
+ <div class="alert alert-info alert-flash"><%= flash[:notice] %></div>
+ <% end %>
<div class="big-spacer-bottom">
<label for="login" class="login-label"><%= message('login') %></label>
@@ -62,7 +68,8 @@
window.location = '<%= h(@return_to) -%>' + $('[name="return_to_anchor"]').val();
},
error: function () {
- $('.alert').removeClass('hidden');
+ $('.alert-flash').addClass('hidden');
+ $('.alert-authentication-failed').removeClass('hidden');
$('button').prop('disabled', false);
},
statusCode: {