FELIX-1930 : Clicking action on bundles detail page shows full bundle list while URL stays on bundles/<id>
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@889539 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
index 84d4c30..0748024 100644
--- a/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
+++ b/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
@@ -17,48 +17,22 @@
package org.apache.felix.webconsole.internal.core;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
+import java.io.*;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
+import java.util.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.felix.bundlerepository.R4Attribute;
-import org.apache.felix.bundlerepository.R4Export;
-import org.apache.felix.bundlerepository.R4Import;
-import org.apache.felix.bundlerepository.R4Package;
+import org.apache.felix.bundlerepository.*;
import org.apache.felix.webconsole.ConfigurationPrinter;
import org.apache.felix.webconsole.WebConsoleConstants;
-import org.apache.felix.webconsole.internal.BaseWebConsolePlugin;
+import org.apache.felix.webconsole.internal.*;
import org.apache.felix.webconsole.internal.Logger;
import org.apache.felix.webconsole.internal.Util;
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.json.JSONWriter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.framework.Version;
+import org.json.*;
+import org.osgi.framework.*;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.component.ComponentConstants;
import org.osgi.service.log.LogService;
@@ -410,6 +384,7 @@
pw.println( "var imgRoot = '" + appRoot + "/res/imgs';");
pw.println( "var startLevel = " + getStartLevel().getInitialBundleStartLevel() + ";");
pw.println( "var drawDetails = " + reqInfo.bundleRequested + ";");
+ pw.println( "var currentBundle = " + (reqInfo.bundleRequested ? String.valueOf(reqInfo.bundle.getBundleId()) : "null") + ";");
Util.endScript( pw );
Util.script(pw, appRoot, "bundles.js");
diff --git a/webconsole/src/main/resources/res/ui/bundles.js b/webconsole/src/main/resources/res/ui/bundles.js
index 028d8b4..588a9ec 100644
--- a/webconsole/src/main/resources/res/ui/bundles.js
+++ b/webconsole/src/main/resources/res/ui/bundles.js
@@ -40,11 +40,17 @@
$(".statusline").empty().append(eventData.status);
$("#plugin_table > tbody > tr").remove();
for ( var idx in eventData.data ) {
- entry( eventData.data[idx] );
+ if ( currentBundle == null || !drawDetails || currentBundle == eventData.data[idx].id) {
+ entry( eventData.data[idx] );
+ }
}
$("#plugin_table").trigger("update");
- if ( drawDetails ) {
- renderDetails(eventData);
+ if ( drawDetails && eventData.data.length == 1 ) {
+ renderDetails(eventData.data[0]);
+ } else if ( currentBundle != null ) {
+ var id = currentBundle;
+ hideDetails(id);
+ showDetails(id);
}
}
@@ -139,12 +145,14 @@
}
function showDetails( id ) {
+ currentBundle = id;
$.get(pluginRoot + "/" + id + ".json", null, function(data) {
- renderDetails(data);
+ renderDetails(data.data[0]);
}, "json");
}
function hideDetails( id ) {
+ currentBundle = null;
$("#img" + id).each(function() {
$("#pluginInlineDetails").remove();
$(this).attr("src", appRoot + "/res/imgs/arrow_right.png");
@@ -155,7 +163,6 @@
}
function renderDetails( data ) {
- data = data.data[0];
$("#pluginInlineDetails").remove();
$("#entry" + data.id + " > td").eq(1).append("<div id='pluginInlineDetails'/>");
$("#img" + data.id).each(function() {