diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-24 09:13:46 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-07-24 09:13:46 +0200 |
commit | fcd747a0cbaf7e76c71e840ae207e7b0355a6a68 (patch) | |
tree | 99f6ea7243a6b018ac2b5b2558ee9253004f0430 /server/sonar-web/src | |
parent | 544c4c57a45afbea604cf0cf02eeb268f59565e6 (diff) | |
download | sonarqube-fcd747a0cbaf7e76c71e840ae207e7b0355a6a68.tar.gz sonarqube-fcd747a0cbaf7e76c71e840ae207e7b0355a6a68.zip |
Fix merge conflict with branch-6.5
Diffstat (limited to 'server/sonar-web/src')
21 files changed, 143 insertions, 143 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 ( - <Tooltip overlay={tooltip} placement="bottom"> + <Tooltip overlay={tooltip} placement="top"> <div className="overview-legend"> {translateWithParameters('overview.leak_period_x', leakPeriodLabel)} <br /> 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 { <div className="overview-main page-main"> <QualityGate component={component} measures={measures} /> - <TooltipsContainer> - <div className="overview-domains-list"> - <BugsAndVulnerabilities {...domainProps} /> - <CodeSmells {...domainProps} /> - <Coverage {...domainProps} /> - <Duplications {...domainProps} /> - </div> - </TooltipsContainer> + <div className="overview-domains-list"> + <BugsAndVulnerabilities {...domainProps} /> + <CodeSmells {...domainProps} /> + <Coverage {...domainProps} /> + <Duplications {...domainProps} /> + </div> </div> <div className="page-sidebar-fixed"> 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<Metric> }; -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 ( - <TooltipsContainer> - <li className="overview-analysis"> - <div className="small little-spacer-bottom"> - <strong> - <FormattedDate date={analysis.date} format="LL" /> - </strong> - </div> + <li className="overview-analysis"> + <div className="small little-spacer-bottom"> + <strong> + <FormattedDate date={analysis.date} format="LL" /> + </strong> + </div> - {sortedEvents.length > 0 - ? <div className="project-activity-events"> - {sortedEvents.map(event => <Event event={event} key={event.key} />)} - </div> - : <span className="note"> - {translate('project_activity.project_analyzed')} - </span>} - </li> - </TooltipsContainer> + {sortedEvents.length > 0 + ? <div className="project-activity-events"> + {sortedEvents.map(event => <Event event={event} key={event.key} />)} + </div> + : <span className="note"> + {translate('project_activity.project_analyzed')} + </span>} + </li> ); } 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 ( <div className="overview-analysis-event"> - <TooltipsContainer> - <span> - <span className="note">{translate('event.category', event.category)}:</span>{' '} - <strong title={event.description} data-toggle="tooltip"> - {event.name} - </strong> - </span> - </TooltipsContainer> + <span className="note">{translate('event.category', event.category)}:</span>{' '} + <Tooltip overlay={event.description}> + <strong> + {event.name} + </strong> + </Tooltip> </div> ); } 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`] = ` -<TooltipsContainer> - <li - className="overview-analysis" +<li + className="overview-analysis" +> + <div + className="small little-spacer-bottom" > - <div - className="small little-spacer-bottom" - > - <strong> - <FormattedDate - date="2017-06-10T16:10:59+0200" - format="LL" - /> - </strong> - </div> - <div - className="project-activity-events" - > - <Event - event={ - Object { - "category": "VERSION", - "key": "2", - "name": "6.5-SNAPSHOT", - } - } + <strong> + <FormattedDate + date="2017-06-10T16:10:59+0200" + format="LL" /> - <Event - event={ - Object { - "category": "OTHER", - "key": "1", - "name": "test", - } + </strong> + </div> + <div + className="project-activity-events" + > + <Event + event={ + Object { + "category": "VERSION", + "key": "2", + "name": "6.5-SNAPSHOT", } - /> - </div> - </li> -</TooltipsContainer> + } + /> + <Event + event={ + Object { + "category": "OTHER", + "key": "1", + "name": "test", + } + } + /> + </div> +</li> `; 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`] = ` <div className="overview-analysis-event" > - <TooltipsContainer> - <span> - <span - className="note" - > - event.category.OTHER - : - </span> - - <strong - data-toggle="tooltip" - > - test - </strong> - </span> - </TooltipsContainer> + <span + className="note" + > + event.category.OTHER + : + </span> + + <Tooltip + placement="bottom" + > + <strong> + test + </strong> + </Tooltip> </div> `; 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 ( - <Link to={getComponentIssuesUrl(component.key, params)}> - <span title={tooltip} data-toggle="tooltip"> + <Tooltip overlay={tooltip} placement="top"> + <Link to={getComponentIssuesUrl(component.key, params)}> {formatMeasure(value, 'SHORT_WORK_DUR')} - </span> - </Link> + </Link> + </Tooltip> ); } @@ -122,7 +123,7 @@ class CodeSmells extends React.PureComponent { </div> <div className="overview-domain-measure-label"> {getMetricName('effort')} - {this.props.renderHistoryLink('sqale_rating')} + {this.props.renderHistoryLink('sqale_index')} </div> </div> </div> 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 ( - <div className="overview-domain-measure-sup" title={title} data-toggle="tooltip"> - <DrilldownLink className="link-no-underline" component={component.key} metric={metricKey}> - <Rating value={value} /> - </DrilldownLink> - </div> + <Tooltip overlay={title} placement="top"> + <div className="overview-domain-measure-sup"> + <DrilldownLink + className="link-no-underline" + component={component.key} + metric={metricKey}> + <Rating value={value} /> + </DrilldownLink> + </div> + </Tooltip> ); }; 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 ( - <Link to={getComponentIssuesUrl(component.key, params)}> - <span title={tooltip} data-toggle="tooltip"> + <Tooltip overlay={tooltip} placement="top"> + <Link to={getComponentIssuesUrl(component.key, params)}> {formatMeasure(value, 'SHORT_INT')} - </span> - </Link> + </Link> + </Tooltip> ); }; 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 && <MetaTags component={component} />} + {isProject && <AnalysesList project={component.key} history={history} router={router} />} + {shouldShowQualityGate && <MetaQualityGate gate={qualityGate} />} {shouldShowQualityProfiles && @@ -70,8 +72,6 @@ const Meta = ({ component, history, measures, areThereCustomOrganizations, route <MetaKey component={component} /> {shouldShowOrganizationKey && <MetaOrganizationKey component={component} />} - - {isProject && <AnalysesList project={component.key} history={history} router={router} />} </div> ); }; 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 ( - <li - key={profile.key} - className="overview-deprecated-rules" - title={tooltip} - data-toggle="tooltip"> - {inner} - </li> + <Tooltip key={profile.key} overlay={tooltip}> + <li className="overview-deprecated-rules"> + {inner} + </li> + </Tooltip> ); } @@ -126,17 +124,15 @@ class MetaQualityProfiles extends React.PureComponent { const { profiles } = this.props; return ( - <TooltipsContainer> - <div className="overview-meta-card"> - <h4 className="overview-meta-header"> - {translate('overview.quality_profiles')} - </h4> - - <ul className="overview-meta-list"> - {profiles.map(profile => this.renderProfile(profile))} - </ul> - </div> - </TooltipsContainer> + <div className="overview-meta-card"> + <h4 className="overview-meta-header"> + {translate('overview.quality_profiles')} + </h4> + + <ul className="overview-meta-list"> + {profiles.map(profile => this.renderProfile(profile))} + </ul> + </div> ); } } 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 { </form> </td> <td className="thin nowrap text-middle"> - <button className="spacer-right" onClick={this.bulkApplyTemplate}> + <button + className="spacer-right js-bulk-apply-permission-template" + onClick={this.bulkApplyTemplate}> {translate('permission_templates.bulk_apply_permission_template')} </button> <button diff --git a/server/sonar-web/src/main/js/apps/projects-admin/views/BulkApplyTemplateView.js b/server/sonar-web/src/main/js/apps/projects-admin/views/BulkApplyTemplateView.js index ee11a8d1eda..5dd9e8ab54c 100644 --- a/server/sonar-web/src/main/js/apps/projects-admin/views/BulkApplyTemplateView.js +++ b/server/sonar-web/src/main/js/apps/projects-admin/views/BulkApplyTemplateView.js @@ -73,8 +73,8 @@ export default ModalForm.extend({ const { selection } = this.options; let lastRequest = Promise.resolve(); - selection.forEach(projectId => { - const data = { templateId: permissionTemplate, projectId }; + selection.forEach(projectKey => { + const data = { templateId: permissionTemplate, projectKey }; if (this.options.organization) { data.organization = this.options.organization.key; } diff --git a/server/sonar-web/src/main/js/helpers/storage.js b/server/sonar-web/src/main/js/helpers/storage.js index 977f184443e..763aa3d64b1 100644 --- a/server/sonar-web/src/main/js/helpers/storage.js +++ b/server/sonar-web/src/main/js/helpers/storage.js @@ -66,8 +66,10 @@ export const getSort = () => window.localStorage.getItem(PROJECTS_SORT); export const saveCustomGraph = (metrics: ?Array<string>) => save(PROJECT_ACTIVITY_GRAPH_CUSTOM, metrics ? metrics.join(',') : ''); -export const getCustomGraph = (): Array<string> => - (window.localStorage.getItem(PROJECT_ACTIVITY_GRAPH_CUSTOM) || '').split(','); +export const getCustomGraph = (): Array<string> => { + const customGraphs = window.localStorage.getItem(PROJECT_ACTIVITY_GRAPH_CUSTOM); + return customGraphs ? customGraphs.split(',') : []; +}; export const saveGraph = (graph: ?string) => save(PROJECT_ACTIVITY_GRAPH, graph); export const getGraph = (): string => |