diff options
author | Stas Vilchik <stas.vilchik@sonarsource.com> | 2017-09-01 11:18:28 +0200 |
---|---|---|
committer | Janos Gyerik <janos.gyerik@sonarsource.com> | 2017-09-12 11:34:57 +0200 |
commit | a314c0cd2862cefdc5fb9aacf0612a5560b0f32a (patch) | |
tree | 862f00ffd30d976901a79786b3a604fd0e73cc5a /server/sonar-web | |
parent | c01264d91bd4d05e405d4e93e2accd5fefb81136 (diff) | |
download | sonarqube-a314c0cd2862cefdc5fb9aacf0612a5560b0f32a.tar.gz sonarqube-a314c0cd2862cefdc5fb9aacf0612a5560b0f32a.zip |
SONAR-9702 display branches on background tasks page
Diffstat (limited to 'server/sonar-web')
10 files changed, 84 insertions, 14 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx index 07bb92df540..c6839478f78 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx @@ -20,9 +20,10 @@ 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} /> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx index 5769bdb868a..456abbdf210 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx @@ -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')}`} diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx index 5f12acf8f48..cd1f525b649 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.tsx @@ -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(); }); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx index 7e37c8dbfa6..2237b4c5f46 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDate-test.tsx @@ -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(); }); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx index 2413a5689a0..baa478c38e2 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskDay-test.tsx @@ -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(); }); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap index b8fec515315..93a63cdafd4 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.tsx.snap @@ -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> +`; diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap index 2222e541e98..7a5dbb2dc43 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDate-test.tsx.snap @@ -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> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap index 7fccb036da2..9a34276c640 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskDay-test.tsx.snap @@ -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> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap index 649856a4680..df6e0ffa00b 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap @@ -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 diff --git a/server/sonar-web/src/main/js/apps/background-tasks/types.ts b/server/sonar-web/src/main/js/apps/background-tasks/types.ts index b0e1003be03..a149d2f7d2e 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/types.ts +++ b/server/sonar-web/src/main/js/apps/background-tasks/types.ts @@ -19,6 +19,8 @@ */ export interface Task { + branch?: string; + branchType?: string; componentKey?: string; componentName?: string; componentQualifier?: string; |