FELIX-2288 Add support for components whose component ID is not assigned. Instead of the component ID a combination of the component name and the service.pid property assigned to the component is used. If the service.pid property is not assigned to the component, just the component name is used.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@981795 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/resources/res/ui/components.js b/webconsole/src/main/resources/res/ui/components.js
index b0d084c..c1432e8 100644
--- a/webconsole/src/main/resources/res/ui/components.js
+++ b/webconsole/src/main/resources/res/ui/components.js
@@ -38,24 +38,35 @@
 	}
 }
 
-function entry( /* Object */ dataEntry ) {
-	var id = dataEntry.id;
-	var name = dataEntry.name;
+function getEntryId(/* Object */ dataEntry) {
+    var id = dataEntry.id;
+    if (id < 0) {
+        id = dataEntry.name;
+        if (dataEntry.pid) {
+            id += "/" + dataEntry.pid;
+        }
+    }
+    return id;
+}
 
-	var _ = tableEntryTemplate.clone().appendTo(tableBody).attr('id', 'entry' + dataEntry.id);
+function entry( /* Object */ dataEntry ) {
+	var idPath = getEntryId(dataEntry);
+	var id = idPath.replace(/[./-]/g, "_");
+	var name = dataEntry.name;
+	var _ = tableEntryTemplate.clone().appendTo(tableBody).attr('id', 'entry' + id);
 
 	_.find('.bIcon').attr('id', 'img' + id).click(function() {
-		showDetails(id);
-	}).after(drawDetails ? name : ('<a href="' + window.location.pathname + '/' + id + '">' + name + '</a>'));
+		showDetails(idPath);
+	}).after(drawDetails ? name : ('<a href="' + pluginRoot + '/' + idPath + '">' + name + '</a>'));
 
-	_.find('td:eq(0)').text( id );
+	_.find('td:eq(0)').text( dataEntry.id );
 	_.find('td:eq(2)').text( dataEntry.state );
 
 	// setup buttons
 	if ( dataEntry.stateRaw == 1 || dataEntry.stateRaw == 1024 ) { // disabled or disabling
-		_.find('li:eq(0)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(id, 'enable') });
+		_.find('li:eq(0)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(idPath, 'enable') });
 	} else {
-		_.find('li:eq(1)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(id, 'disable') });
+		_.find('li:eq(1)').removeClass('ui-helper-hidden').click(function() { changeDataEntryState(idPath, 'disable') });
 	}
 	if ( dataEntry.configurable ) _.find('li:eq(2)').removeClass('ui-helper-hidden').click(function() { // configure
 		changeDataEntryState(dataEntry.pid, 'configure');
@@ -85,6 +96,7 @@
 }
 
 function hideDetails( id ) {
+	var __test__ = $("#img" + id);
 	$("#img" + id).each(function() {
 		$("#pluginInlineDetails").remove();
 		$(this).
@@ -98,9 +110,11 @@
 
 function renderDetails( data ) {
 	data = data.data[0];
+	var id = getEntryId(data).replace(/[./-]/g, "_");
 	$("#pluginInlineDetails").remove();
-	$("#entry" + data.id + " > td").eq(1).append("<div id='pluginInlineDetails'/>");
-	$("#img" + data.id).each(function() {
+	var __test__ = $("#entry" + id);
+	$("#entry" + id + " > td").eq(1).append("<div id='pluginInlineDetails'/>");
+	$("#img" + id).each(function() {
 		if ( drawDetails ) {
 			var ref = window.location.pathname;
 			ref = ref.substring(0, ref.lastIndexOf('/'));
@@ -116,7 +130,7 @@
 				removeClass('ui-icon-triangle-1-e').//right
 				addClass('ui-icon-triangle-1-s').//down
 				attr("title", "Hide Details").
-				unbind('click').click(function() {hideDetails(data.id)});
+				unbind('click').click(function() {hideDetails(id)});
 		}
 	});
 	$("#pluginInlineDetails").append("<table border='0'><tbody></tbody></table>");