Page Key Format
The page key should have the format
governance/project_dump. The plugin_key is computed from your <artifactId> or can be set using the <pluginKey> parameter in sonar-packaging-maven-plugin configuration.
Step 1. Create a Java class implementing PageDefinition
All the pages should be declared in this class.
This file should have the same name as the page key (
my_page.js in this case) and should be located in
Where my_plugin/my_page is the same page key specified in step 1.
There are 3 settings available when you define the page extensions using the PageDefinition class:
- isAdmin: tells if the page should be restricted to user with the administer permission.
- scope: tells if the page should be displayed in the primary menu (GLOBAL scope) or inside a component page (COMPONENT scope). By default, a page is global. Since 6.4, the ORGANIZATION scope is added.
- component qualifiers: allows you to specify if the page should be displayed for PROJECT, MODULE, VIEW or SUB_VIEW (two last comes with the Enterprise Edition). If set, the scope of the page must be
- page extension key, which has a form of <plugin key>/<page key> (Ex: governance/project_dump)
- callback function, which is executed when the page extension is loaded. This callback should return another function, which will be called once the page extension will be closed. The callback accepts a single parameter options containing:
- options.el is a DOM element you must use to put the content inside
- options.currentUser contains the response of api/users/current (see Web API docs for details)
- (optional) options.component contains the information of the current project or view, if the page is project-level: key, name and qualifier
Please have a look to the Making Ajax Request page to learn how to fetch the data from the server.