From: Pascal Mugnier Date: Wed, 11 Apr 2018 07:27:52 +0000 (+0200) Subject: Feature/pm/hardening 5 6 04 (#119) X-Git-Tag: 7.5~1374 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c978976137ae9e4cc7197a75ae24708e1c027d80;p=sonarqube.git Feature/pm/hardening 5 6 04 (#119) --- diff --git a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js index 4c6ae9e9b4e..082dad7f72d 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js +++ b/server/sonar-web/src/main/js/apps/component-measures/drilldown/BubbleChart.js @@ -22,6 +22,8 @@ import React from 'react'; import EmptyResult from './EmptyResult'; import OriginalBubbleChart from '../../../components/charts/BubbleChart'; import ColorRatingsLegend from '../../../components/charts/ColorRatingsLegend'; +import Tooltip from '../../../components/controls/Tooltip'; +import HelpIcon from '../../../components/icons-components/HelpIcon'; import { formatMeasure, isDiffMetric } from '../../../helpers/measures'; import { getLocalizedMetricDomain, @@ -99,6 +101,15 @@ export default class BubbleChart extends React.PureComponent { handleBubbleClick = (component /*: ComponentEnhanced */) => this.props.updateSelected(component.refKey || component.key); + getDescription(domain /*: string */) { + const description = `component_measures.overview.${domain}.description`; + const translatedDescription = translate(description); + if (description === translatedDescription) { + return null; + } + return translatedDescription; + } + renderBubbleChart( metrics /*: { x: Metric , @@ -158,7 +169,14 @@ export default class BubbleChart extends React.PureComponent { ); return (
- {title} + + {title} + + + + + + {colorsMetric && ( @@ -185,15 +203,6 @@ export default class BubbleChart extends React.PureComponent { ); } - renderChartFooter(domain /*: string */) { - const description = `component_measures.overview.${domain}.description`; - const translatedDescription = translate(description); - if (description === translatedDescription) { - return null; - } - return
{translatedDescription}
; - } - render() { if (this.props.components.length <= 0) { return ; @@ -213,7 +222,6 @@ export default class BubbleChart extends React.PureComponent {
{getLocalizedMetricName(metrics.y)}
- {this.renderChartFooter(domain)}
); } diff --git a/server/sonar-web/src/main/js/apps/projects/styles.css b/server/sonar-web/src/main/js/apps/projects/styles.css index 8b6ada0cea8..9b741654e9c 100644 --- a/server/sonar-web/src/main/js/apps/projects/styles.css +++ b/server/sonar-web/src/main/js/apps/projects/styles.css @@ -268,6 +268,11 @@ font-style: italic; } +.measure-details-bubble-chart-title { + position: absolute; + left: 20px; +} + .measure-details-bubble-chart-axis { position: absolute; color: var(--secondFontColor); @@ -276,7 +281,7 @@ .measure-details-bubble-chart-axis.x { left: 50%; - bottom: 10px; + bottom: 16px; width: 500px; margin-left: -250px; text-align: center; @@ -289,11 +294,11 @@ } .measure-details-bubble-chart-axis.size { - left: 50%; - top: 10px; - width: 500px; - margin-left: -250px; - text-align: center; + display: flex; + align-items: center; + justify-content: space-around; + top: 16px; + width: 100%; } .projects-empty-list { diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Coverage.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Coverage.tsx index 1a19f142217..344ac208b51 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Coverage.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Coverage.tsx @@ -20,9 +20,11 @@ import * as React from 'react'; import SimpleBubbleChart from './SimpleBubbleChart'; import { Project } from '../types'; +import { translate } from '../../../helpers/l10n'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -30,10 +32,11 @@ export default function Coverage(props: Props) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Duplications.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Duplications.tsx index 97430228946..666823d3447 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Duplications.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Duplications.tsx @@ -20,9 +20,11 @@ import * as React from 'react'; import SimpleBubbleChart from './SimpleBubbleChart'; import { Project } from '../types'; +import { translate } from '../../../helpers/l10n'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -30,9 +32,10 @@ export default function Duplications(props: Props) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Maintainability.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Maintainability.tsx index 73224f37723..7c61aa51c45 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Maintainability.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Maintainability.tsx @@ -20,9 +20,11 @@ import * as React from 'react'; import SimpleBubbleChart from './SimpleBubbleChart'; import { Project } from '../types'; +import { translate } from '../../../helpers/l10n'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -30,10 +32,11 @@ export default function Maintainability(props: Props) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Reliability.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Reliability.tsx index 96aa91b4df5..20e5c12bea2 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Reliability.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Reliability.tsx @@ -20,9 +20,11 @@ import * as React from 'react'; import SimpleBubbleChart from './SimpleBubbleChart'; import { Project } from '../types'; +import { translate } from '../../../helpers/l10n'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -30,10 +32,11 @@ export default function Reliability(props: Props) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Risk.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Risk.tsx index d7c004af86c..a82b86d69fd 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Risk.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Risk.tsx @@ -25,6 +25,8 @@ import { formatMeasure } from '../../../helpers/measures'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { RATING_COLORS } from '../../../helpers/constants'; import { getProjectUrl } from '../../../helpers/urls'; +import Tooltip from '../../../components/controls/Tooltip'; +import HelpIcon from '../../../components/icons-components/HelpIcon'; const X_METRIC = 'sqale_index'; const X_METRIC_TYPE = 'SHORT_WORK_DUR'; @@ -38,6 +40,7 @@ const COLOR_METRIC_TYPE = 'RATING'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -126,6 +129,7 @@ export default class Risk extends React.PureComponent { padding={[80, 20, 60, 100]} yDomain={[100, 0]} /> +
{translate('metric', X_METRIC, 'name')}
@@ -133,17 +137,27 @@ export default class Risk extends React.PureComponent { {translate('metric', Y_METRIC, 'name')}
- + + {translate('projects.visualization.risk')} + + + + + + +
+ + {translateWithParameters( + 'component_measures.legend.color_x', + translate('projects.worse_of_reliablity_and_security') + )} + {translateWithParameters( - 'component_measures.legend.color_x', - translate('projects.worse_of_reliablity_and_security') + 'component_measures.legend.size_x', + translate('metric', SIZE_METRIC, 'name') )} - - {translateWithParameters( - 'component_measures.legend.size_x', - translate('metric', SIZE_METRIC, 'name') - )} - + +
); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Security.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Security.tsx index 1972b302e56..aecb4d68b3b 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Security.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Security.tsx @@ -20,9 +20,11 @@ import * as React from 'react'; import SimpleBubbleChart from './SimpleBubbleChart'; import { Project } from '../types'; +import { translate } from '../../../helpers/l10n'; interface Props { displayOrganizations: boolean; + helpText: string; projects: Project[]; } @@ -30,10 +32,11 @@ export default function Security(props: Props) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx index 9b9d8af06aa..10c1291f61f 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/SimpleBubbleChart.tsx @@ -25,6 +25,8 @@ import { translate, translateWithParameters } from '../../../helpers/l10n'; import { RATING_COLORS } from '../../../helpers/constants'; import { getProjectUrl } from '../../../helpers/urls'; import { Project } from '../types'; +import Tooltip from '../../../components/controls/Tooltip'; +import HelpIcon from '../../../components/icons-components/HelpIcon'; export interface Metric { key: string; @@ -34,8 +36,10 @@ export interface Metric { interface Props { colorMetric?: string; displayOrganizations: boolean; + helpText: string; projects: Project[]; sizeMetric: Metric; + title?: string; xMetric: Metric; yDomain?: [number, number]; yMetric: Metric; @@ -124,19 +128,29 @@ export default class SimpleBubbleChart extends React.PureComponent { {translate('metric', yMetric.key, 'name')}
- {colorMetric != null && ( - - {translateWithParameters( - 'component_measures.legend.color_x', - translate('metric', colorMetric, 'name') - )} - - )} - {translateWithParameters( - 'component_measures.legend.size_x', - translate('metric', sizeMetric.key, 'name') - )} - {colorMetric != null && } + + {this.props.title} + + + + + + +
+ {colorMetric != null && ( + + {translateWithParameters( + 'component_measures.legend.color_x', + translate('metric', colorMetric, 'name') + )} + + )} + {translateWithParameters( + 'component_measures.legend.size_x', + translate('metric', sizeMetric.key, 'name') + )} + {colorMetric != null && } +
); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.tsx index 6c93acd4d9e..947b58fddde 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/Visualizations.tsx @@ -49,7 +49,11 @@ export default class Visualizations extends React.PureComponent { const Component = visualizationToComponent[this.props.visualization]; return Component ? ( - + ) : null; } @@ -58,20 +62,17 @@ export default class Visualizations extends React.PureComponent { const limitReached = projects != null && total != null && projects.length < total; - return ( + return limitReached ? (
-

{translate('projects.visualization', this.props.visualization, 'description')}

- {limitReached && ( -

- {translateWithParameters( - 'projects.limited_set_of_projects', - projects!.length, - localizeSorting(sort) - )} -

- )} +

+ {translateWithParameters( + 'projects.limited_set_of_projects', + projects!.length, + localizeSorting(sort) + )} +

- ); + ) : null; } render() { diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Coverage-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Coverage-test.tsx index 4138d3d9858..aa6e78c656a 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Coverage-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Coverage-test.tsx @@ -22,5 +22,7 @@ import { shallow } from 'enzyme'; import Coverage from '../Coverage'; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Duplications-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Duplications-test.tsx index b7c8ecf236e..a08e2476e04 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Duplications-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Duplications-test.tsx @@ -22,5 +22,7 @@ import { shallow } from 'enzyme'; import Duplications from '../Duplications'; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Maintainability-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Maintainability-test.tsx index 7b0bdee6e23..194ed1ff3f1 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Maintainability-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Maintainability-test.tsx @@ -22,5 +22,7 @@ import { shallow } from 'enzyme'; import Maintainability from '../Maintainability'; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Reliability-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Reliability-test.tsx index f26a17fd5dc..bdf50bd8d79 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Reliability-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Reliability-test.tsx @@ -22,5 +22,7 @@ import { shallow } from 'enzyme'; import Reliability from '../Reliability'; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx index d10e432091f..688230948db 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Risk-test.tsx @@ -29,5 +29,7 @@ it('renders', () => { tags: [], visibility: 'public' }; - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Security-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Security-test.tsx index 3ef218698e6..0101947a375 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Security-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/Security-test.tsx @@ -22,5 +22,7 @@ import { shallow } from 'enzyme'; import Security from '../Security'; it('renders', () => { - expect(shallow()).toMatchSnapshot(); + expect( + shallow() + ).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx index e76c73076f0..4224630f25d 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/SimpleBubbleChart-test.tsx @@ -35,6 +35,7 @@ it('renders', () => { - component_measures.legend.color_x.projects.worse_of_reliablity_and_security + projects.visualization.risk + + + + + - component_measures.legend.size_x.metric.ncloc.name - +
+ + component_measures.legend.color_x.projects.worse_of_reliablity_and_security + + component_measures.legend.size_x.metric.ncloc.name + +
`; diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Security-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Security-test.tsx.snap index 1ff6a7d08a7..8ab18b4f256 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Security-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Security-test.tsx.snap @@ -4,6 +4,7 @@ exports[`renders 1`] = ` - component_measures.legend.color_x.metric.security_rating.name + + + + + - component_measures.legend.size_x.metric.ncloc.name - +
+ + component_measures.legend.color_x.metric.security_rating.name + + component_measures.legend.size_x.metric.ncloc.name + +
`; diff --git a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Visualizations-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Visualizations-test.tsx.snap index 6a28f9d5baa..ecbdf1bc0e4 100644 --- a/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Visualizations-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/visualizations/__tests__/__snapshots__/Visualizations-test.tsx.snap @@ -9,16 +9,10 @@ exports[`renders 1`] = ` > -
-

- projects.visualization.coverage.description -

-
`; @@ -31,15 +25,13 @@ exports[`renders when limit is reached 1`] = ` >