scope setting when creating a Page

21 views
Skip to first unread message

wdz273...@gmail.com

unread,
May 24, 2017, 5:10:28 AM5/24/17
to SonarQube
Hi,

SonarQube provides the ability to add a new Javascript page to the UI since SonarQube 6.3 according to doc.So I downloaded the ui-extension-plugin to try.
There are codes in UiPageDefinition.java as follows:

public class UiPageDefinition implements PageDefinition {
  @Override
  public void define(Context context) {
    context
      .addPage(Page.builder("uiextensionsplugin/global_page").setName("Global Page").build())
      .addPage(Page.builder("uiextensionsplugin/global_admin_page").setName("Global Admin Page").setAdmin(true).build())
      .addPage(Page.builder("uiextensionsplugin/project_page").setName("Project Page").setScope(COMPONENT).build())
      .addPage(Page.builder("uiextensionsplugin/project_admin_page").setName("Project Admin Page").setScope(COMPONENT).setAdmin(true).build());
   //   .addPage(Page.builder("uiextensionsplugin/organization_page").setName("Organization Page").setScope(ORGANIZATION).build())
  //    .addPage(Page.builder("uiextensionsplugin/organization_admin_page").setName("Organization Admin Page").setScope(ORGANIZATION).setAdmin(true).build());//(It seems that the  setting of ORGANIZATION can only be used Since 6.4.So I annotate them.
)
  }
}

I want to know about the effect of scope setting. And
 when I run the ui-extension-plugin,I could not find where 
project_page and project_admin_page is in the localhost page. Could someone help me? Thanks in advance.(*^_^*)

Regards.

gregoir...@sonarsource.com

unread,
May 24, 2017, 10:29:43 AM5/24/17
to SonarQube
Hello,

The scope setting define where the plugin will be available and will give you access to scope related objects in your Javascript page.
If you set it to :
  • GLOBAL : is the default scope, you can find your plugin in the global menu
  • COMPONENT : you will find your plugin at the project level (in the project's menu). It gives you access to the current project.
  • ORGANIZATION : is available only from 6.4 and will make your plugin available at the organization level. It gives you access to the current organization.
Reply all
Reply to author
Forward
0 new messages