From 9b1c967bdbcbc0a189ac8fa05a3f49ff16e4a532 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Wed, 4 Apr 2012 16:21:47 +0200 Subject: [PATCH] Small UIs fixes Improve certain requests in Sunstone which worked but were malformed. Fix dashboard links in SelfService. Increase menu column size. Fix vm show for machines with no history (not deployed). (cherry picked from commit 195c22b1691a86dcffe2caa7317c318d2bb7c1cd) --- src/cloud/occi/lib/ui/public/js/layout.js | 2 +- .../lib/ui/public/js/plugins/dashboard.js | 8 ++++---- .../public/js/plugins/datastores-tab.js | 4 ---- src/sunstone/public/js/plugins/images-tab.js | 5 +++-- .../public/js/plugins/templates-tab.js | 2 +- src/sunstone/public/js/plugins/users-tab.js | 4 ++-- src/sunstone/public/js/plugins/vms-tab.js | 19 ++++++++++--------- src/sunstone/public/js/plugins/vnets-tab.js | 2 +- 8 files changed, 22 insertions(+), 24 deletions(-) diff --git a/src/cloud/occi/lib/ui/public/js/layout.js b/src/cloud/occi/lib/ui/public/js/layout.js index 2fee0f93e9..62bad60e5e 100644 --- a/src/cloud/occi/lib/ui/public/js/layout.js +++ b/src/cloud/occi/lib/ui/public/js/layout.js @@ -133,7 +133,7 @@ $(document).ready(function () { applyDefaultStyles: false , center__paneSelector: ".outer-center" , west__paneSelector: ".outer-west" - , west__size: 133 + , west__size: 160 , north__size: 26 , south__size: 26 , spacing_open: 0 // ALL panes diff --git a/src/cloud/occi/lib/ui/public/js/plugins/dashboard.js b/src/cloud/occi/lib/ui/public/js/plugins/dashboard.js index 47b53d6278..960f93d49c 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/dashboard.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/dashboard.js @@ -149,14 +149,14 @@ $(document).ready(function(){ }); $('.tab_link').click(function(){ - var to= $(this).attr('href'); - $('.outer-west ul li.topTab a[href="'+to+'"]').trigger("click"); + var to= $(this).attr('href').slice(1); + $('.outer-west ul li#li_'+to).trigger("click"); return false; }); $('.action_link').click(function(){ - var to= $(this).attr('href'); - $('.outer-west ul li.topTab a[href="'+to+'"]').trigger("click"); + var to= $(this).attr('href').slice(1); + $('.outer-west ul li#li_'+to).trigger("click"); var action = $(this).attr('action'); Sunstone.runAction(action); diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index adf2ac61dc..f240864740 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -331,10 +331,6 @@ function datastoreElements() { return getSelectedNodes(dataTable_datastores); } -function vmShow(req) { - Sunstone.runAction("Datastore.show",req.request.data[0]); -} - function datastoreElementArray(element_json){ var element = element_json.DATASTORE; diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 8ba9bc5005..1c4b0e9516 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -415,7 +415,7 @@ var image_actions = { type: "single", call: OpenNebula.Image.chtype, callback: function (req) { - Sunstone.runAction("Image.show",req.request.data[0]); + Sunstone.runAction("Image.show",req.request.data[0][0]); }, elements: imageElements, error: onError, @@ -804,6 +804,7 @@ function setupCreateImageDialog(){ action: 'upload', multiple: false, params: {}, + sizeLimit: 0, showMessage: function(message){ //notifyMessage(message); }, @@ -813,7 +814,7 @@ function setupCreateImageDialog(){ file: fileName }); var pos_top = $(window).height() - 120; - var pos_left = 140; + var pos_left = 190; var pb_dialog = $('
'+ '
'+ diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index e56070b9c9..7bede7344b 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -839,7 +839,7 @@ function templateElements(){ //Runs a show action on the template with from a prev request function templateShow(req){ - Sunstone.runAction("Template.show",req.request.data[0]); + Sunstone.runAction("Template.show",req.request.data[0][0]); } // Returns an array containing the values of the template_json and ready diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index 720c8d3a70..eecb866490 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -141,7 +141,7 @@ var user_actions = { type: "multiple", call: OpenNebula.User.chgrp, callback : function(req){ - Sunstone.runAction("User.show",req.request.data[0]); + Sunstone.runAction("User.show",req.request.data[0][0]); }, elements : userElements, error: onError, @@ -152,7 +152,7 @@ var user_actions = { type: "multiple", call: OpenNebula.User.chauth, callback : function(req){ - Sunstone.runAction("User.show",req.request.data[0]); + Sunstone.runAction("User.show",req.request.data[0][0]); }, elements: userElements, error: onError, diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index 0743c1208c..fbdc28b3ae 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -598,7 +598,7 @@ var vm_info_panel = { title: tr("History information"), content: "", } -} +}; var vms_tab = { title: tr("Virtual Machines"), @@ -606,7 +606,7 @@ var vms_tab = { buttons: vm_buttons, tabClass: 'subTab', parentTab: 'vres_tab' -} +}; Sunstone.addActions(vm_actions); Sunstone.addMainTab('vms_tab',vms_tab); @@ -615,11 +615,11 @@ Sunstone.addInfoPanel('vm_info_panel',vm_info_panel); function vmElements() { return getSelectedNodes(dataTable_vMachines); -} +}; function vmShow(req) { Sunstone.runAction("VM.show",req.request.data[0]); -} +}; // Returns a human readable running time for a VM function str_start_time(vm){ @@ -740,11 +740,12 @@ function generateHistoryTable(vm){ '; var history = []; - - if ($.isArray(vm.HISTORY_RECORDS.HISTORY)) - history = vm.HISTORY_RECORDS.HISTORY; - else if (vm.HISTORY_RECORDS.HISTORY.SEQ) - history = [vm.HISTORY_RECORDS.HISTORY]; + if (vm.HISTORY_RECORDS.HISTORY){ + if ($.isArray(vm.HISTORY_RECORDS.HISTORY)) + history = vm.HISTORY_RECORDS.HISTORY; + else if (vm.HISTORY_RECORDS.HISTORY.SEQ) + history = [vm.HISTORY_RECORDS.HISTORY]; + }; var now = Math.round(new Date().getTime() / 1000); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index f5047ebd87..4f88366054 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -473,7 +473,7 @@ function vnElements(){ } function vnShow(req){ - Sunstone.runAction("Network.show",req.request.data[0]); + Sunstone.runAction("Network.show",req.request.data[0][0]); } //returns an array with the VNET information fetched from the JSON object