felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r783772 - in /felix/trunk/webconsole/src/main: java/org/apache/felix/webconsole/internal/core/BundlesServlet.java resources/res/ui/admin.css resources/res/ui/bundles.js
Date Thu, 11 Jun 2009 13:57:46 GMT
Author: cziegeler
Date: Thu Jun 11 13:57:46 2009
New Revision: 783772

URL: http://svn.apache.org/viewvc?rev=783772&view=rev
Log:
FELIX-1217: First step: remove start and start level input fields from list header, add new
panel for install/update and add new refresh button

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/core/BundlesServlet.java
    felix/trunk/webconsole/src/main/resources/res/ui/admin.css
    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=783772&r1=783771&r2=783772&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
Thu Jun 11 13:57:46 2009
@@ -102,7 +102,13 @@
         IOException
     {
         final RequestInfo reqInfo = new RequestInfo(request);
-        if ( reqInfo.bundle == null && reqInfo.bundleRequested ) {
+        if ( "upload".equals(reqInfo.pathInfo) )
+        {
+            super.doGet(request, response);
+            return;
+        }
+        if ( reqInfo.bundle == null && reqInfo.bundleRequested )
+        {
             response.sendError(404);
             return;
         }
@@ -286,12 +292,31 @@
 
         Util.script(pw, appRoot, "bundles.js");
 
-        pw.println( "<div id='plugin_content'/>");
-        Util.startScript( pw );
-        pw.print( "renderBundles(");
-        writeJSON(pw, reqInfo.bundle);
-        pw.println(");" );
-        Util.endScript( pw );
+        if ( "upload".equals(reqInfo.pathInfo) )
+        {
+            renderUploadForm(pw);
+        }
+        else
+        {
+            pw.println( "<div id='plugin_content'/>");
+            Util.startScript( pw );
+            pw.print( "renderBundles(");
+            writeJSON(pw, reqInfo.bundle);
+            pw.println(");" );
+            Util.endScript( pw );
+        }
+    }
+
+    private void renderUploadForm( final PrintWriter pw ) throws IOException
+    {
+        pw.println(" <div id='plugin_content'><div class='contentheader'>Upload
/ Install Bundles</div>");
+        pw.println( "<form method='post' enctype='multipart/form-data' action='../'>");
+        pw.println( "<input type='hidden' name='action' value='install'/>");
+        pw.println( "<div class='contentline'><input class='fileinput' type='file'
name='bundlefile'/></div>");
+        pw.println( "<div class='contentline'><div class='contentleft'>Start
Bundle</div><div class='contentright'><input class='checkradio' type='checkbox'
name='bundlestart' value='start'/></div></div>");
+        pw.println( "<div class='contentline'><div class='contentleft'>Start
Level</div><div class='contentright'><input class='input' type='input' name='bundlestartlevel'
value='" + getStartLevel().getInitialBundleStartLevel() + "' size='4'/></div></div>");
+        pw.println( "<div class='contentline'><input type='submit' value='Install
or Update'/></div>");
+        pw.println( "</form></div");
     }
 
     private void renderJSON( final HttpServletResponse response, final Bundle bundle ) throws
IOException
@@ -552,7 +577,7 @@
         }
 
         listServices( jw, bundle );
-        
+
         listHeaders( jw, bundle );
 
         jw.endArray();
@@ -799,13 +824,13 @@
         {
             return;
         }
-        
+
         for ( int i = 0; i < refs.length; i++ )
         {
             String key = "Service ID " + refs[i].getProperty( Constants.SERVICE_ID );
-            
+
             JSONArray val = new JSONArray();
-            
+
             appendProperty( val, refs[i], Constants.OBJECTCLASS, "Types" );
             appendProperty( val, refs[i], Constants.SERVICE_PID, "PID" );
             appendProperty( val, refs[i], ConfigurationAdmin.SERVICE_FACTORYPID, "Factory
PID" );
@@ -814,12 +839,12 @@
             appendProperty( val, refs[i], ComponentConstants.COMPONENT_FACTORY, "Component
Factory" );
             appendProperty( val, refs[i], Constants.SERVICE_DESCRIPTION, "Description" );
             appendProperty( val, refs[i], Constants.SERVICE_VENDOR, "Vendor" );
-            
+
             keyVal( jw, key, val);
         }
     }
-    
-    
+
+
     private void listHeaders( JSONWriter jw, Bundle bundle ) throws JSONException
     {
         JSONArray val = new JSONArray();
@@ -1030,6 +1055,7 @@
         public final String extension;
         public final Bundle bundle;
         public final boolean bundleRequested;
+        public final String pathInfo;
 
         protected RequestInfo( final HttpServletRequest request )
         {
@@ -1058,11 +1084,13 @@
             {
                 bundle = null;
                 bundleRequested = false;
+                pathInfo = null;
             }
             else
             {
                 bundle = getBundle(bundleInfo);
                 bundleRequested = true;
+                pathInfo = bundleInfo;
             }
             request.setAttribute(BundlesServlet.class.getName(), this);
         }

Modified: felix/trunk/webconsole/src/main/resources/res/ui/admin.css
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/resources/res/ui/admin.css?rev=783772&r1=783771&r2=783772&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/admin.css (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/admin.css Thu Jun 11 13:57:46 2009
@@ -628,4 +628,32 @@
 }
 .col_Actions {
     width: 95px;
-}
\ No newline at end of file
+}
+#plugin_content {
+    margin-top: 26px;
+    margin-bottom: 26px;
+}
+.contentheader {
+    border: 0px solid #66dd44;
+    border-bottom: 1px solid #cccccc;
+    text-align: left;
+    padding: 5px;
+    padding-left: 10px;
+    color: #6181A9;
+    background-color: #f0f0f0;
+}
+.contentline {
+	padding-top: 15px;
+	padding-left:10px;
+    clear: both;
+    width: 100%;
+}
+.contentleft {
+    padding-left: 9px;
+    float: left;
+    width:110px;
+}
+.contentright {
+    display: inline;
+    width: 225px;
+}

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=783772&r1=783771&r2=783772&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/resources/res/ui/bundles.js (original)
+++ felix/trunk/webconsole/src/main/resources/res/ui/bundles.js Thu Jun 11 13:57:46 2009
@@ -214,13 +214,19 @@
 	$(document).ready(function(){
     	renderView( ["Id", "Name", "Version", "Symbolic Name", "Status", "Actions"],
         		"<input type='hidden' name='action' value='install'/>" +
+        		"<input type='hidden' name='bundlestart' value='start'/>" +
+        		"<input type='hidden' name='bundlestartlevel' value='" + startLevel + "'/>"
+
                 "<input class='fileinput' type='file' name='bundlefile' style='margin-left:10px'/>"
+
-         		" - Start <input class='checkradio' type='checkbox' name='bundlestart' value='start'
style='vertical-align:middle;'/>" +
-        		" - Start Level <input class='input' type='input' name='bundlestartlevel' value='"
+ startLevel + "' size='4'/>" +
-         		"<input type='submit' value='Install or Update' style='margin-left:60px'/>"
+
-        		"<button id='refreshPackages' type='button' name='refresh' style='margin-left:10px'>Refresh
Packages</button>"
+         		"<input type='submit' value='Install or Update' style='margin-left:10px'/>"
+
+         		"<button class='reloadButton' type='button' name='reload' style='margin-left:60px'>Reload</button>"
+
+         		"<button class='installButton' type='button' name='install'>Install/Update...</button>"
+
+         		"<button class='refreshPackages' type='button' name='refresh'>Refresh Packages</button>"
         		 );
-        $("#refreshPackages").click(refreshPackages);
+        $(".refreshPackages").click(refreshPackages);
+	    $(".reloadButton").click(loadData);
+	    $(".installButton").click(function() {
+	    	document.location = pluginRoot + "/upload";
+	    });
         renderData(data);
         
         var extractMethod = function(node) {



Mime
View raw message