]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11631 Replace codePeriodVersion with buildString (frontend)
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 19 Mar 2019 10:46:53 +0000 (11:46 +0100)
committerSonarTech <sonartech@sonarsource.com>
Tue, 19 Mar 2019 19:21:27 +0000 (20:21 +0100)
server/sonar-web/src/main/js/app/types.d.ts
server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysis.tsx
server/sonar-web/src/main/js/apps/projectActivity/components/forms/__tests__/AddEventForm-test.tsx
server/sonar-web/src/main/js/helpers/testMocks.ts
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 2d4f5518f90b7ad080815ca73375b7c0ebda5793..2d6442dd7b4865e107b71e593a2d310555677719 100644 (file)
@@ -49,7 +49,7 @@ declare namespace T {
   }
 
   export interface Analysis {
-    codePeriodVersion?: string;
+    buildString?: string;
     date: string;
     events: AnalysisEvent[];
     key: string;
index 7b5d89e96252dc850521f44147bcf9716a78ab41..162191bbcfe299b38d72b852206c8693449ce386 100644 (file)
@@ -117,27 +117,25 @@ export default class ProjectActivityAnalysis extends React.PureComponent<Props,
   };
 
   render() {
-    const { analysis, isFirst, canAdmin } = this.props;
+    const { analysis, isFirst, canAdmin, canCreateVersion } = this.props;
     const { date, events } = analysis;
     const parsedDate = parseDate(date);
     const hasVersion = events.find(event => event.category === 'VERSION') != null;
 
-    const canAddVersion = canAdmin && !hasVersion && this.props.canCreateVersion;
+    const canAddVersion = canAdmin && !hasVersion && canCreateVersion;
     const canAddEvent = canAdmin;
     const canDeleteAnalyses =
       this.props.canDeleteAnalyses && !isFirst && !analysis.manualNewCodePeriodBaseline;
 
     let tooltipContent = <TimeFormatter date={parsedDate} long={true} />;
-    // If projectVersion AND codePeriodVersion are set, add the projectVersion
-    // to the tooltip content.
-    if (analysis.projectVersion && analysis.codePeriodVersion) {
+    if (analysis.buildString) {
       tooltipContent = (
         <>
           {tooltipContent}
           <br />
           {translateWithParameters(
-            'project_activity.analysis_project_version_X',
-            analysis.projectVersion
+            'project_activity.analysis_build_string_X',
+            analysis.buildString
           )}
         </>
       );
@@ -147,7 +145,7 @@ export default class ProjectActivityAnalysis extends React.PureComponent<Props,
       <Tooltip mouseEnterDelay={0.5} overlay={tooltipContent} placement="left">
         <li
           className={classNames('project-activity-analysis', { selected: this.props.selected })}
-          data-date={date.valueOf()}
+          data-date={parsedDate.valueOf()}
           onClick={this.handleClick}
           tabIndex={0}>
           <div className="project-activity-time spacer-right">
index 6879127085077a243112f780afcd79428f132c2b..0fe6350b213c39ca50042a5734e0ffe8c0d8abb7 100644 (file)
@@ -31,7 +31,7 @@ it('should render correctly', () => {
           key: '1',
           date: new Date('2019-01-14T15:44:51.000Z'),
           events: [{ key: '2', category: 'VERSION', name: '1.0' }],
-          codePeriodVersion: '1.0',
+          projectVersion: '1.0',
           manualNewCodePeriodBaseline: false
         }}
         onClose={jest.fn()}
index 04d39de2f9a7b9d19c3423e544f4cae8b75627c9..937d1f062d05d01ded20bfb792b9114d3e36e9dc 100644 (file)
@@ -19,6 +19,7 @@
  */
 import { InjectedRouter } from 'react-router';
 import { Location } from 'history';
+import { ParsedAnalysis } from '../apps/projectActivity/utils';
 import { Profile } from '../apps/quality-profiles/types';
 
 export function mockAlmApplication(overrides: Partial<T.AlmApplication> = {}): T.AlmApplication {
@@ -47,6 +48,42 @@ export function mockAlmOrganization(overrides: Partial<T.AlmOrganization> = {}):
   };
 }
 
+export function mockParsedAnalysis(overrides: Partial<ParsedAnalysis> = {}): ParsedAnalysis {
+  return {
+    date: new Date('2017-03-01T09:36:01+0100'),
+    events: [],
+    key: 'foo',
+    projectVersion: '1.0',
+    ...overrides
+  };
+}
+
+export function mockAnalysisEvent(overrides: Partial<T.AnalysisEvent> = {}): T.AnalysisEvent {
+  return {
+    category: 'QUALITY_GATE',
+    key: 'E11',
+    description: 'Lorem ipsum dolor sit amet',
+    name: 'Lorem ipsum',
+    qualityGate: {
+      status: 'ERROR',
+      stillFailing: true,
+      failing: [
+        {
+          key: 'foo',
+          name: 'Foo',
+          branch: 'master'
+        },
+        {
+          key: 'bar',
+          name: 'Bar',
+          branch: 'feature/bar'
+        }
+      ]
+    },
+    ...overrides
+  };
+}
+
 export function mockAppState(overrides: Partial<T.AppState> = {}): T.AppState {
   return {
     defaultOrganization: 'foo',
index 3a7bd52ac2be456f5f4b910a17c8233629c38e69..933afbd07c98d5b07a33b99cdc27da81705334da 100644 (file)
@@ -1050,7 +1050,7 @@ custom_measures.metric=Metric
 #------------------------------------------------------------------------------
 
 project_activity.analysis=Analysis
-project_activity.analysis_project_version_X=Project version: {0}
+project_activity.analysis_build_string_X=Build string: {0}
 project_activity.add_version=Create Version
 project_activity.analyzed.TRK=Project Analyzed
 project_activity.analyzed.APP=Application Analyzed