diff --git a/src/cloud/occi/lib/ui/public/js/occi.js b/src/cloud/occi/lib/ui/public/js/occi.js index a841b00ded..829dff782c 100644 --- a/src/cloud/occi/lib/ui/public/js/occi.js +++ b/src/cloud/occi/lib/ui/public/js/occi.js @@ -161,7 +161,7 @@ var OCCI = { }); }, - "delete": function(params,resource){ + "del": function(params,resource){ var callback = params.success; var callback_error = params.error; var id = params.data.id; @@ -373,8 +373,8 @@ var OCCI = { "create": function(params){ OCCI.Action.create(params,OCCI.Network.resource); }, - "delete": function(params){ - OCCI.Action.delete(params,OCCI.Network.resource); + "del": function(params){ + OCCI.Action.del(params,OCCI.Network.resource); }, "list": function(params){ OCCI.Action.list(params,OCCI.Network.resource); @@ -398,8 +398,8 @@ var OCCI = { "create": function(params){ OCCI.Action.create(params,OCCI.VM.resource); }, - "delete": function(params){ - OCCI.Action.delete(params,OCCI.VM.resource); + "del": function(params){ + OCCI.Action.del(params,OCCI.VM.resource); }, "list": function(params){ OCCI.Action.list(params,OCCI.VM.resource); @@ -502,8 +502,8 @@ var OCCI = { } }); }, - "delete": function(params){ - OCCI.Action.delete(params,OCCI.Image.resource); + "del": function(params){ + OCCI.Action.del(params,OCCI.Image.resource); }, "list": function(params){ OCCI.Action.list(params,OCCI.Image.resource); @@ -535,8 +535,8 @@ var OCCI = { "create" : function(params){ OCCI.Action.create(params,OCCI.Template.resource); }, - "delete" : function(params){ - OCCI.Action.delete(params,OCCI.Template.resource); + "del" : function(params){ + OCCI.Action.del(params,OCCI.Template.resource); }, "list" : function(params){ OCCI.Action.list(params,OCCI.Template.resource); diff --git a/src/cloud/occi/lib/ui/public/js/plugins/network.js b/src/cloud/occi/lib/ui/public/js/plugins/network.js index 98853b4202..b909d84d68 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/network.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/network.js @@ -143,7 +143,7 @@ var vnet_actions = { "Network.delete" : { type: "multiple", - call: OCCI.Network.delete, + call: OCCI.Network.del, callback: deleteVNetworkElement, elements: vnElements, error: onError, diff --git a/src/cloud/occi/lib/ui/public/js/plugins/storage.js b/src/cloud/occi/lib/ui/public/js/plugins/storage.js index 336a51d272..d21f7b285a 100644 --- a/src/cloud/occi/lib/ui/public/js/plugins/storage.js +++ b/src/cloud/occi/lib/ui/public/js/plugins/storage.js @@ -199,7 +199,7 @@ var image_actions = { "Image.delete" : { type: "multiple", - call: OCCI.Image.delete, + call: OCCI.Image.del, callback: deleteImageElement, elements: imageElements, error: onError, diff --git a/src/ozones/Server/public/js/ozones.js b/src/ozones/Server/public/js/ozones.js index b306ac74a2..414e4e687a 100644 --- a/src/ozones/Server/public/js/ozones.js +++ b/src/ozones/Server/public/js/ozones.js @@ -223,7 +223,7 @@ var oZones = { }); }, - "delete": function(params,resource){ + "del": function(params,resource){ var callback = params.success; var callback_error = params.error; var id = params.data.id; @@ -381,8 +381,8 @@ var oZones = { "create": function(params){ oZones.Action.create(params,oZones.Zone.resource); }, - "delete" : function(params){ - oZones.Action.delete(params,oZones.Zone.resource); + "del" : function(params){ + oZones.Action.del(params,oZones.Zone.resource); }, "list": function(params){ oZones.Action.list(params,oZones.Zone.resource); @@ -446,8 +446,8 @@ var oZones = { "update": function(params){ oZones.Action.update(params,oZones.VDC.resource); }, - "delete": function(params){ - oZones.Action.delete(params,oZones.VDC.resource); + "del": function(params){ + oZones.Action.del(params,oZones.VDC.resource); }, "list": function(params){ oZones.Action.list(params,oZones.VDC.resource); diff --git a/src/ozones/Server/public/js/plugins/vdcs-tab.js b/src/ozones/Server/public/js/plugins/vdcs-tab.js index 4a4f8cbb1f..dd25dd8b27 100644 --- a/src/ozones/Server/public/js/plugins/vdcs-tab.js +++ b/src/ozones/Server/public/js/plugins/vdcs-tab.js @@ -155,7 +155,7 @@ var vdc_actions = { "VDC.delete" : { type: "multiple", - call: oZones.VDC.delete, + call: oZones.VDC.del, callback: deleteVDCElement, elements: vdcSelectedNodes, error: onError, diff --git a/src/ozones/Server/public/js/plugins/zones-tab.js b/src/ozones/Server/public/js/plugins/zones-tab.js index d7430e75ad..00ab69e0c7 100644 --- a/src/ozones/Server/public/js/plugins/zones-tab.js +++ b/src/ozones/Server/public/js/plugins/zones-tab.js @@ -118,7 +118,7 @@ var zone_actions = { "Zone.delete" : { type: "multiple", - call: oZones.Zone.delete, + call: oZones.Zone.del, callback: deleteZoneElement, elements: zoneSelectedNodes, error: onError, diff --git a/src/sunstone/etc/sunstone-plugins.yaml b/src/sunstone/etc/sunstone-plugins.yaml index bc724898ba..edde7af592 100644 --- a/src/sunstone/etc/sunstone-plugins.yaml +++ b/src/sunstone/etc/sunstone-plugins.yaml @@ -53,11 +53,15 @@ :ALL: true :user: :group: -- plugins/hosts-tab.js: +- plugins/clusters-tab.js: :ALL: false :user: :group: oneadmin: true +- plugins/hosts-tab.js: + :ALL: true + :user: + :group: - plugins/datastores-tab.js: :ALL: true :user: @@ -66,8 +70,3 @@ :ALL: true :user: :group: -- plugins/clusters-tab.js: - :ALL: false - :user: - :group: - oneadmin: true diff --git a/src/sunstone/models/SunstoneServer.rb b/src/sunstone/models/SunstoneServer.rb index 2739d9b2b4..ce5f2ad644 100644 --- a/src/sunstone/models/SunstoneServer.rb +++ b/src/sunstone/models/SunstoneServer.rb @@ -198,7 +198,7 @@ class SunstoneServer < CloudServer end ############################################################################ - # + # Unused ############################################################################ def get_vm_log(id) resource = retrieve_resource("vm", id) diff --git a/src/sunstone/public/js/opennebula.js b/src/sunstone/public/js/opennebula.js index eb4f149d30..a69f0e9809 100644 --- a/src/sunstone/public/js/opennebula.js +++ b/src/sunstone/public/js/opennebula.js @@ -46,21 +46,24 @@ var OpenNebula = { { switch(type) { - case "HOST","host": + case "HOST": + case "host": return ["INIT", "MONITORING", "MONITORED", "ERROR", "DISABLED"][value]; break; - case "HOST_SIMPLE","host_simple": + case "HOST_SIMPLE": + case "host_simple": return ["ON", "ON", "ON", "ERROR", "OFF"][value]; break; - case "VM","vm": + case "VM": + case "vm": return ["INIT", "PENDING", "HOLD", @@ -70,7 +73,8 @@ var OpenNebula = { "DONE", "FAILED"][value]; break; - case "VM_LCM","vm_lcm": + case "VM_LCM": + case "vm_lcm": return ["LCM_INIT", "PROLOG", "BOOT", @@ -89,7 +93,8 @@ var OpenNebula = { "CLEANUP", "UNKNOWN"][value]; break; - case "IMAGE","image": + case "IMAGE": + case "image": return ["INIT", "READY", "USED", @@ -97,6 +102,14 @@ var OpenNebula = { "LOCKED", "ERROR"][value]; break; + case "VM_MIGRATE_REASON": + case "vm_migrate_reason": + return ["NONE", + "ERROR", + "STOP_RESUME", + "USER", + "CANCEL"][value]; + break; default: return; } @@ -203,7 +216,7 @@ var OpenNebula = { }); }, - "delete": function(params,resource){ + "del": function(params,resource){ var callback = params.success; var callback_error = params.error; var id = params.data.id; @@ -437,8 +450,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Host.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Host.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Host.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Host.resource); @@ -476,8 +489,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Network.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Network.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Network.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Network.resource); @@ -550,8 +563,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.VM.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.VM.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.VM.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.VM.resource); @@ -668,8 +681,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Group.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Group.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Group.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Group.resource); @@ -682,8 +695,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.User.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.User.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.User.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.User.resource); @@ -734,8 +747,8 @@ var OpenNebula = { "create": function(params){ OpenNebula.Action.create(params,OpenNebula.Image.resource); }, - "delete": function(params){ - OpenNebula.Action.delete(params,OpenNebula.Image.resource); + "del": function(params){ + OpenNebula.Action.del(params,OpenNebula.Image.resource); }, "list": function(params){ OpenNebula.Action.list(params,OpenNebula.Image.resource); @@ -793,8 +806,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Template.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Template.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Template.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Template.resource); @@ -846,8 +859,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Acl.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Acl.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Acl.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Acl.resource); @@ -860,8 +873,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Cluster.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Cluster.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Cluster.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Cluster.resource); @@ -906,8 +919,8 @@ var OpenNebula = { "create" : function(params){ OpenNebula.Action.create(params,OpenNebula.Datastore.resource); }, - "delete" : function(params){ - OpenNebula.Action.delete(params,OpenNebula.Datastore.resource); + "del" : function(params){ + OpenNebula.Action.del(params,OpenNebula.Datastore.resource); }, "list" : function(params){ OpenNebula.Action.list(params,OpenNebula.Datastore.resource); diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 6a78b08d4f..98045c0e7c 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -129,7 +129,7 @@ var acl_actions = { "Acl.delete" : { type: "multiple", - call: OpenNebula.Acl.delete, + call: OpenNebula.Acl.del, callback: deleteAclElement, elements: aclElements, error: onError, diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index b0cccd6aaa..7cb41a21cd 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -166,7 +166,7 @@ var cluster_actions = { "Cluster.delete" : { type: "multiple", - call : OpenNebula.Cluster.delete, + call : OpenNebula.Cluster.del, callback : deleteClusterElement, elements: clusterElements, error : onError, @@ -366,7 +366,82 @@ function clusterTabContent(cluster_json) { vnets_list = '
  • '+cluster.VNETS.ID+' - '+getVNetName(cluster.VNETS.ID)+'
  • '; */ + //special case for cluster none, simplified dashboard + if (cluster.ID == "-"){ + var html_code = '\ +\ +\ +\ +\ +
    \ +\ + \ + \ + \ + \ + \ + \ +
    \ +
    \ +

    ' + tr("Cluster information") + '

    \ +
    \ +\ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
    ' + tr("ID") + ''+cluster.ID+'
    ' + tr("Name") + ''+cluster.NAME+'
    \ +\ +
    \ +
    \ +
    \ +
    \ +

    ' + tr("Hosts") + '

    \ + \ +
    \ +
    \ +\ + \ + \ + \ + \ + \ + \ +
    \ +
    \ +

    ' + tr("Datastores") + '

    \ + \ +
    \ +
    \ +
    \ +

    ' + tr("Virtual Networks") + '

    \ + \ +
    \ +
    \ +
    \ +'; + return html_code; + }; + //end cluster none special html var html_code = '\ \ @@ -453,7 +528,7 @@ function removeClusterMenus(){ // Sunstone.removeMainTab('cluster_vnets_tab_n',true); // Sunstone.removeMainTab('cluster_datastores_tab_n',true); // Sunstone.removeMainTab('cluster_hosts_tab_n',true); - Sunstone.removeMainTab('cluster_tab_n',true); + Sunstone.removeMainTab('cluster_tab_-',true); for (var i=0; i < data.length; i++){ var id = data[i][1]; diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 854bbba145..adf2ac61dc 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -207,7 +207,7 @@ var datastore_actions = { "Datastore.delete" : { type: "multiple", - call : OpenNebula.Datastore.delete, + call : OpenNebula.Datastore.del, callback : deleteDatastoreElement, elements: datastoreElements, error : onError, @@ -271,7 +271,8 @@ var datastore_buttons = { "Datastore.update_dialog" : { type: "action", text: tr("Update properties"), - alwaysActive: true + alwaysActive: true, + condition: mustBeAdmin, }, "Datastore.addtocluster" : { type: "confirm_with_select", @@ -296,7 +297,8 @@ var datastore_buttons = { }, "Datastore.delete" : { type: "confirm", - text: tr("Delete") + text: tr("Delete"), + condition: mustBeAdmin } } @@ -443,7 +445,7 @@ function updateDatastoreInfo(request,ds){ \ \ \ - \ + \ \ \ \ diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index bd267b42e7..b1b112a309 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -97,7 +97,7 @@ var group_actions = { "Group.delete" : { type: "multiple", - call : OpenNebula.Group.delete, + call : OpenNebula.Group.del, callback : deleteGroupElement, error : onError, elements: groupElements, diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 0abc980a5b..7dd75732b5 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -189,7 +189,7 @@ var host_actions = { "Host.delete" : { type: "multiple", - call : OpenNebula.Host.delete, + call : OpenNebula.Host.del, callback : deleteHostElement, elements: hostElements, error : onError, @@ -271,30 +271,36 @@ var host_buttons = { }, "Host.create_dialog" : { type: "create_dialog", - text: tr("+ New") + text: tr("+ New"), + condition: mustBeAdmin }, "Host.update_dialog" : { type: "action", text: tr("Update a template"), - alwaysActive: true + alwaysActive: true, + condition: mustBeAdmin }, "Host.addtocluster" : { type: "confirm_with_select", text: tr("Select cluster"), select: clusters_sel, tip: tr("Select the destination cluster:"), + condition: mustBeAdmin }, "Host.enable" : { type: "action", - text: tr("Enable") + text: tr("Enable"), + condition: mustBeAdmin }, "Host.disable" : { type: "action", - text: tr("Disable") + text: tr("Disable"), + condition: mustBeAdmin }, "Host.delete" : { type: "confirm", - text: tr("Delete host") + text: tr("Delete host"), + condition: mustBeAdmin } }; @@ -475,7 +481,7 @@ function updateHostInfo(request,host){ \ \ \ - \ + \ \ \ \ @@ -493,10 +499,6 @@ function updateHostInfo(request,host){ \ \ \ - \ - \ - \ - \ \
    '+tr("Cluster")+''+(element.CLUSTER.length ? element.CLUSTER : "-")+''+(info.CLUSTER.length ? info.CLUSTER : "-")+'
    '+tr("DS Mad")+'
    ' + tr("Cluster") + ''+(host.CLUSTER.length ? host.CLUSTER : "-")+''+(host_info.CLUSTER.length ? host_info.CLUSTER : "-")+'
    ' + tr("State") + ''+ tr("VN MAD") +''+host_info.VN_MAD+'
    '+ tr("TM MAD") +''+host_info.TM_MAD+'
    \ \ diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 52af42ef20..8ba9bc5005 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -374,7 +374,7 @@ var image_actions = { "Image.delete" : { type: "multiple", - call: OpenNebula.Image.delete, + call: OpenNebula.Image.del, callback: deleteImageElement, elements: imageElements, error: onError, diff --git a/src/sunstone/public/js/plugins/infra-tab.js b/src/sunstone/public/js/plugins/infra-tab.js index 49e3782ed7..0b52418572 100644 --- a/src/sunstone/public/js/plugins/infra-tab.js +++ b/src/sunstone/public/js/plugins/infra-tab.js @@ -15,7 +15,7 @@ /* -------------------------------------------------------------------------- */ var infra_tab_content = -'
    \ +'
    \ \ \ \
    \ \ @@ -26,7 +26,7 @@ var infra_tab_content =
    \ \
    \ - \ + \ \ \ \ @@ -54,7 +54,7 @@ var infra_tab_content =

    ' + tr("Quickstart") + '

    \
    \


    \ - '+tr("Create new Cluster")+'
    \ + '+tr("Create new Cluster")+'
    \ '+tr("Create new Host")+'
    \ '+tr("Create new Datastore")+'
    \ '+tr("Create new Virtual Network")+'
    \ @@ -72,7 +72,7 @@ var infra_tab_content =

    \

    ' + tr("Infrastructure resources") + '

    \
    \ -

    '+tr("The Infrastructure menu allows management of Hosts, Datastores, Virtual Networks and the Clusters they are placed in. The Clusters node can be expanded, and resources can be managed for each cluster.")+'

    \ +

    '+tr("The Infrastructure menu allows management of Hosts, Datastores, Virtual Networks. Users in the oneadmin group can manage clusters as well.")+'

    \

    '+tr("You can find further information on the following links:")+'

    \
      \
    • Host subsystem
    • \ @@ -117,5 +117,6 @@ function updateInfraDashboard(what,json_info){ }; $(document).ready(function(){ - + if (!mustBeAdmin()) + $('table#infra_dashboard .cluster_related', main_tabs_context).hide(); }); \ No newline at end of file diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index f7496b0892..e56070b9c9 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -186,7 +186,7 @@ var create_template_tmpl = '
      \

      '+tr("Add disks/images")+'

      \
      \
      '+tr("Disks")+'\ -
      \ +
    \ \ \ + \ \ \ \ @@ -353,7 +354,7 @@ var vm_actions = { "VM.delete" : { type: "multiple", - call: OpenNebula.VM.delete, + call: OpenNebula.VM.del, callback: deleteVMachineElement, elements: vmElements, error: onError, @@ -592,6 +593,10 @@ var vm_info_panel = { "vm_log_tab" : { title: tr("VM log"), content: "" + }, + "vm_history_tab" : { + title: tr("History information"), + content: "", } } @@ -619,7 +624,21 @@ function vmShow(req) { // Returns a human readable running time for a VM function str_start_time(vm){ return pretty_time(vm.STIME); -} +}; + +function ip_str(vm){ + var nic = vm.TEMPLATE.NIC; + var ip = '--'; + if ($.isArray(nic)) { + ip = ''; + $.each(nic, function(index,value){ + ip += value.IP+'
    '; + }); + } else if (nic && nic.IP) { + ip = nic.IP; + }; + return ip; +}; // Returns an array formed by the information contained in the vm_json // and ready to be introduced in a dataTable @@ -650,10 +669,11 @@ function vMachineElementArray(vm_json){ vm.CPU, humanize_size(vm.MEMORY), hostname, + ip_str(vm), str_start_time(vm), vncIcon(vm) ]; -} +}; //Creates a listener for the TDs of the VM table @@ -703,7 +723,69 @@ function updateVMachinesView(request, vmachine_list){ updateView(vmachine_list_array,dataTable_vMachines); updateDashboard("vms",vmachine_list); updateVResDashboard("vms",vmachine_list); -} +}; + +function generateHistoryTable(vm){ + var html = '
    '+tr("CPU")+''+tr("Memory")+''+tr("Hostname")+''+tr("IPs")+''+tr("Start Time")+''+tr("VNC Access")+'
    \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + '; + + 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]; + + var now = Math.round(new Date().getTime() / 1000); + + for (var i=0; i < history.length; i++){ + // :TIME time calculations copied from onevm_helper.rb + var stime = parseInt(history[i].STIME, 10); + + var etime = parseInt(history[i].ETIME, 10) + etime = etime == 0 ? now : etime; + + var dtime = etime - stime; + // end :TIME + + //:PTIME + var stime2 = parseInt(history[i].PSTIME, 10); + var etime2; + var ptime2 = parseInt(history[i].PETIME, 10); + if (stime2 == 0) + etime2 = 0; + else + etime2 = ptime2 == 0 ? now : ptime2; + var dtime2 = etime2 - stime2; + + //end :PTIME + + + html += ' \ + \ + \ + \ + \ + \ + \ + \ + ' + }; + html += '\ +
    '+tr("Sequence")+''+tr("Hostname")+''+tr("Reason")+''+tr("State change time")+''+tr("Total time")+''+tr("Prolog time")+'
    '+history[i].SEQ+''+history[i].HOSTNAME+''+OpenNebula.Helper.resource_state("VM_MIGRATE_REASON",parseInt(history[i].REASON, 10))+''+pretty_time(history[i].STIME)+''+pretty_time_runtime(dtime)+''+pretty_time_runtime(dtime2)+'
    '; + return html; + +}; // Refreshes the information panel for a VM @@ -805,7 +887,7 @@ function updateVMInfo(request,vm){
    ' - } + }; var template_tab = { title: tr("VM Template"), @@ -814,21 +896,27 @@ function updateVMInfo(request,vm){ '+tr("VM template")+''+ prettyPrintJSON(vm_info.TEMPLATE)+ '' - } + }; var log_tab = { title: tr("VM log"), content: '
    '+spinner+'
    ' - } + }; var monitoring_tab = { title: tr("Monitoring information"), content: generateMonitoringDivs(vm_graphs,"vm_monitor_") - } + }; + + var history_tab = { + title: tr("History information"), + content: generateHistoryTable(vm_info), + }; Sunstone.updateInfoPanelTab("vm_info_panel","vm_info_tab",info_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_template_tab",template_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_log_tab",log_tab); + Sunstone.updateInfoPanelTab("vm_info_panel","vm_history_tab",history_tab); Sunstone.updateInfoPanelTab("vm_info_panel","vm_monitoring_tab",monitoring_tab); //Pop up the info panel and asynchronously get vm_log and stats @@ -1284,9 +1372,9 @@ $(document).ready(function(){ "aoColumnDefs": [ { "bSortable": false, "aTargets": ["check"] }, { "sWidth": "60px", "aTargets": [0,6,7] }, - { "sWidth": "35px", "aTargets": [1,10] }, - { "sWidth": "150px", "aTargets": [5,9] }, - { "sWidth": "100px", "aTargets": [2,3] } + { "sWidth": "35px", "aTargets": [1,11] }, + { "sWidth": "150px", "aTargets": [5,10] }, + { "sWidth": "100px", "aTargets": [2,3,9] } ], "oLanguage": (datatable_lang != "") ? { @@ -1297,7 +1385,7 @@ $(document).ready(function(){ dataTable_vMachines.fnClearTable(); addElement([ spinner, - '','','','','','','','','',''],dataTable_vMachines); + '','','','','','','','','','',''],dataTable_vMachines); Sunstone.runAction("VM.list"); setupCreateVMDialog(); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index d65f672ebe..f5047ebd87 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -283,7 +283,7 @@ var vnet_actions = { "Network.delete" : { type: "multiple", - call: OpenNebula.Network.delete, + call: OpenNebula.Network.del, callback: deleteVNetworkElement, elements: vnElements, error: onError, @@ -566,7 +566,7 @@ function updateVNetworkInfo(request,vn){ \ \ '+tr("Cluster")+'\ - '+(network.CLUSTER.length ? network.CLUSTER : "-")+'\ + '+(vn_info.CLUSTER.length ? vn_info.CLUSTER : "-")+'\ \ \ '+tr("Owner")+'\ diff --git a/src/sunstone/public/js/sunstone-util.js b/src/sunstone/public/js/sunstone-util.js index 22064569de..7877635b51 100644 --- a/src/sunstone/public/js/sunstone-util.js +++ b/src/sunstone/public/js/sunstone-util.js @@ -60,6 +60,20 @@ function pretty_time_axis(time){ return hour + ":" + mins + ":" + secs;// + " " + month + "/" + day; } +function pretty_time_runtime(time){ + var d = new Date(); + d.setTime(time*1000); + + var secs = pad(d.getUTCSeconds(),2); + var hour = pad(d.getUTCHours(),2); + var mins = pad(d.getUTCMinutes(),2); + var day = d.getUTCDate()-1; + var month = pad(d.getUTCMonth()+1,2); //getMonths returns 0-11 + var year = d.getUTCFullYear(); + + return day + "d " + hour + ":" + mins;// + ":" + secs;// + " " + month + "/" + day; +} + //returns a human readable size in Kilo, Mega, Giga or Tera bytes function humanize_size(value) { if (typeof(value) === "undefined") { diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index df9659a96c..20e82c3909 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -465,7 +465,19 @@ function insertTab(tab_name){ $('div#'+tab_name,main_tabs_context).html(tab_info.content); - $('div#menu ul#navigation').append('
  • '+tab_info.title+'
  • '); + var li_item = '
  • '+tab_info.title+'
  • '; + + //if this is a submenu... + if (parent.length) { + var children = $('div#menu ul#navigation li.'+parent); + //if there are other submenus, insert after last of them + if (children.length) + $(children[children.length-1]).after(li_item); + else //instert after parent menu + $('div#menu ul#navigation li#li_'+parent).after(li_item); + } else { //not a submenu, instert in the end + $('div#menu ul#navigation').append(li_item); + }; if (parent){ //this is a subtab $('div#menu li#li_'+tab_name).hide();//hide by default