Fixed FELIX-3848 : Differentiate between unbound and new configuration
https://issues.apache.org/jira/browse/FELIX-3848


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1643105 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
index 272a3af..043ca44 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/configuration/ConfigAdminSupport.java
@@ -559,6 +559,9 @@
                     .put( "name", name ); //$NON-NLS-1$
                 if ( null != config )
                 {
+                    // FELIX-3848
+                    data.put ( "has_config", true ); //$NON-NLS-1$
+
                     final String fpid = config.getFactoryPid();
                     if ( null != fpid )
                     {
diff --git a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
index a3014a3..dcc6330 100644
--- a/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
+++ b/webconsole/src/main/resources/OSGI-INF/l10n/bundle.properties
@@ -183,6 +183,8 @@
 config.configurations.title=Configurations
 config.create.tip=Create new factory configuration
 config.edit.tip=Edit the configuration values
+config.title.exists= ?\ 
+config.title.exists.tip=There is a real Configuration created. If the checkbox was missing, it would be either Managed Service or Meta-Type definition available but no configuration.
 config.title.actions=Actions
 config.title.bundle=Bundle
 config.title.name=Name
diff --git a/webconsole/src/main/resources/res/ui/config.css b/webconsole/src/main/resources/res/ui/config.css
index 21e543d..2946b18 100644
--- a/webconsole/src/main/resources/res/ui/config.css
+++ b/webconsole/src/main/resources/res/ui/config.css
@@ -35,4 +35,5 @@
 #factoryTableCaption { margin-top: 1.5em }
 span.default_value {
 	float: left; margin-right: .3em;
-}
\ No newline at end of file
+}
+td.col_Exists_body div.ui-icon { margin-left:auto; margin-right: auto }
diff --git a/webconsole/src/main/resources/res/ui/config.js b/webconsole/src/main/resources/res/ui/config.js
index af2f43b..db7a1ed 100644
--- a/webconsole/src/main/resources/res/ui/config.js
+++ b/webconsole/src/main/resources/res/ui/config.js
@@ -460,9 +460,13 @@
 
 function addConfig(conf) {
 	var tr = configRow.clone().appendTo(configBody);
+	
+	if (!conf.has_config) {
+		tr.find('td:eq(0)').empty();
+	}
 
 	// rendering name - indented if factory pid is set
-	var nms = tr.find('td:eq(0) div');
+	var nms = tr.find('td:eq(1) div');
 	if (conf.fpid) { 
 		nms.after(conf.id); 
 		tr.attr('fpid', conf.name);
@@ -470,10 +474,10 @@
 		nms.addClass('ui-helper-hidden').parent().text(conf.name);
 	}
 
-	tr.find('td:eq(0)').click(function() { // name & edit
+	tr.find('td:eq(1)').click(function() { // name & edit
 		configure(conf.id);
 	});
-	tr.find('td:eq(1)').html(conf.bundle ? '<a href="' + pluginRoot + '/../bundles/' + conf.bundle + '">' + conf.bundle_name + '</a>' : '-'); // binding
+	tr.find('td:eq(2)').html(conf.bundle ? '<a href="' + pluginRoot + '/../bundles/' + conf.bundle + '">' + conf.bundle_name + '</a>' : '-'); // binding
 	
 	// buttons
 	tr.find('li:eq(0)').click(function() { // edit
@@ -492,11 +496,11 @@
 function addFactoryConfig(conf) {
 	var tr = factoryRow.clone().appendTo(configTable).attr('fpid', conf.name);
 	//tr.find('td:eq(1)').text(conf.id); // fpid
-	tr.find('td:eq(0)').text(conf.name).click(function() { // name & edit
+	tr.find('td:eq(1)').text(conf.name).click(function() { // name & edit
 		configure(conf.id, true);
 	});
 	// buttons
-	tr.find('li:eq(0)').click(function() { // edit
+	tr.find('li:eq(1)').click(function() { // edit
 		configure(conf.id, true);
 	});
 }
@@ -513,7 +517,7 @@
 	var fpid = row.attr('fpid');
 	
 	// factory row
-	if ( row.hasClass('fpid') && fpid) return fpid + (desc==0?1:0) + text;
+	if ( row.hasClass('fpid') && fpid) return fpid + (desc==1?1:0) + text;
 
 	// bundle or name row
 	if ( fpid ) return fpid + desc + text;
@@ -615,12 +619,15 @@
 
 		// init tablesorte
 		configTable.tablesorter({
-			headers: { 2: { sorter: false }  },
-			sortList: [[0,1]],
+			headers: {
+				0: { sorter: false },
+				3: { sorter: false }
+			},
+			sortList: [[1,1]],
 			textExtraction: treetableExtraction
-		}).bind('sortStart', function() { // clear cache, otherwse extraction will not work
+		}).bind('sortStart', function() { // clear cache, otherwise extraction will not work
 			var table = $(this).trigger('update'); 
-		}).find('th:eq(0)').click();
+		}).find('th:eq(1)').click();
 	} else {
 		configContent.addClass('ui-helper-hidden');
 	}
diff --git a/webconsole/src/main/resources/templates/config.html b/webconsole/src/main/resources/templates/config.html
index 97d21c7..e357fe5 100644
--- a/webconsole/src/main/resources/templates/config.html
+++ b/webconsole/src/main/resources/templates/config.html
@@ -50,6 +50,7 @@
 	<table id="configTable" class="tablesorter nicetable noauto">
 		<thead>
 			<tr>
+				<th class="col_Exists">${config.title.exists}</th>
 				<th class="col_Name">${config.title.name}</th>
 				<th class="col_Binding">${config.title.bundle}</th>
 				<th class="col_Actions">${config.title.actions}</th>
@@ -57,6 +58,7 @@
 		</thead>
 		<tbody>
 			<tr>
+				<td class="col_Exists_body" title="${config.title.exists.tip}"><div class="ui-icon ui-icon-check">&nbsp;</div></td>
 				<td class="pointer"><div class="ui-icon ui-icon-triangle-1-e subpid">&nbsp;</div></td>
 				<td>&nbsp;</td>
 				<td>
@@ -68,6 +70,7 @@
 				</td>
 			</tr>
 			<tr class="fpid">
+				<td>&nbsp;</td>
 				<td class="pointer">&nbsp;</td>
 				<td>-</td>
 				<td>