aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-17 11:22:17 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-19 09:06:13 +0200
commit6d2f8c7900ea8f73f26c0acad5f558fc6f0bdb62 (patch)
tree79ec77538bda430d59b3c05b1ff5af05d62d3bd5 /server/sonar-web/src/main/js/apps
parente1014a2f6b27cf1abc92c35b4f84d49485045677 (diff)
downloadsonarqube-6d2f8c7900ea8f73f26c0acad5f558fc6f0bdb62.tar.gz
sonarqube-6d2f8c7900ea8f73f26c0acad5f558fc6f0bdb62.zip
SONAR-9817 Provide activity page for modules and directories
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/component-measures/components/MeasureHeader.js3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/events/AnalysesList.js22
-rw-r--r--server/sonar-web/src/main/js/apps/overview/events/Analysis.js5
-rw-r--r--server/sonar-web/src/main/js/apps/overview/meta/Meta.js17
4 files changed, 29 insertions, 18 deletions
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 (
<div className="measure-details-header big-spacer-bottom">
<div className="measure-details-primary">
@@ -62,7 +61,7 @@ export default function MeasureHeader(props /*: Props*/) {
)}
</strong>
</span>
- {hasHistory && (
+ {!isDiff && (
<Tooltip
placement="right"
overlay={translate('component_measures.show_metric_history')}>
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 {
<PreviewGraph
branch={this.props.branch}
history={this.props.history}
- project={this.props.project}
+ project={this.props.component.key}
metrics={this.state.metrics}
/>
@@ -122,7 +134,7 @@ export default class AnalysesList extends React.PureComponent {
<Link
to={{
pathname: '/project/activity',
- query: { id: this.props.project, branch: this.props.branch }
+ query: { id: this.props.component.key, branch: this.props.branch }
}}>
{translate('show_more')}
</Link>
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 (
<li className="overview-analysis">
<div className="small little-spacer-bottom">
@@ -55,7 +58,7 @@ export default function Analysis(props /*: Props */) {
{sortedEvents.map(event => <Event event={event} key={event.key} />)}
</div>
) : (
- <span className="note">{translate('project_activity.analyzed', props.qualifier)}</span>
+ <span className="note">{translate('project_activity.analyzed', qualifier)}</span>
)}
</li>
);
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 && <MetaTags component={component} onComponentChange={onComponentChange} />}
- {(isProject || isApplication) && (
- <AnalysesList
- branch={branch}
- project={component.key}
- qualifier={component.qualifier}
- history={history}
- router={router}
- />
- )}
+ <AnalysesList
+ branch={branch}
+ component={component}
+ qualifier={component.qualifier}
+ history={history}
+ router={router}
+ />
{shouldShowQualityGate && (
<MetaQualityGate