Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved the list view regarding the currently selected VM, full them…

…e support and easier sibling handling. This also prevents multi-selecting VMs.

git-svn-id: http://vboxweb.googlecode.com/svn/trunk@43 729376a8-6c6b-11de-afdd-bb9f892af8c1
  • Loading branch information...
commit 47528285567c7c525a2a49be09e40e30607f2abd 1 parent 50f568d
vboxweb authored
View
18 VBoxWebSrv.py
@@ -71,19 +71,17 @@ def __init__(self, ctx, arrMach, type):
# Currently this involves too much copying around.
#
class jsVRDPServer:
- def __init__(self, ctx, machine):
- global g_serverAddress
-
- self.enabled = machine.VRDPServer.enabled
- self.port = machine.VRDPServer.port
+ def __init__(self, ctx, vrdp):
+ self.enabled = vrdp.enabled
+ self.port = vrdp.port
- self.netAddress = machine.VRDPServer.netAddress
+ self.netAddress = vrdp.netAddress
if not self.netAddress:
self.netAddress = ctx['serverAdr']
- self.authType = machine.VRDPServer.authType
- self.allowMultiConnection = machine.VRDPServer.allowMultiConnection
- self.reuseSingleConnection = machine.VRDPServer.reuseSingleConnection
+ self.authType = vrdp.authType
+ self.allowMultiConnection = vrdp.allowMultiConnection
+ self.reuseSingleConnection = vrdp.reuseSingleConnection
class jsGuestOSType:
def __init__(self, guestOSType):
@@ -126,7 +124,7 @@ def __init__(self, ctx, machine):
self.accelerate3DEnabled = machine.accelerate3DEnabled
self.HWVirtExEnabled = machine.HWVirtExEnabled
self.HWVirtExNestedPagingEnabled = machine.HWVirtExNestedPagingEnabled
- self.VRDPServer = jsVRDPServer(ctx, machine)
+ self.VRDPServer = jsVRDPServer(ctx, machine.VRDPServer)
self.state = machine.state
self.sessState = machine.sessionState
View
39 www/static/js/vboxVMListView.js
@@ -215,18 +215,39 @@ var vboxVMListView = Class.create(
'</li>';
jQuery(newItem).appendTo('ol#vmList');
}
+
+ /* Select first item */
+ /* @todo Save old selected item, create list (see above) and select the old
+ VM again (if still present). Otherwise set first entry. */
+ jQuery("#vmList li:first").toggleClass('ui-selected');
+
+ /* (Re-)connect all handlers */
+ jQuery('ol#vmList li').
+ mouseover(function()
+ {
+ jQuery(this).toggleClass('ui-state-hover');
+ }).
+ mouseout(function()
+ {
+ jQuery(this).toggleClass('ui-state-hover');
+ }).
+ click(function(event, ui)
+ {
+ jQuery(this).
+ toggleClass('ui-selected').
+ siblings().removeClass('ui-selected');
+
+ vmListView.selectionChanged(event);
+ vmTabView.selectionChanged();
+ vmToolbar.selectionChanged();
+ });
},
- selectionChanged: function(event, ui)
+ selectionChanged: function(event)
{
- /* The following line works around the bug to use the 'option' -> 'active' getter: jQuery('#vmList').accordion('option', 'active'); */
- var curIndex = jQuery("#vmList tr").index(jQuery("#vmList tr.ui-selected"));
- if (curIndex >= 0)
- {
- this.mCurItem = this.mVMModel.itemByRow(curIndex);
- console.log("vboxVMListView::selectionChanged: mCurItem = %s", this.mCurItem.name());
- }
- else console.log("vboxVMListView::selectionChanged: Invalid index (%d)!", curIndex);
+ var curIndex = jQuery("#vmList li").index(event.currentTarget);
+ this.mCurItem = this.mVMModel.itemByRow(curIndex);
+ console.log("vboxVMListView::selectionChanged: mCurItem = %s", this.mCurItem.name());
},
selectedItem: function()
View
13 www/templates/index.html
@@ -89,7 +89,7 @@
/* Set global jQuery handle (instead of using "jQuery(...)" all the time.
var $j = jQuery.noConflict();*/
-
+
function onDocumentLoad()
{
}
@@ -123,7 +123,7 @@
jQuery(document).ready(onDocumentReady);
function onDocumentReady()
- {
+ {
/* Use different outer-layout classNames to simplify/clarify CSS. */
OuterLayout = jQuery('body').layout({
north__paneSelector: ".outer-layout-north"
@@ -149,15 +149,6 @@
OuterLayout.resizeAll();
- /* Then init the VM list. */
- jQuery('#vmList').selectable({
- selected: function(event, ui) {
- vmListView.selectionChanged(event, ui);
- vmTabView.selectionChanged();
- vmToolbar.selectionChanged();
- }
- });
-
vbGlobal = new vboxGlobal();
vmToolbar = new vboxVMToolbar();
vmListView = new vboxVMListView();
Please sign in to comment.
Something went wrong with that request. Please try again.