@@ -28,8 +28,9 @@ import TagsList from '../../../components/tags/TagsList'; | |||
import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContainer'; | |||
import { translate, translateWithParameters } from '../../../helpers/l10n'; | |||
import { Project } from '../types'; | |||
import { Organization } from '../../../app/types'; | |||
import { formatDuration } from '../utils'; | |||
import { Organization } from '../../../app/types'; | |||
import { getProjectUrl } from '../../../helpers/urls'; | |||
interface Props { | |||
height: number; | |||
@@ -97,10 +98,17 @@ export default function ProjectCardLeak({ height, organization, project }: Props | |||
</div> | |||
) : ( | |||
<div className="boxed-group-inner"> | |||
<div className="note project-card-not-analyzed"> | |||
{project.analysisDate | |||
? translate('projects.no_new_code_period') | |||
: translate('projects.not_analyzed')} | |||
<div className="project-card-not-analyzed"> | |||
<span className="note"> | |||
{project.analysisDate | |||
? translate('projects.no_new_code_period') | |||
: translate('projects.not_analyzed')} | |||
</span> | |||
{!project.analysisDate && ( | |||
<Link className="button spacer-left" to={getProjectUrl(project.key)}> | |||
{translate('projects.configure_analysis')} | |||
</Link> | |||
)} | |||
</div> | |||
</div> | |||
)} |
@@ -29,6 +29,7 @@ import PrivacyBadgeContainer from '../../../components/common/PrivacyBadgeContai | |||
import { translate, translateWithParameters } from '../../../helpers/l10n'; | |||
import { Project } from '../types'; | |||
import { Organization } from '../../../app/types'; | |||
import { getProjectUrl } from '../../../helpers/urls'; | |||
interface Props { | |||
height: number; | |||
@@ -57,7 +58,7 @@ export default function ProjectCardOverall({ height, organization, project }: Pr | |||
{!organization && ( | |||
<ProjectCardOrganizationContainer organization={project.organization} /> | |||
)} | |||
<Link to={{ pathname: '/dashboard', query: { id: project.key } }}>{project.name}</Link> | |||
<Link to={getProjectUrl(project.key)}>{project.name}</Link> | |||
</h2> | |||
{project.analysisDate && <ProjectCardQualityGate status={measures['alert_status']} />} | |||
<div className="project-card-header-right"> | |||
@@ -90,7 +91,12 @@ export default function ProjectCardOverall({ height, organization, project }: Pr | |||
</div> | |||
) : ( | |||
<div className="boxed-group-inner"> | |||
<div className="note project-card-not-analyzed">{translate('projects.not_analyzed')}</div> | |||
<div className="project-card-not-analyzed"> | |||
<span className="note">{translate('projects.not_analyzed')}</span> | |||
<Link className="button spacer-left" to={getProjectUrl(project.key)}> | |||
{translate('projects.configure_analysis')} | |||
</Link> | |||
</div> | |||
</div> | |||
)} | |||
</div> |
@@ -76,3 +76,15 @@ it('should display the leak measures and quality gate', () => { | |||
shallow(<ProjectCardLeak height={100} organization={undefined} project={PROJECT} />) | |||
).toMatchSnapshot(); | |||
}); | |||
it('should display not analyzed yet', () => { | |||
expect( | |||
shallow( | |||
<ProjectCardLeak | |||
height={100} | |||
organization={undefined} | |||
project={{ ...PROJECT, analysisDate: undefined }} | |||
/> | |||
) | |||
).toMatchSnapshot(); | |||
}); |
@@ -90,3 +90,15 @@ it('should display the overall measures and quality gate', () => { | |||
shallow(<ProjectCardOverall height={100} organization={undefined} project={PROJECT} />) | |||
).toMatchSnapshot(); | |||
}); | |||
it('should display not analyzed yet', () => { | |||
expect( | |||
shallow( | |||
<ProjectCardOverall | |||
height={100} | |||
organization={undefined} | |||
project={{ ...PROJECT, analysisDate: undefined }} | |||
/> | |||
) | |||
).toMatchSnapshot(); | |||
}); |
@@ -1,5 +1,101 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should display not analyzed yet 1`] = ` | |||
<div | |||
className="boxed-group project-card" | |||
data-key="foo" | |||
style={ | |||
Object { | |||
"height": 100, | |||
} | |||
} | |||
> | |||
<div | |||
className="boxed-group-header clearfix" | |||
> | |||
<div | |||
className="project-card-header" | |||
> | |||
<h2 | |||
className="project-card-name" | |||
> | |||
<Connect(ProjectCardOrganization) | |||
organization={ | |||
Object { | |||
"key": "org", | |||
"name": "org", | |||
} | |||
} | |||
/> | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to={ | |||
Object { | |||
"pathname": "/dashboard", | |||
"query": Object { | |||
"id": "foo", | |||
}, | |||
} | |||
} | |||
> | |||
Foo | |||
</Link> | |||
</h2> | |||
<div | |||
className="project-card-header-right" | |||
> | |||
<Connect(PrivacyBadge) | |||
className="spacer-left" | |||
organization={ | |||
Object { | |||
"key": "org", | |||
"name": "org", | |||
} | |||
} | |||
qualifier="TRK" | |||
tooltipProps={ | |||
Object { | |||
"projectKey": "foo", | |||
} | |||
} | |||
visibility="public" | |||
/> | |||
</div> | |||
</div> | |||
</div> | |||
<div | |||
className="boxed-group-inner" | |||
> | |||
<div | |||
className="project-card-not-analyzed" | |||
> | |||
<span | |||
className="note" | |||
> | |||
projects.not_analyzed | |||
</span> | |||
<Link | |||
className="button spacer-left" | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to={ | |||
Object { | |||
"pathname": "/dashboard", | |||
"query": Object { | |||
"branch": undefined, | |||
"id": "foo", | |||
}, | |||
} | |||
} | |||
> | |||
projects.configure_analysis | |||
</Link> | |||
</div> | |||
</div> | |||
</div> | |||
`; | |||
exports[`should display the leak measures and quality gate 1`] = ` | |||
<div | |||
className="boxed-group project-card" |
@@ -1,5 +1,102 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
exports[`should display not analyzed yet 1`] = ` | |||
<div | |||
className="boxed-group project-card" | |||
data-key="foo" | |||
style={ | |||
Object { | |||
"height": 100, | |||
} | |||
} | |||
> | |||
<div | |||
className="boxed-group-header clearfix" | |||
> | |||
<div | |||
className="project-card-header" | |||
> | |||
<h2 | |||
className="project-card-name" | |||
> | |||
<Connect(ProjectCardOrganization) | |||
organization={ | |||
Object { | |||
"key": "org", | |||
"name": "org", | |||
} | |||
} | |||
/> | |||
<Link | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to={ | |||
Object { | |||
"pathname": "/dashboard", | |||
"query": Object { | |||
"branch": undefined, | |||
"id": "foo", | |||
}, | |||
} | |||
} | |||
> | |||
Foo | |||
</Link> | |||
</h2> | |||
<div | |||
className="project-card-header-right" | |||
> | |||
<Connect(PrivacyBadge) | |||
className="spacer-left" | |||
organization={ | |||
Object { | |||
"key": "org", | |||
"name": "org", | |||
} | |||
} | |||
qualifier="TRK" | |||
tooltipProps={ | |||
Object { | |||
"projectKey": "foo", | |||
} | |||
} | |||
visibility="public" | |||
/> | |||
</div> | |||
</div> | |||
</div> | |||
<div | |||
className="boxed-group-inner" | |||
> | |||
<div | |||
className="project-card-not-analyzed" | |||
> | |||
<span | |||
className="note" | |||
> | |||
projects.not_analyzed | |||
</span> | |||
<Link | |||
className="button spacer-left" | |||
onlyActiveOnIndex={false} | |||
style={Object {}} | |||
to={ | |||
Object { | |||
"pathname": "/dashboard", | |||
"query": Object { | |||
"branch": undefined, | |||
"id": "foo", | |||
}, | |||
} | |||
} | |||
> | |||
projects.configure_analysis | |||
</Link> | |||
</div> | |||
</div> | |||
</div> | |||
`; | |||
exports[`should display the overall measures and quality gate 1`] = ` | |||
<div | |||
className="boxed-group project-card" | |||
@@ -34,6 +131,7 @@ exports[`should display the overall measures and quality gate 1`] = ` | |||
Object { | |||
"pathname": "/dashboard", | |||
"query": Object { | |||
"branch": undefined, | |||
"id": "foo", | |||
}, | |||
} |
@@ -754,6 +754,7 @@ projects.explore_projects=Explore Projects | |||
projects.not_analyzed=Project is not analyzed yet. | |||
projects.no_new_code_period=Project has no new code data yet. | |||
projects.new_code_period_x=New code: last {0} | |||
projects.configure_analysis=Configure analysis | |||
projects.last_analysis_on_x=Last analysis: {0} | |||
projects.search=Search by project name or key | |||
projects.perspective=Perspective |