]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8771 Display more languages on the Projects page
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Wed, 3 May 2017 15:13:23 +0000 (17:13 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 5 May 2017 13:05:12 +0000 (15:05 +0200)
server/sonar-web/src/main/js/apps/projects/components/ProjectCardLanguages.js

index e4d4c283521b3e5e93a8baa06efc6f4d232bdd42..3e19ee801ceece9b6736d52c207e370604787710 100644 (file)
@@ -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>
     );