felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r889539 - in /felix/trunk/webconsole/src/main: java/org/apache/felix/webconsole/internal/core/BundlesServlet.java resources/res/ui/bundles.js
Date Fri, 11 Dec 2009 09:19:52 GMT
Author: cziegeler
Date: Fri Dec 11 09:19:50 2009
New Revision: 889539

URL: http://svn.apache.org/viewvc?rev=889539&view=rev
Log:
FELIX-1930 : Clicking action on bundles detail page shows full bundle list while URL stays
on bundles/<id>

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
    felix/trunk/webconsole/src/main/resources/res/ui/bundles.js

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java?rev=889539&r1=889538&r2=889539&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
Fri Dec 11 09:19:50 2009
@@ -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");

Modified: felix/trunk/webconsole/src/main/resources/res/ui/bundles.js
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/bundles.js?rev=889539&r1=889538&r2=889539&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/bundles.js (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/bundles.js Fri Dec 11 09:19:50 2009
@@ -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() {



Mime
View raw message