FELIX-1808 Support manual configuration unbinding and extend the confirmation
dialogs with the configuration PID (and current binding if available)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@829782 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
index 123b11c..dcba792 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/compendium/ConfigManager.java
@@ -144,6 +144,14 @@
config = getConfiguration( ca, pid );
}
+ // check for configuration unbinding
+ if ( request.getParameter( "unbind" ) != null )
+ {
+ config.setBundleLocation( null );
+ sendRedirect( request, response, config.getPid() );
+ return;
+ }
+
// send the result
response.setContentType( "application/json" );
response.setCharacterEncoding( "UTF-8" );
@@ -751,7 +759,7 @@
String location;
if ( config.getBundleLocation() == null )
{
- location = "None";
+ location = "";
}
else
{
diff --git a/webconsole/src/main/resources/res/ui/configmanager.js b/webconsole/src/main/resources/res/ui/configmanager.js
index e45fbc4..3ee8a78 100644
--- a/webconsole/src/main/resources/res/ui/configmanager.js
+++ b/webconsole/src/main/resources/res/ui/configmanager.js
@@ -158,7 +158,7 @@
innerHTML += ' ';
innerHTML += '<input type="reset" class="submit" name="reset" value="Reset" />';
innerHTML += ' ';
- innerHTML += '<input type="submit" class="submit" name="delete" value="Delete" onClick="return confirmDelete();"/>';
+ innerHTML += '<input type="submit" class="submit" name="delete" value="Delete" onClick="return confirmDelete(\'' + obj.pid + '\', \'' + obj.bundleLocation + '\');"/>';
tdEl.innerHTML = innerHTML;
printConfigurationInfo(parent, obj);
@@ -297,6 +297,35 @@
])
])
);
+
+ if (obj.bundleLocation)
+ {
+ parent.appendChild( tr( "content", null, [
+ td( "content", null, [
+ text( " " )
+ ]),
+ td( "content", null, [
+ createElement( "form", null, {
+ method: "POST",
+ action: pluginRoot + "/" + obj.pid
+ }, [
+ createElement( "input", null, {
+ type: "hidden",
+ name: "unbind",
+ value: "true"
+ }),
+ createElement( "input", "submit", {
+ type: "submit",
+ name: "submit",
+ value: "Unbind",
+ title: "Unbind Configuration from Bundle",
+ onClick: "return confirmUnbind('" + obj.pid + "', '" + obj.bundleLocation + "');"
+ })
+ ])
+ ])
+ ])
+ );
+ }
}
@@ -441,7 +470,26 @@
span.parentNode.removeChild(span);
}
-function confirmDelete()
+function configConfirm(/* String */ message, /* String */ title, /* String */ location)
{
- return confirm("Are you sure to delete this configuration ?");
+ var message = "Are you sure to delete this configuration ?";
+
+ if (title) {
+ message += "\r\nConfiguration: " + title;
+ }
+ if (location) {
+ message += "\r\nBundle: " + location;
+ }
+
+ return confirm(message);
+}
+
+function confirmDelete(/* String */ title, /* String */ location)
+{
+ return configConfirm("Are you sure to unbind this configuration ?", title, location);
+}
+
+function confirmUnbind(/* String */ title, /* String */ location)
+{
+ return configConfirm("Are you sure to unbind this configuration ?", title, location);
}