From fcd747a0cbaf7e76c71e840ae207e7b0355a6a68 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Mon, 24 Jul 2017 09:13:46 +0200 Subject: [PATCH] Fix merge conflict with branch-6.5 --- .../overview/components/LeakPeriodLegend.js | 2 +- .../apps/overview/components/OverviewApp.js | 15 ++-- .../js/apps/overview/events/AnalysesList.js | 2 +- .../main/js/apps/overview/events/Analysis.js | 31 ++++----- .../src/main/js/apps/overview/events/Event.js | 16 ++--- .../js/apps/overview/events/PreviewGraph.js | 4 +- .../__tests__/PreviewGraphTooltips-test.js | 4 +- .../__snapshots__/Analysis-test.js.snap | 68 +++++++++---------- .../__snapshots__/Event-test.js.snap | 30 ++++---- .../main/js/apps/overview/main/CodeSmells.js | 11 +-- .../src/main/js/apps/overview/main/enhance.js | 24 ++++--- .../src/main/js/apps/overview/meta/Meta.js | 4 +- .../apps/overview/meta/MetaQualityProfiles.js | 34 ++++------ .../__snapshots__/utils-test.js.snap | 10 +-- .../projectActivity/__tests__/utils-test.js | 4 +- .../components/ProjectActivityAppContainer.js | 7 +- .../ProjectActivityAnalysesList-test.js | 3 +- .../__tests__/ProjectActivityApp-test.js | 3 +- .../src/main/js/apps/projects-admin/search.js | 4 +- .../views/BulkApplyTemplateView.js | 4 +- .../sonar-web/src/main/js/helpers/storage.js | 6 +- .../resources/org/sonar/l10n/core.properties | 2 +- .../pageobjects/ProjectsManagementPage.java | 12 ++++ .../ProjectAdministrationTest.java | 30 ++++++-- 24 files changed, 182 insertions(+), 148 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js index dc2af1733aa..6d3f53657ef 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js +++ b/server/sonar-web/src/main/js/apps/overview/components/LeakPeriodLegend.js @@ -81,7 +81,7 @@ export default function LeakPeriodLegend({ period }: { period: Period }) { : translateWithParameters('overview.started_on_x', momentDate.format('LL')); return ( - +
{translateWithParameters('overview.leak_period_x', leakPeriodLabel)}
diff --git a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js index bbde489216a..79ab68e793c 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js +++ b/server/sonar-web/src/main/js/apps/overview/components/OverviewApp.js @@ -32,7 +32,6 @@ import { getMeasuresAndMeta } from '../../../api/measures'; import { getAllTimeMachineData } from '../../../api/time-machine'; import { enhanceMeasuresWithMetrics } from '../../../helpers/measures'; import { getLeakPeriod } from '../../../helpers/periods'; -import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; import { getCustomGraph, getGraph } from '../../../helpers/storage'; import { METRICS, HISTORY_METRICS_LIST } from '../utils'; import { DEFAULT_GRAPH, getDisplayedHistoryMetrics } from '../../projectActivity/utils'; @@ -148,14 +147,12 @@ export default class OverviewApp extends React.PureComponent {
- -
- - - - -
-
+
+ + + + +
diff --git a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js index cf8aa197c0a..c1b78936fce 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js +++ b/server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js @@ -40,7 +40,7 @@ type State = { metrics: Array }; -const PAGE_SIZE = 5; +const PAGE_SIZE = 3; export default class AnalysesList extends React.PureComponent { mounted: boolean; diff --git a/server/sonar-web/src/main/js/apps/overview/events/Analysis.js b/server/sonar-web/src/main/js/apps/overview/events/Analysis.js index 916341a2000..ba7fc7715d1 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/Analysis.js +++ b/server/sonar-web/src/main/js/apps/overview/events/Analysis.js @@ -22,7 +22,6 @@ import React from 'react'; import { sortBy } from 'lodash'; import Event from './Event'; import FormattedDate from '../../../components/ui/FormattedDate'; -import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; import { translate } from '../../../helpers/l10n'; import type { Analysis as AnalysisType, Event as EventType } from '../../projectActivity/types'; @@ -37,22 +36,20 @@ export default function Analysis(props: { analysis: AnalysisType }) { ); return ( - -
  • -
    - - - -
    +
  • +
    + + + +
    - {sortedEvents.length > 0 - ?
    - {sortedEvents.map(event => )} -
    - : - {translate('project_activity.project_analyzed')} - } -
  • -
    + {sortedEvents.length > 0 + ?
    + {sortedEvents.map(event => )} +
    + : + {translate('project_activity.project_analyzed')} + } + ); } diff --git a/server/sonar-web/src/main/js/apps/overview/events/Event.js b/server/sonar-web/src/main/js/apps/overview/events/Event.js index bb79518b167..13dd7b0d23f 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/Event.js +++ b/server/sonar-web/src/main/js/apps/overview/events/Event.js @@ -19,7 +19,7 @@ */ // @flow import React from 'react'; -import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; +import Tooltip from '../../../components/controls/Tooltip'; import type { Event as EventType } from '../../projectActivity/types'; import { translate } from '../../../helpers/l10n'; @@ -36,14 +36,12 @@ export default function Event(props: { event: EventType }) { return (
    - - - {translate('event.category', event.category)}:{' '} - - {event.name} - - - + {translate('event.category', event.category)}:{' '} + + + {event.name} + +
    ); } diff --git a/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js b/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js index 2f84509a196..20538c6a4d1 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js +++ b/server/sonar-web/src/main/js/apps/overview/events/PreviewGraph.js @@ -21,6 +21,8 @@ import React from 'react'; import { minBy } from 'lodash'; import { AutoSizer } from 'react-virtualized'; +import AdvancedTimeline from '../../../components/charts/AdvancedTimeline'; +import PreviewGraphTooltips from './PreviewGraphTooltips'; import { DEFAULT_GRAPH, getDisplayedHistoryMetrics, @@ -29,8 +31,6 @@ import { splitSeriesInGraphs } from '../../projectActivity/utils'; import { getCustomGraph, getGraph } from '../../../helpers/storage'; -import AdvancedTimeline from '../../../components/charts/AdvancedTimeline'; -import PreviewGraphTooltips from './PreviewGraphTooltips'; import { formatMeasure, getShortType } from '../../../helpers/measures'; import type { Serie } from '../../../components/charts/AdvancedTimeline'; import type { History, Metric } from '../types'; diff --git a/server/sonar-web/src/main/js/apps/overview/events/__tests__/PreviewGraphTooltips-test.js b/server/sonar-web/src/main/js/apps/overview/events/__tests__/PreviewGraphTooltips-test.js index a26d4d7daf2..2953cb69037 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/__tests__/PreviewGraphTooltips-test.js +++ b/server/sonar-web/src/main/js/apps/overview/events/__tests__/PreviewGraphTooltips-test.js @@ -22,7 +22,7 @@ import { shallow } from 'enzyme'; import PreviewGraphTooltips from '../PreviewGraphTooltips'; import { DEFAULT_GRAPH } from '../../../projectActivity/utils'; -const SERIES_OVERVIEW = [ +const SERIES_ISSUES = [ { name: 'code_smells', data: [ @@ -79,7 +79,7 @@ const DEFAULT_PROPS = { graphWidth: 150, metrics: METRICS, selectedDate: new Date('2011-10-01T22:01:00.000Z'), - series: SERIES_OVERVIEW, + series: SERIES_ISSUES, tooltipIdx: 0, tooltipPos: 25 }; diff --git a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap index d7a40d0bf71..e37d21f47d9 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Analysis-test.js.snap @@ -1,42 +1,40 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`should sort the events with version first 1`] = ` - -
  • +
    -
    - - - -
    -
    - + - +
    +
    + -
    -
  • -
    + } + /> + +
    + `; diff --git a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Event-test.js.snap b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Event-test.js.snap index b04b1393fc8..6ff6f67c30d 100644 --- a/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Event-test.js.snap +++ b/server/sonar-web/src/main/js/apps/overview/events/__tests__/__snapshots__/Event-test.js.snap @@ -12,21 +12,19 @@ exports[`should render an event correctly 1`] = `
    - - - - event.category.OTHER - : - - - - test - - - + + event.category.OTHER + : + + + + + test + +
    `; diff --git a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js index 07bd2ae83ec..2c5a5e9289c 100644 --- a/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js +++ b/server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js @@ -20,6 +20,7 @@ import moment from 'moment'; import React from 'react'; import { Link } from 'react-router'; +import Tooltip from '../../../components/controls/Tooltip'; import enhance from './enhance'; import { getMetricName } from '../helpers/metrics'; import { translate, translateWithParameters } from '../../../helpers/l10n'; @@ -46,11 +47,11 @@ class CodeSmells extends React.PureComponent { const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate); return ( - - + + {formatMeasure(value, 'SHORT_WORK_DUR')} - - + + ); } @@ -122,7 +123,7 @@ class CodeSmells extends React.PureComponent {
    {getMetricName('effort')} - {this.props.renderHistoryLink('sqale_rating')} + {this.props.renderHistoryLink('sqale_index')}
    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 a884d22332a..7c465b46c27 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 @@ -24,6 +24,7 @@ import { DrilldownLink } from '../../../components/shared/drilldown-link'; import HistoryIcon from '../../../components/icons-components/HistoryIcon'; import Rating from './../../../components/ui/Rating'; import Timeline from '../components/Timeline'; +import Tooltip from '../../../components/controls/Tooltip'; import { formatMeasure, formatMeasureVariation, @@ -126,11 +127,16 @@ export default function enhance(ComposedComponent) { const value = this.getValue(measure); const title = getRatingTooltip(metricKey, value); return ( -
    - - - -
    + +
    + + + +
    +
    ); }; renderIssues = (metric, type) => { @@ -147,11 +153,11 @@ export default function enhance(ComposedComponent) { const formattedAnalysisDate = moment(component.analysisDate).format('LLL'); const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate); return ( - - + + {formatMeasure(value, 'SHORT_INT')} - - + +
    ); }; renderHistoryLink = metricKey => { 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 db9b0cb523c..1a57590524f 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 @@ -56,6 +56,8 @@ const Meta = ({ component, history, measures, areThereCustomOrganizations, route {isProject && } + {isProject && } + {shouldShowQualityGate && } {shouldShowQualityProfiles && @@ -70,8 +72,6 @@ const Meta = ({ component, history, measures, areThereCustomOrganizations, route {shouldShowOrganizationKey && } - - {isProject && } ); }; diff --git a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js index a6e95459670..d5762751007 100644 --- a/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js +++ b/server/sonar-web/src/main/js/apps/overview/meta/MetaQualityProfiles.js @@ -21,7 +21,7 @@ import React from 'react'; import { connect } from 'react-redux'; import { Link } from 'react-router'; -import { TooltipsContainer } from '../../../components/mixins/tooltips-mixin'; +import Tooltip from '../../../components/controls/Tooltip'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { getQualityProfileUrl } from '../../../helpers/urls'; import { searchRules } from '../../../api/rules'; @@ -105,13 +105,11 @@ class MetaQualityProfiles extends React.PureComponent { if (count > 0) { const tooltip = translateWithParameters('overview.deprecated_profile', count); return ( -
  • - {inner} -
  • + +
  • + {inner} +
  • +
    ); } @@ -126,17 +124,15 @@ class MetaQualityProfiles extends React.PureComponent { const { profiles } = this.props; return ( - -
    -

    - {translate('overview.quality_profiles')} -

    - -
      - {profiles.map(profile => this.renderProfile(profile))} -
    -
    -
    +
    +

    + {translate('overview.quality_profiles')} +

    + +
      + {profiles.map(profile => this.renderProfile(profile))} +
    +
    ); } } diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap index 356f168475d..b93c34bc6eb 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap +++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/__snapshots__/utils-test.js.snap @@ -69,7 +69,7 @@ Array [ Object { "category": "QUALITY_PROFILE", "key": "AVwQF7zXl-nNFgFWOJ3W", - "name": "Changes in 'Default - SonarSource conventions' (Java)", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], "key": "AVwQF7kwl-nNFgFWOJ3V", @@ -82,7 +82,7 @@ Array [ Object { "category": "QUALITY_PROFILE", "key": "AVxZtC-N7841nF4RNEMJ", - "name": "Changes in 'Default - SonarSource conventions' (Java)", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], "key": "AVxZtCpH7841nF4RNEMI", @@ -130,7 +130,7 @@ Array [ Object { "category": "QUALITY_PROFILE", "key": "AVxZtC-N7841nF4RNEMJ", - "name": "Changes in 'Default - SonarSource conventions' (Java)", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], "key": "AVxZtCpH7841nF4RNEMI", @@ -195,7 +195,7 @@ Array [ Object { "category": "QUALITY_PROFILE", "key": "AVwQF7zXl-nNFgFWOJ3W", - "name": "Changes in 'Default - SonarSource conventions' (Java)", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], "key": "AVwQF7kwl-nNFgFWOJ3V", @@ -208,7 +208,7 @@ Array [ Object { "category": "QUALITY_PROFILE", "key": "AVxZtC-N7841nF4RNEMJ", - "name": "Changes in 'Default - SonarSource conventions' (Java)", + "name": "Changes in \\"Default - SonarSource conventions\\" (Java)", }, ], "key": "AVxZtCpH7841nF4RNEMI", diff --git a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js index 54cae93e0ee..77fde465386 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/__tests__/utils-test.js @@ -35,7 +35,7 @@ const ANALYSES = [ { key: 'AVxZtC-N7841nF4RNEMJ', category: 'QUALITY_PROFILE', - name: "Changes in 'Default - SonarSource conventions' (Java)" + name: 'Changes in "Default - SonarSource conventions" (Java)' } ] }, @@ -48,7 +48,7 @@ const ANALYSES = [ { key: 'AVwQF7zXl-nNFgFWOJ3W', category: 'QUALITY_PROFILE', - name: "Changes in 'Default - SonarSource conventions' (Java)" + name: 'Changes in "Default - SonarSource conventions" (Java)' } ] }, 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 837e2fd91ff..1f9a5f2ab91 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 @@ -270,9 +270,12 @@ class ProjectActivityAppContainer extends React.PureComponent { key => key !== 'id' && locationQuery[key] !== '' ); - // if there is no filter, but there are saved preferences in the localStorage const graph = getGraph(); - return !filtered && graph != null && graph !== DEFAULT_GRAPH; + const emptyCustomGraph = isCustomGraph(graph) && getCustomGraph().length <= 0; + + // if there is no filter, but there are saved preferences in the localStorage + // also don't redirect to custom if there is no metrics selected for it + return !filtered && graph != null && graph !== DEFAULT_GRAPH && !emptyCustomGraph; } }; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.js b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.js index 7a6660d6a96..147fdeca7d6 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAnalysesList-test.js @@ -20,6 +20,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import ProjectActivityAnalysesList from '../ProjectActivityAnalysesList'; +import { DEFAULT_GRAPH } from '../../utils'; const ANALYSES = [ { @@ -77,7 +78,7 @@ const DEFAULT_PROPS = { deleteAnalysis: () => {}, deleteEvent: () => {}, loading: false, - query: { category: '', graph: 'issues', project: 'org.sonarsource.sonarqube:sonarqube' }, + query: { category: '', graph: DEFAULT_GRAPH, project: 'org.sonarsource.sonarqube:sonarqube' }, updateQuery: () => {} }; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.js b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.js index d5c40161288..6f3655c42ec 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.js +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityApp-test.js @@ -20,6 +20,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import ProjectActivityApp from '../ProjectActivityApp'; +import { DEFAULT_GRAPH } from '../../utils'; const ANALYSES = [ { @@ -80,7 +81,7 @@ const DEFAULT_PROPS = { ] } ], - query: { category: '', graph: 'issues', project: 'org.sonarsource.sonarqube:sonarqube' }, + query: { category: '', graph: DEFAULT_GRAPH, project: 'org.sonarsource.sonarqube:sonarqube' }, updateQuery: () => {} }; diff --git a/server/sonar-web/src/main/js/apps/projects-admin/search.js b/server/sonar-web/src/main/js/apps/projects-admin/search.js index 15340c64104..ee8d522e2ad 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/search.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/search.js @@ -156,7 +156,9 @@ export default class Search extends React.PureComponent { -