FELIX-4430 Provide bundles using exported packages along with the version at which the exports are imported

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1570134 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
index d4fbae3..918c6f1 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
+++ b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.html
@@ -28,6 +28,7 @@
 			<th>${header.package.name}</th>
 			<th>${header.package.ver}</th>
 			<th>${header.exporting.bundle}</th>
+			<th>${header.importing.bundle}</th>
 			<th>${header.maven.deps}</th>
 		</tr>
 	</thead>
@@ -36,6 +37,7 @@
 			<td class="pkg">&nbsp;</td>
 			<td class="ver">-</td>
 			<td class="bnd">${no.exporters.found}</td>
+			<td class="use">${no.uses.found}</td>
 			<td class="mvn">${no.maven.found}</td>
 		</tr>
 	</tbody>
diff --git a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
index 8468103..43589ee 100644
--- a/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
+++ b/webconsole-plugins/packageadmin/src/main/resources/res/plugin.js
@@ -25,7 +25,26 @@
 var dupsTableTemplate = false;

 var statline = false;

 

-function linkBundle(bnd) { return '<a href="{0}/bundles/{1}">{2} ({3})</a>'.msgFormat(appRoot, bnd.bid, bnd.bsn, bnd.bid) }

+function linkBundle(bnd) { return '<a href="{0}/bundles/{1}">{2} ({3})</a>'.msgFormat(appRoot, bnd.bid, bnd.bsn, bnd.bid) }
+function uses(uses) {

+    var result = ""; 

+    if (uses) {

+        resul = "<table>";

+        for(var i in uses) {

+            result += "<tr><td>";

+            result += linkBundle(uses[i]);

+            result += "</td><td>";

+            if (uses[i].ver) {

+                result += uses[i].ver;

+            } else {

+                result += "&mdash;";

+            }

+            result += "</td></tr>";

+        }

+        result += "</table>";

+    }

+    return result;

+}

 

 $(function() {

 	findField = $('#findField');

@@ -63,7 +82,8 @@
 						var tr = findTableTemplate.clone()

 							.find('td.pkg').text(pkg.name).end()

 							.find('td.ver').text(exp.version).end()

-							.find('td.bnd').html(linkBundle(exp)).end()

+							.find('td.bnd').html(linkBundle(exp)).end()
+							.find('td.use').html(uses(exp.importers)).end()

 							.appendTo(findTableBody);

 						if (response.maven && response.maven[exp.bid]) {

 							var mvn = response.maven[exp.bid];

@@ -100,8 +120,7 @@
 						.find('td.ver').text(exp.version).end()

 						.find('td.exp').html(linkBundle(exp)).end();

 					if (exp.importers) {

-						var txt = ''; for(var j in exp.importers) txt += linkBundle(exp.importers[j]) + '<br/>';

-						td.find('td.imp').html( txt );

+						td.find('td.imp').html(uses(exp.importers));

 					}

 					if (i==0) {

 						td.find('td.pkg').attr('rowspan', pkg.entries.length);