]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9702 display branches on background tasks page
authorStas Vilchik <stas.vilchik@sonarsource.com>
Fri, 1 Sep 2017 09:18:28 +0000 (11:18 +0200)
committerJanos Gyerik <janos.gyerik@sonarsource.com>
Tue, 12 Sep 2017 09:34:57 +0000 (11:34 +0200)
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap
server/sonar-web/src/main/js/apps/background-tasks/types.ts

index 07bb92df540cb2efda7e207263ced5e4934c8db2..c6839478f78c725721ce5ae826c2243f289eb0c6 100644 (file)
 import * as React from 'react';
 import { Link } from 'react-router';
 import TaskType from './TaskType';
+import { Task } from '../types';
 import QualifierIcon from '../../../components/shared/QualifierIcon';
 import Organization from '../../../components/shared/Organization';
-import { Task } from '../types';
+import { getProjectUrl } from '../../../helpers/urls';
 
 interface Props {
   task: Task;
@@ -50,8 +51,14 @@ export default function TaskComponent({ task }: Props) {
       {task.organization && <Organization organizationKey={task.organization} />}
 
       {task.componentName &&
-        <Link to={{ pathname: '/dashboard', query: { id: task.componentKey } }}>
+        <Link className="spacer-right" to={getProjectUrl(task.componentKey, task.branch)}>
           {task.componentName}
+
+          {task.branch &&
+            <span className="text-limited text-text-top" title={task.branch}>
+              <span style={{ marginLeft: 5, marginRight: 5 }}>/</span>
+              {task.branch}
+            </span>}
         </Link>}
 
       <TaskType incremental={task.incremental} type={task.type} />
index 5769bdb868abcd3d641d64a6c26fdfc353ed7e2c..456abbdf210f9a2ba3fa963b5fc57f387fd49897 100644 (file)
@@ -27,7 +27,7 @@ interface Props {
 
 export default function TaskType({ incremental, type }: Props) {
   return (
-    <span className="note nowrap spacer-left">
+    <span className="display-inline-block note">
       {'['}
       {translate('background_task.type', type)}
       {incremental && ` - ${translate('incremental')}`}
index 5f12acf8f48a69ce11ac60fef8556a914628f2d4..cd1f525b6493bfaabfefc2678cea3c875891ff6d 100644 (file)
@@ -34,4 +34,5 @@ it('renders', () => {
   };
   expect(shallow(<TaskComponent task={task} />)).toMatchSnapshot();
   expect(shallow(<TaskComponent task={{ ...task, componentKey: undefined }} />)).toMatchSnapshot();
+  expect(shallow(<TaskComponent task={{ ...task, branch: 'feature' }} />)).toMatchSnapshot();
 });
index 7e37c8dbfa6d524a583539b1b596d83c175203cf..2237b4c5f46801cee64c93497267e6d1310ec0aa 100644 (file)
@@ -23,7 +23,11 @@ import TaskDate from '../TaskDate';
 
 it('renders', () => {
   expect(shallow(<TaskDate />)).toMatchSnapshot();
-  expect(shallow(<TaskDate date="2017-01-01" />)).toMatchSnapshot();
-  expect(shallow(<TaskDate date="2017-01-01" baseDate="2017-01-01" />)).toMatchSnapshot();
-  expect(shallow(<TaskDate date="2017-01-05" baseDate="2017-01-01" />)).toMatchSnapshot();
+  expect(shallow(<TaskDate date="2017-01-01T00:00:00.000Z" />)).toMatchSnapshot();
+  expect(
+    shallow(<TaskDate date="2017-01-01T00:00:00.000Z" baseDate="2017-01-01T00:00:00.000Z" />)
+  ).toMatchSnapshot();
+  expect(
+    shallow(<TaskDate date="2017-01-05T00:00:00.000Z" baseDate="2017-01-01T00:00:00.000Z" />)
+  ).toMatchSnapshot();
 });
index 2413a5689a0bfbf7d6cb9ca1af53ff97912860a8..baa478c38e22bbe44590dc6acc23a987488b12b8 100644 (file)
@@ -23,10 +23,14 @@ import TaskDay from '../TaskDay';
 
 it('renders', () => {
   expect(
-    shallow(<TaskDay submittedAt="2017-01-02" prevSubmittedAt="2017-01-01" />)
+    shallow(
+      <TaskDay submittedAt="2017-01-02T00:00:00.000Z" prevSubmittedAt="2017-01-01T00:00:00.000Z" />
+    )
   ).toMatchSnapshot();
 
   expect(
-    shallow(<TaskDay submittedAt="2017-01-01" prevSubmittedAt="2017-01-01" />)
+    shallow(
+      <TaskDay submittedAt="2017-01-01T00:00:00.000Z" prevSubmittedAt="2017-01-01T00:00:00.000Z" />
+    )
   ).toMatchSnapshot();
 });
index b8fec515315f621450933662e449d66a5294f0ac..93a63cdafd4bafd02975c5d3a85d55aa802efca8 100644 (file)
@@ -13,12 +13,14 @@ exports[`renders 1`] = `
     organizationKey="org"
   />
   <Link
+    className="spacer-right"
     onlyActiveOnIndex={false}
     style={Object {}}
     to={
       Object {
         "pathname": "/dashboard",
         "query": Object {
+          "branch": undefined,
           "id": "foo",
         },
       }
@@ -44,3 +46,53 @@ exports[`renders 2`] = `
   />
 </td>
 `;
+
+exports[`renders 3`] = `
+<td>
+  <span
+    className="little-spacer-right"
+  >
+    <QualifierIcon
+      qualifier="TRK"
+    />
+  </span>
+  <Connect(Organization)
+    organizationKey="org"
+  />
+  <Link
+    className="spacer-right"
+    onlyActiveOnIndex={false}
+    style={Object {}}
+    to={
+      Object {
+        "pathname": "/dashboard",
+        "query": Object {
+          "branch": "feature",
+          "id": "foo",
+        },
+      }
+    }
+  >
+    foo
+    <span
+      className="text-limited text-text-top"
+      title="feature"
+    >
+      <span
+        style={
+          Object {
+            "marginLeft": 5,
+            "marginRight": 5,
+          }
+        }
+      >
+        /
+      </span>
+      feature
+    </span>
+  </Link>
+  <TaskType
+    type="REPORT"
+  />
+</td>
+`;
index 2222e541e98d0a1b47ccb1158220860f946cdeee..7a5dbb2dc430c6ff35e42c95ec96fba13cf3db9a 100644 (file)
@@ -11,7 +11,7 @@ exports[`renders 2`] = `
   className="thin nowrap text-right"
 >
   <TimeFormatter
-    date={2016-12-31T23:00:00.000Z}
+    date={2017-01-01T00:00:00.000Z}
     long={true}
   />
 </td>
@@ -22,7 +22,7 @@ exports[`renders 3`] = `
   className="thin nowrap text-right"
 >
   <TimeFormatter
-    date={2016-12-31T23:00:00.000Z}
+    date={2017-01-01T00:00:00.000Z}
     long={true}
   />
 </td>
@@ -38,7 +38,7 @@ exports[`renders 4`] = `
     (+4d)
   </span>
   <TimeFormatter
-    date={2017-01-04T23:00:00.000Z}
+    date={2017-01-05T00:00:00.000Z}
     long={true}
   />
 </td>
index 7fccb036da2220b39187efe921ca4a42b77de79f..9a34276c640f7a538d9f523570dd6d768e5e6dcb 100644 (file)
@@ -5,7 +5,7 @@ exports[`renders 1`] = `
   className="thin nowrap text-right"
 >
   <DateFormatter
-    date="2017-01-02"
+    date="2017-01-02T00:00:00.000Z"
     long={true}
   />
 </td>
index 649856a4680428fab43a6f4134c353eafdf68b70..df6e0ffa00b2f3abc5671d984c311a93b5c582a6 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`renders 1`] = `
 <span
-  className="note nowrap spacer-left"
+  className="display-inline-block note"
 >
   [
   background_task.type.REPORT
@@ -12,7 +12,7 @@ exports[`renders 1`] = `
 
 exports[`renders 2`] = `
 <span
-  className="note nowrap spacer-left"
+  className="display-inline-block note"
 >
   [
   background_task.type.REPORT
index b0e1003be0340297daff1b520b4f965a4837df5c..a149d2f7d2e0c81849532d4dce554f63dd212023 100644 (file)
@@ -19,6 +19,8 @@
  */
 
 export interface Task {
+  branch?: string;
+  branchType?: string;
   componentKey?: string;
   componentName?: string;
   componentQualifier?: string;