]> source.dussan.org Git - sonarqube.git/commitdiff
fix rendering of component's extensions
authorStas Vilchik <vilchiks@gmail.com>
Thu, 31 Mar 2016 15:38:44 +0000 (17:38 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Fri, 1 Apr 2016 15:53:08 +0000 (17:53 +0200)
server/sonar-web/src/main/js/main/nav/component/component-nav-menu.js

index cdbb58d0a0bacbe704850f1f0e84b113ab8c665b..fe7f6d4a53df82d11939b66747af22cfc59ce439 100644 (file)
@@ -304,15 +304,27 @@ export default React.createClass({
   },
 
   renderTools() {
-    const component = this.props.component;
-    if (!component.isComparable && !_.size(component.extensions)) {
+    const extensions = this.props.component.extensions || [];
+    const withoutGovernance = extensions.filter(ext => ext.name !== 'Governance');
+    const tools = withoutGovernance.map(extension => {
+      return this.renderLink(extension.url, extension.name);
+    });
+
+    if (!tools.length) {
       return null;
     }
-    const tools = [];
-    (component.extensions || []).forEach(e => {
-      tools.push(this.renderLink(e.url, e.name));
-    });
-    return tools;
+
+    return (
+        <li className="dropdown">
+          <a className="dropdown-toggle" data-toggle="dropdown" href="#">
+            {translate('sidebar.tools')}&nbsp;
+            <i className="icon-dropdown"/>
+          </a>
+          <ul className="dropdown-menu">
+            {tools}
+          </ul>
+        </li>
+    );
   },
 
   render() {