@@ -18,7 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import * as React from 'react'; | |||
import { isProvided } from '../../project-admin/links/utils'; | |||
import { isProvided, getLinkName } from '../../project-admin/links/utils'; | |||
import BugTrackerIcon from '../../../components/ui/BugTrackerIcon'; | |||
import { ProjectLink } from '../../../api/projectLinks'; | |||
@@ -30,7 +30,7 @@ export default function MetaLink({ link }: Props) { | |||
return ( | |||
<li> | |||
<a className="link-with-icon" href={link.url} rel="nofollow" target="_blank"> | |||
<MetaLinkIcon link={link} /> {link.name} | |||
<MetaLinkIcon link={link} /> {getLinkName(link)} | |||
</a> | |||
</li> | |||
); |
@@ -19,7 +19,7 @@ | |||
*/ | |||
import React from 'react'; | |||
import PropTypes from 'prop-types'; | |||
import { isProvided } from './utils'; | |||
import { isProvided, getLinkName } from './utils'; | |||
import { translate } from '../../../helpers/l10n'; | |||
import BugTrackerIcon from '../../../components/ui/BugTrackerIcon'; | |||
@@ -57,7 +57,7 @@ export default class LinkRow extends React.PureComponent { | |||
{this.renderIcon(`icon-${link.type}`)} | |||
<div className="display-inline-block text-top"> | |||
<div> | |||
<span className="js-name">{link.name}</span> | |||
<span className="js-name">{getLinkName(link)}</span> | |||
</div> | |||
<div className="note little-spacer-top"> | |||
<span className="js-type">{`sonar.links.${link.type}`}</span> |
@@ -18,6 +18,7 @@ | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
import { partition, sortBy } from 'lodash'; | |||
import { translate } from '../../../helpers/l10n'; | |||
const PROVIDED_TYPES = ['homepage', 'ci', 'issue', 'scm', 'scm_dev']; | |||
@@ -32,3 +33,7 @@ export function orderLinks(links) { | |||
...sortBy(unknown, link => link.name.toLowerCase()) | |||
]; | |||
} | |||
export function getLinkName(link) { | |||
return isProvided(link) ? translate('project_links', link.type) : link.name; | |||
} |
@@ -395,7 +395,7 @@ qualifier.description.APP=Single-level aggregation with a technical focus and a | |||
# | |||
#------------------------------------------------------------------------------ | |||
project_links.homepage=Home | |||
project_links.homepage=Project's Website | |||
project_links.ci=Continuous integration | |||
project_links.issue=Bug Tracker | |||
project_links.scm=Sources |
@@ -81,7 +81,6 @@ public class ProjectLinksTest { | |||
ProjectLinkItem homepageLink = links.get(0); | |||
ProjectLinkItem customLink = links.get(1); | |||
homepageLink.getName().should(text("Home")); | |||
homepageLink.getType().should(text("sonar.links.homepage")); | |||
homepageLink.getUrl().should(text("http://example.com")); | |||
homepageLink.getDeleteButton().shouldNot(Condition.exist); |