1
votes

I am trying to create a custom sonar plugin by looking the code in sonar reference plugin.But the this reference plugin is not able to show the widget in sonar dashboard? The .erb file is

<div class="dashbox">
<h3><span title="<%= metric('random').description -%>"></span></h3>
<p>
<span class="big">
<%= format_measure('random') -%> <%= trend_icon(measure('random')) %>
</span>
</p>
<p><%= format_measure('message_key') -%></p>
<p>
<%= format_measure('ncloc', :suffix => ' lines', :url =>url_for_drilldown('ncloc'))    
-%>
</p>
</div>
<div class="dashbox">
<h3><%= message('example.help') -%></h3>
<p>
<%= message('example.jdbc_login') -%> : <%= configuration('sonar.jdbc.username')  
-%><br/>
<%= message('example.plugin_property') -%> : <%=  
configuration('sonar.example.myproperty') -%><br/>
</p>

<p>
<%= message('example.eastwood_image') -%> : <br/>
<%= gchart('cht=bhs&chco=FF0000,00FF00,0000FF&chs=200x125&chd=s:FOE,THE,Bar&chxt=x,y& 
chxl=1:|Dec|Nov|Oct|0:||20K||60K||100K|') -%>
</p>

<h3><%= message('example.widget_properties') -%></h3>
<table>
<tr>
<td>max: </td>
<td><%= widget_properties['max'] -%></td>
</tr>
<tr>
  <td>param1: </td>
  <td><%= widget_properties['param1'] -%></td>
</tr>
<tr>
  <td>param2: </td>
  <td><%= widget_properties['param2'] -%></td>
</tr>

1
What do you mean by 'But the reference plugin is not able to show the widget in Sonar dashboard' ? Do you get an error message ? If this is the case, could you provide this error message ? Have explicitly configure your Sonar server to display this widget in one Dashboard ? - Freddy - SonarSource Team
In the ui part of the this plugin there are two classes one for showing the widget in the dashboard and the other to show a static test in the footer of sonar page. The footer is getting displayed but not the widget - rohan lukose
But again @Rohan, have you explicitly configured your dashboard to display this widget ? see docs.codehaus.org/display/SONAR/… - Freddy - SonarSource Team
Thanks, that did the magic I configured the widget. - rohan lukose
As i was using sonar 3.3.1 which wasnt having the option of widget conf so I downloaded 3.3.5 - rohan lukose

1 Answers

0
votes

Just in case someone else runs into this you must configure the widget to be displayed. You will not have the rights to display the widget unless you are an administrative user.