From 6d2f8c7900ea8f73f26c0acad5f558fc6f0bdb62 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 17 Oct 2017 11:22:17 +0200 Subject: SONAR-9817 Provide activity page for modules and directories --- .../component-measures/components/MeasureHeader.js | 3 +-- .../main/js/apps/overview/events/AnalysesList.js | 22 +++++++++++++++++----- .../src/main/js/apps/overview/events/Analysis.js | 5 ++++- .../src/main/js/apps/overview/meta/Meta.js | 17 +++++++---------- 4 files changed, 29 insertions(+), 18 deletions(-) (limited to 'server/sonar-web/src/main/js/apps') diff --git a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js index 81853659e39..695c68ea26b 100644 --- a/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js +++ b/server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js @@ -46,7 +46,6 @@ export default function MeasureHeader(props /*: Props*/) { const { branch, component, leakPeriod, measure, secondaryMeasure } = props; const metric = measure.metric; const isDiff = isDiffMetric(metric.key); - const hasHistory = !isDiff && ['TRK', 'VW', 'SVW', 'APP'].includes(component.qualifier); return (
@@ -62,7 +61,7 @@ export default function MeasureHeader(props /*: Props*/) { )} - {hasHistory && ( + {!isDiff && ( 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 2c181d03d8c..e70fa1cb1fb 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 @@ -31,8 +31,8 @@ import { translate } from '../../../helpers/l10n'; /*:: type Props = { branch?: string, + component: Object, history: ?History, - project: string, qualifier: string, router: { push: ({ pathname: string, query?: {} }) => void } }; @@ -59,7 +59,7 @@ export default class AnalysesList extends React.PureComponent { } componentDidUpdate(prevProps /*: Props */) { - if (prevProps.project !== this.props.project) { + if (prevProps.component !== this.props.component) { this.fetchData(); } } @@ -68,12 +68,24 @@ export default class AnalysesList extends React.PureComponent { this.mounted = false; } + getTopLevelComponent = () => { + const { component } = this.props; + let current = component.breadcrumbs.length - 1; + while ( + current > 0 && + !['TRK', 'VW', 'APP'].includes(component.breadcrumbs[current].qualifier) + ) { + current--; + } + return component.breadcrumbs[current].key; + }; + fetchData() { this.setState({ loading: true }); Promise.all([ getProjectActivity({ branch: this.props.branch, - project: this.props.project, + project: this.getTopLevelComponent(), ps: PAGE_SIZE }), getMetrics() @@ -112,7 +124,7 @@ export default class AnalysesList extends React.PureComponent { @@ -122,7 +134,7 @@ export default class AnalysesList extends React.PureComponent { {translate('show_more')} 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 66bf60bfc36..d60a2450722 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 @@ -42,6 +42,9 @@ export default function Analysis(props /*: Props */) { 'category' ); + // use `TRK` for all components but applications + const qualifier = props.qualifier === 'APP' ? 'APP' : 'TRK'; + return (
  • @@ -55,7 +58,7 @@ export default function Analysis(props /*: Props */) { {sortedEvents.map(event => )}
    ) : ( - {translate('project_activity.analyzed', props.qualifier)} + {translate('project_activity.analyzed', qualifier)} )}
  • ); 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 00fefefe32a..defccb6e9ba 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 @@ -42,7 +42,6 @@ const Meta = ({ const { qualifier, description, qualityProfiles, qualityGate } = component; const isProject = qualifier === 'TRK'; - const isApplication = qualifier === 'APP'; const hasDescription = !!description; const hasQualityProfiles = Array.isArray(qualityProfiles) && qualityProfiles.length > 0; @@ -62,15 +61,13 @@ const Meta = ({ {isProject && } - {(isProject || isApplication) && ( - - )} + {shouldShowQualityGate && (