From c110e6ee38343b43fd43d6dba0ef92dee61cf7ea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Tue, 23 May 2017 11:52:59 +0200 Subject: [PATCH] SONAR-8913 Use "analysisDate" instead of "snapshotDate" in component overview --- .../src/main/js/app/components/nav/component/ComponentNav.js | 2 +- .../main/js/app/components/nav/component/ComponentNavMeta.js | 4 ++-- server/sonar-web/src/main/js/apps/overview/components/App.js | 3 ++- .../main/js/apps/overview/components/__tests__/App-test.js | 4 ++-- .../apps/overview/components/__tests__/EmptyOverview-test.js | 2 +- server/sonar-web/src/main/js/apps/overview/main/CodeSmells.js | 4 ++-- server/sonar-web/src/main/js/apps/overview/main/enhance.js | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js index 3ee81111367..4893ce58f0e 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.js @@ -84,7 +84,7 @@ export default class ComponentNav extends React.PureComponent { {...this.props} {...this.state} version={this.props.component.version} - snapshotDate={this.props.component.snapshotDate} + analysisDate={this.props.component.analysisDate} /> diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.js index 6fe26c1cbb4..78d72cb3943 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.js +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.js @@ -64,8 +64,8 @@ export default class ComponentNavMeta extends React.PureComponent { ); } - if (this.props.snapshotDate) { - metaList.push(
  • {moment(this.props.snapshotDate).format('LLL')}
  • ); + if (this.props.analysisDate) { + metaList.push(
  • {moment(this.props.analysisDate).format('LLL')}
  • ); } if (this.props.version) { diff --git a/server/sonar-web/src/main/js/apps/overview/components/App.js b/server/sonar-web/src/main/js/apps/overview/components/App.js index d1c73df1555..8a4adde9571 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/App.js +++ b/server/sonar-web/src/main/js/apps/overview/components/App.js @@ -26,6 +26,7 @@ import SourceViewer from '../../../components/SourceViewer/SourceViewer'; type Props = { component: { + analysisDate?: string, id: string, key: string, qualifier: string, @@ -58,7 +59,7 @@ class App extends React.PureComponent { ); } - if (!component.snapshotDate) { + if (!component.analysisDate) { return ; } diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.js b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.js index 01d73ea8c74..70dd35ee95d 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.js +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/App-test.js @@ -24,7 +24,7 @@ import OverviewApp from '../OverviewApp'; import EmptyOverview from '../EmptyOverview'; it('should render OverviewApp', () => { - const component = { id: 'id', snapshotDate: '2016-01-01' }; + const component = { id: 'id', analysisDate: '2016-01-01' }; const output = shallow(); expect(output.type()).toBe(OverviewApp); }); @@ -36,7 +36,7 @@ it('should render EmptyOverview', () => { }); it('should pass leakPeriodIndex', () => { - const component = { id: 'id', snapshotDate: '2016-01-01' }; + const component = { id: 'id', analysisDate: '2016-01-01' }; const output = shallow(); expect(output.prop('leakPeriodIndex')).toBe('1'); }); diff --git a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js index 7c9c06b16a5..f163dc8a969 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js +++ b/server/sonar-web/src/main/js/apps/overview/components/__tests__/EmptyOverview-test.js @@ -25,7 +25,7 @@ it('should render component key', () => { const component = { id: 'id', key: 'abcd', - snapshotDate: '2016-01-01' + analysisDate: '2016-01-01' }; const output = shallow(); expect(output.find('code').text()).toBe('abcd'); 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 1b7f13b95e7..ee496595efd 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 @@ -42,8 +42,8 @@ class CodeSmells extends React.PureComponent { Object.assign(params, { sinceLeakPeriod: 'true' }); } - const formattedSnapshotDate = moment(component.snapshotDate).format('LLL'); - const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate); + const formattedAnalysisDate = moment(component.analysisDate).format('LLL'); + const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate); return ( 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 1b21260cfeb..f6d450c661a 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 @@ -139,8 +139,8 @@ export default function enhance(ComposedComponent) { if (isDiffMetric(metric)) { Object.assign(params, { sinceLeakPeriod: 'true' }); } - const formattedSnapshotDate = moment(component.snapshotDate).format('LLL'); - const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedSnapshotDate); + const formattedAnalysisDate = moment(component.analysisDate).format('LLL'); + const tooltip = translateWithParameters('widget.as_calculated_on_x', formattedAnalysisDate); return ( -- 2.39.5