diff options
author | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-03 17:13:23 +0200 |
---|---|---|
committer | Grégoire Aubert <gregoire.aubert@sonarsource.com> | 2017-05-05 15:05:12 +0200 |
commit | 2770f7162157e761a332f71bd8f671680f21e80e (patch) | |
tree | 9aa4f2bafb9aa20b9a2f51051d965280c2f86158 /server/sonar-web | |
parent | ff4be625bf14bfc769b8872bb4aa8a49efd6ec8a (diff) | |
download | sonarqube-2770f7162157e761a332f71bd8f671680f21e80e.tar.gz sonarqube-2770f7162157e761a332f71bd8f671680f21e80e.zip |
SONAR-8771 Display more languages on the Projects page
Diffstat (limited to 'server/sonar-web')
-rw-r--r-- | server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js index e4d4c283521..3e19ee801ce 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js @@ -39,11 +39,10 @@ class ProjectCardLanguages extends React.PureComponent { if (distribution == null) { return null; } - const parsedLanguages = distribution.split(';').map(item => item.split('=')); - const finalLanguages = sortBy(parsedLanguages, l => -1 * Number(l[1])) - .slice(0, 2) - .map(l => this.getLanguageName(l[0])); + const finalLanguages = sortBy(parsedLanguages, l => -1 * Number(l[1])).map(l => + this.getLanguageName(l[0]) + ); const tooltip = ( <span> @@ -51,12 +50,13 @@ class ProjectCardLanguages extends React.PureComponent { </span> ); + const languagesText = + finalLanguages.slice(0, 2).join(', ') + (finalLanguages.length > 2 ? ', ...' : ''); + return ( <div className="project-card-languages"> <Tooltip placement="bottom" overlay={tooltip}> - <span title={finalLanguages.join('<br/>')} data-toggle="tooltip"> - {finalLanguages.join(', ')} - </span> + <span>{languagesText}</span> </Tooltip> </div> ); |