aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-12 13:50:33 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-16 11:08:02 +0200
commit1d8a83568656e0f934d3eee71df5776d411a1fec (patch)
tree73715077c9877b3e2c2c971574494d2dfa459953
parenta9a04c4793e1909eb96a489d4ab56c43aca44427 (diff)
downloadsonarqube-1d8a83568656e0f934d3eee71df5776d411a1fec.tar.gz
sonarqube-1d8a83568656e0f934d3eee71df5776d411a1fec.zip
SONAR-9966 Page extensions are shown for branches
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx5
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx12
2 files changed, 14 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
index 0cee6379a78..3d38f0517a6 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMenu.tsx
@@ -434,13 +434,16 @@ export default class ComponentNavMenu extends React.PureComponent<Props> {
};
renderAdminExtensions() {
+ if (this.props.branch && !this.props.branch.isMain) {
+ return [];
+ }
const extensions = this.getConfiguration().extensions || [];
return extensions.map(e => this.renderExtension(e, true));
}
renderExtensions() {
const extensions = this.props.component.extensions || [];
- if (!extensions.length) {
+ if (!extensions.length || (this.props.branch && !this.props.branch.isMain)) {
return null;
}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
index 8405e371da7..68bb1f5c458 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.tsx
@@ -71,7 +71,11 @@ it('should work for short-living branches', () => {
name: 'feature',
type: BranchType.SHORT
};
- const component = { ...baseComponent, configuration: { showSettings: true } };
+ const component = {
+ ...baseComponent,
+ configuration: { showSettings: true },
+ extensions: [{ key: 'component-foo', name: 'ComponentFoo' }]
+ };
expect(
shallow(<ComponentNavMenu branch={branch} component={component} />, {
context: { branchesEnabled: true }
@@ -86,7 +90,11 @@ it('should work for long-living branches', () => {
shallow(
<ComponentNavMenu
branch={branch}
- component={{ ...baseComponent, configuration: { showSettings } }}
+ component={{
+ ...baseComponent,
+ configuration: { showSettings },
+ extensions: [{ key: 'component-foo', name: 'ComponentFoo' }]
+ }}
/>,
{ context: { branchesEnabled: true } }
)