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;
{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} />
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')}`}
};
expect(shallow(<TaskComponent task={task} />)).toMatchSnapshot();
expect(shallow(<TaskComponent task={{ ...task, componentKey: undefined }} />)).toMatchSnapshot();
+ expect(shallow(<TaskComponent task={{ ...task, branch: 'feature' }} />)).toMatchSnapshot();
});
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();
});
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();
});
organizationKey="org"
/>
<Link
+ className="spacer-right"
onlyActiveOnIndex={false}
style={Object {}}
to={
Object {
"pathname": "/dashboard",
"query": Object {
+ "branch": undefined,
"id": "foo",
},
}
/>
</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>
+`;
className="thin nowrap text-right"
>
<TimeFormatter
- date={2016-12-31T23:00:00.000Z}
+ date={2017-01-01T00:00:00.000Z}
long={true}
/>
</td>
className="thin nowrap text-right"
>
<TimeFormatter
- date={2016-12-31T23:00:00.000Z}
+ date={2017-01-01T00:00:00.000Z}
long={true}
/>
</td>
(+4d)
</span>
<TimeFormatter
- date={2017-01-04T23:00:00.000Z}
+ date={2017-01-05T00:00:00.000Z}
long={true}
/>
</td>
className="thin nowrap text-right"
>
<DateFormatter
- date="2017-01-02"
+ date="2017-01-02T00:00:00.000Z"
long={true}
/>
</td>
exports[`renders 1`] = `
<span
- className="note nowrap spacer-left"
+ className="display-inline-block note"
>
[
background_task.type.REPORT
exports[`renders 2`] = `
<span
- className="note nowrap spacer-left"
+ className="display-inline-block note"
>
[
background_task.type.REPORT
*/
export interface Task {
+ branch?: string;
+ branchType?: string;
componentKey?: string;
componentName?: string;
componentQualifier?: string;