Add custom tabs when creating and view pull requests

Hi. I’m a bit confused about how to go about adding a custom tab to both the pull request view page and the pull request create page in Bitbucket Server 5.7.1. I sort of figured out how to do it on the pull request view page. I have a custom servlet and a web item that points to that servlet. The web item’s section is bitbucket.pull-request.nav for the pull request view page. Since I have the decorator tag for that soy template set as bitbucket.pullrequest.view this works, the content loads when I click on the custom tab, but the entire page reloads. In my mind that’s not ideal but I don’t know how else this can be achieved. Can this be done without having to reload the page?

Additionally, I was able to add a custom tab to the pull request create page and attempted the same web item/servlet approach as for the pull request view page but this time the tab content doesn’t load and no page reload happens. In this case the web item’s section is and the Link URL is correct but nothing is happening when it gets clicked. I’m also not sure what decorator to use in the soy template for the pull request create page.

If anyone has any insight or example projects they can point to to help me with this that would be amazing.

EDIT: Upon further investigation, the custom tab generated in the pull request create page isn’t being registered properly. From what I can see in my browser debugger there’s a file with a source mapping URL /bitbucket/download/resources/com.atlassian.bitbucket.server.bitbucket-compare:compare-resources/compare.js. This file has a single entry point that is passed a list of tabs. Though my custom tab shows up on screen it is not in this list of tabs programmatically passed to the javascript functions that handle the tab actions. This seems like a potential bug though it’s more likely I’m not doing something right.

1 Like

Example pull request tab without page reloads


Thanks! That’s super helpful for the pull request view page.