Reputation: 51
I want to create my own global dashboard in a new SonarQube Plugin. So, I have created a new class in my java project that extend DashboardTemplate.
My problem is the following : I want to add to my dashboard an existing widget (MeasureFilterListWidget). I want that the widget display it automatically when I add my plugin to SonarQube, it's for why I don't use the manual method.
In the next image, I want to add the widget class in the place of "???".
Thank you very much for your help
Upvotes: 0
Views: 106
Reputation: 7321
As per Javadoc of addWidget:
The widget ids are listed by the web service /api/widgets
Let's do this on the public SonarQube instance (Nemo): list widgets. This is what you're looking for:
{
"id": "measure_filter_list",
"title": "Measure Filter as List",
"description": "Displays the result of a pre-configured measure filter as a list.",
"categories": [ "Filters" ]
}
So you should replace the ???
by measure_filter_list
.
Note that addWidget
returns a Dashboard.Widget to pre-define the widget's properties (e.g. the Measure Filter to use) and avoid manual configuration.
Upvotes: 1