FELIX-4704 : Show ranking in web console services plugin. Apply patch from Alex Klimetschek

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1648340 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
index 8f5cb95..319944e 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/ServicesServlet.java
@@ -287,7 +287,16 @@
         jw.value( propertyAsString( service, Constants.OBJECTCLASS ) );
         jw.key( "pid" );
         jw.value( propertyAsString( service, Constants.SERVICE_PID ) );
-
+        jw.key( "ranking" );
+        final Object ranking = service.getProperty(Constants.SERVICE_RANKING);
+        if ( ranking != null )
+        {
+            jw.value( ranking.toString() );
+        }
+        else
+        {
+            jw.value("");
+        }
         bundleInfo( jw, service.getBundle(), locale );
 
         if ( details )
diff --git a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
index dcc6330..ec5495e 100644
--- a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -34,6 +34,7 @@
 abort=Cancel
 back=Back
 id=Id
+ranking=Ranking
 type=Type
 type_s=Type(s)
 bundle=Bundle
diff --git a/webconsole/src/main/resources/res/ui/services.js b/webconsole/src/main/resources/res/ui/services.js
index fe4b29f..4d61baa 100644
--- a/webconsole/src/main/resources/res/ui/services.js
+++ b/webconsole/src/main/resources/res/ui/services.js
@@ -37,8 +37,9 @@
 		showDetails(id);
 	}).after(drawDetails ? name : ('<a href="' + window.location.pathname + '/' + id + '">' + name + '</a>'));
 	  
-	_.find('td:eq(1)').text(dataEntry.types);
-	_.find('td:eq(2)').html('<a href="' + bundlePath + dataEntry.bundleId + '">' + dataEntry.bundleSymbolicName + ' (' + dataEntry.bundleId + ')</a>' );
+	_.find('td:eq(1)').text(dataEntry.ranking);
+	_.find('td:eq(2)').text(dataEntry.types);
+	_.find('td:eq(3)').html('<a href="' + bundlePath + dataEntry.bundleId + '">' + dataEntry.bundleSymbolicName + ' (' + dataEntry.bundleId + ')</a>' );
 }
 
 function showDetails(id) {
@@ -60,7 +61,7 @@
 
 function renderDetails(data) {
 	data = data.data[0];
-	$('#entry' + data.id + ' > td').eq(1).append('<div id="pluginInlineDetails' + data.id + '"/>');
+	$('#entry' + data.id + ' > td').eq(2).append('<div id="pluginInlineDetails' + data.id + '"/>');
 	$('#img' + data.id).each(function() {
 		if (drawDetails) {
 			var ref = window.location.pathname;
@@ -156,7 +157,8 @@
 
 	$('#plugin_table').tablesorter( {
 		headers : {
-			0 : { sorter : 'digit' }
+			0 : { sorter : 'digit' },
+			1 : { sorter : 'digit' }
 		},
 		sortList : [ [ 1, 0 ] ],
 		textExtraction : mixedLinksExtraction
diff --git a/webconsole/src/main/resources/templates/services.html b/webconsole/src/main/resources/templates/services.html
index 0e70c58..a090e04 100644
--- a/webconsole/src/main/resources/templates/services.html
+++ b/webconsole/src/main/resources/templates/services.html
@@ -36,6 +36,7 @@
 	<thead>
 		<tr>
 			<th class="col_Id">${id}</th>
+			<th class="col_Ranking">${ranking}</th>
 			<th class="col_Types">${type_s}</th>
 			<th class="col_Bundle">${bundle}</th>
 		</tr>
@@ -45,6 +46,7 @@
 			<td>
 				<div class="bIcon ui-icon ui-icon-triangle-1-e" style="float:left" title="${services.details.tip}">&nbsp;</div>
 			</td>
+			<td>&nbsp;</td><!-- ranking -->
 			<td>&nbsp;</td><!-- type -->
 			<td>&nbsp;</td><!-- bundle -->
 		</tr>