diff --git a/src/sunstone/public/js/plugins/dashboard-tab.js b/src/sunstone/public/js/plugins/dashboard-tab.js index aae302f487..016dc097a9 100644 --- a/src/sunstone/public/js/plugins/dashboard-tab.js +++ b/src/sunstone/public/js/plugins/dashboard-tab.js @@ -149,7 +149,7 @@ var dashboard_tab_content = '; -Sunstone.addMainTab('Dashboard',dashboard_tab_content,null,'dashboard_tab'); +Sunstone.addMainTab('dashboard_tab','Dashboard',dashboard_tab_content,null); $(document).ready(function(){ //Dashboard link listener diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 4f1dfa918b..558bcc0486 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -119,13 +119,14 @@ var host_actions = { call: popUpCreateHostDialog }, - "Host.list" : { - type: "list", - call: OpenNebula.Host.list, - callback: updateHostsView, - error: onError, - notify:False - }, + //Custom below + //~ "Host.list" : { + //~ type: "list", + //~ call: OpenNebula.Host.list, + //~ callback: updateHostsView, + //~ error: onError, + //~ notify:False + //~ }, "Host.show" : { type: "single", @@ -157,7 +158,9 @@ var host_actions = { "Host.enable" : { type: "multiple", call : OpenNebula.Host.enable, - callback : host_update_callback, + callback : function (req) { + Sunstone.runAction("Host.show",req.request.data[0]); + }, dataTable: function() { return dataTable_hosts }, error : onError, notify:True, @@ -166,7 +169,9 @@ var host_actions = { "Host.disable" : { type: "multiple", call : OpenNebula.Host.disable, - callback : host_update_callback, + callback : function (req) { + Sunstone.runAction("Host.show",req.request.data[0]); + }, dataTable: function() { return dataTable_hosts }, error : onError, notify:True, @@ -247,7 +252,6 @@ var host_actions = { } }; - var host_buttons = { "Host.refresh" : { type: "image", @@ -257,7 +261,7 @@ var host_buttons = { }, "Host.create_dialog" : { type: "create_dialog", - text: "+ New host", + text: "+ New", condition :True }, "Host.enable" : { @@ -266,9 +270,8 @@ var host_buttons = { condition : True }, "Host.disable" : { - type: "confirm", + type: "action", text: "Disable", - tip: "This will disable the selected hosts.", condition : True }, "Cluster.create_dialog" : { @@ -295,7 +298,6 @@ var host_buttons = { "Cluster.removehost" : { type: "action", text: "Remove host from cluster", - value: "Cluster.removehost", condition: True }}, condition : True @@ -324,15 +326,10 @@ for (action in host_actions){ } // title, content, buttons, id -Sunstone.addMainTab('Hosts',hosts_tab_content,host_buttons,'hosts_tab'); +Sunstone.addMainTab('hosts_tab','Hosts',hosts_tab_content,host_buttons); Sunstone.addInfoPanel("host_info_panel",host_info_panel); -//Plugin functions -function host_update_callback(req){ - OpenNebula.Host.show({data:{id:req.request.data[0]},success: updateHostElement,error: onError}); -} - function hostElementArray(host_json){ host = host_json.HOST; acpu = parseInt(host.HOST_SHARE.MAX_CPU); @@ -382,18 +379,6 @@ function hostElementArray(host_json){ pb_mem, OpenNebula.Helper.resource_state("host",host.STATE) ]; - - //~ return [ '', - //~ host.ID, - //~ host.NAME, - //~ host.CLUSTER, - //~ host.HOST_SHARE.RUNNING_VMS, //rvm - //~ host.HOST_SHARE.MAX_CPU, //tcpu - //~ parseInt(host.HOST_SHARE.MAX_CPU) - parseInt(host.HOST_SHARE.USED_CPU), //fcpu - //~ acpu, - //~ humanize_size(host.HOST_SHARE.MAX_MEM), - //~ humanize_size(host.HOST_SHARE.FREE_MEM), - //~ OpenNebula.Helper.resource_state("host",host.STATE) ]; } @@ -557,9 +542,9 @@ function updateHostInfo(request,host){ '' } - Sunstone.updateInfoTab("host_info_panel","info_host_tab",info_host_tab); - Sunstone.updateInfoTab("host_info_panel","host_template_tab",host_template_tab); - popDialog(Sunstone.getInfoPanelHTML("host_info_panel")); + Sunstone.updateInfoPanelTab("host_info_panel","info_host_tab",info_host_tab); + Sunstone.updateInfoPanelTab("host_info_panel","host_template_tab",host_template_tab); + Sunstone.popUpInfoPanel("host_info_panel"); } diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js new file mode 100644 index 0000000000..f1acb2dffc --- /dev/null +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -0,0 +1,389 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +/*Images tab plugin*/ + +var images_tab_content = +'
'; + +var create_image_tmpl = +''; + +var images_select = ""; +var image_list_json = {}; +var dataTable_images; + +var image_actions = { + + "Image.create" : { + type: "create", + call: OpenNebula.Image.create, + callback: addImageElement, + error: onError, + notify: False, + }, + + "Image.create_dialog" : { + type: "custom", + call: popUpCreateImageDialog + }, + + "Image.list" : { + type: "list", + call: OpenNebula.Image.list, + callback: updateImagesView, + error: onError, + notify: False + }, + + "Image.show" : { + type : "single", + call: OpenNebula.Image.show, + callback: updateImageElement, + error: onError, + notify: False + }, + + "Image.showinfo" : { + type: "single", + call: OpenNebula.Image.show, + callback: updateImageInfo, + error: onError, + notify : False + }, + + "Image.refresh" : { + type: "custom", + call: function () { + waitingNodes(dataTable_images); + Sunstone.runAction("Image.list"); + }, + notify: False + }, + + "Image.addattr" : { + type: "multiple", + call: OpenNebula.Image.addattr, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.addattr_dialog" : { + type: "custom", + call: popUpImageAddattrDialog + }, + + "Image.rmattr" : { + type: "multiple", + call: OpenNebula.Image.rmattr, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.rmattr_dialog" : { + type: "custom" + call: popUpImageRmattrDialog, + notify: False + }, + + "Image.enable" : { + type: "multiple", + call: OpenNebula.Image.enable, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.disable" : { + type: "multiple", + call: OpenNebula.Image.disable, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.persistent" : { + type: "multiple", + call: OpenNebula.Image.persistent, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.nonpersistent" : { + type: "multiple", + call: OpenNebula.Image.nonpersistent, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.publish" : { + type: "multiple", + call: OpenNebula.Image.publish, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.unpublish" : { + type: "multiple", + call: OpenNebula.Image.unpublish, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + }, + + "Image.delete" : { + type: "multiple", + call: OpenNebula.Image.delete, + callback: function (req) { + Sunstone.runAction("Image.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_images}, + error: onError, + notify: False + } +} + + +var image_buttons = { + "Image.refresh" : { + type: "image", + text: "Refresh list", + img: "/images/Refresh-icon.png", + condition: True + }, + "Image.create_dialog" : { + type: "create_dialog", + text: "+ New", + condition: True + }, + "Image.addattr_dialog" : { + type: "action", + text: "Add attribute", + condition: True + }, + "Image.addattr_dialog" : { + type: "action", + text: "Update attribute", + condition: True + }, + "Image.rmattr_dialog:" : { + type: "action", + text: "Remove attribute", + condition: True + }, + "action_list" : { + type: "select", + condition: True, + actions: { + "Image.enable" : { + type: "action", + text: "Enable", + condition: True + }, + "Image.disable" : { + type: "action", + text: "Disable", + condition: True + }, + "Image.publish" : { + type: "action", + text: "Publish", + condition: True + }, + "Image.unpublish" : { + type: "action", + text: "Unpublish", + condition: True + }, + "Image.persistent" : { + type: "action", + text: "Make persistent", + condition: True + }, + "Image.nonpersistent" : { + type: "action", + text: "Make non persistent", + condition: True + } + } + }, + "Image.delete" : { + type: "action", + text: "Delete", + condition: True + } +} diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js new file mode 100644 index 0000000000..23c7814ccb --- /dev/null +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -0,0 +1,114 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +/*Users tab plugin*/ + +var users_tab_content = +''; + +var create_user_tmpl = +''; + +var user_list_json = {}; +var dataTable_users; + +var user_actions = { + "User.create" : { + type: "create", + call: OpenNebula.User.create, + callback: addUserElement, + error: onError, + notify: False + }, + + "User.create_dialog" : { + type: "custom", + call: popUpCreateUserDialog + }, + + "User.list" : { + type: "list", + call: OpenNebula.User.list + callback: updateUsersView, + error: onError, + notify: False + }, + + "User.refresh" : { + type: "custom", + call: function () { + waitingNodes(dataTable_users); + Sunstone.runAction("User.list"); + } + }, + + "User.delete" : { + type: "multiple", + call: OpenNebula.User.delete, + callback: deleteUserElement, + dataTable: function(){return dataTable_users}, + error: onError, + notify: False + }, +} + +var user_buttons = { + "User.refresh" : { + type: "image", + text: "Refresh list", + img: "/images/Refresh-icon.png", + condition: True + }, + "User.create_dialog" : { + type: "create_dialog", + text: "+ New", + condition: True + }, + "User.delete" : { + type: "action", + text: "Delete", + condition: True + } +} diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js new file mode 100644 index 0000000000..f9cf3a7ef3 --- /dev/null +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -0,0 +1,776 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +/*Virtual Machines tab plugin*/ + +var vms_tab_content = +''; + +var create_vm_tmpl = +''; + +var vmachine_list_json = {}; +var dataTable_vMachines; + +var vm_actions = { + "VM.create" : { + type: "create", + call: OpenNebula.VM.create, + callback: addVMachineElement, + error: onError, + notify: False + }, + + "VM.create_dialog" : { + type: "custom" + call: popUpCreateVMDialog, + }, + + "VM.list" : { + type: "list" + call: OpenNebula.VM.list, + callback: updateVMachinesView, + error: onError, + notify: False + }, + + "VM.show" : { + type: "single", + call: OpenNebula.VM.show, + callback: updateVMachineElement, + error: onError, + notify: False + }, + + "VM.showinfo" : { + type: "single", + call: OpenNebula.VM.show, + callback: updateVMInfo, + error: onError, + notify: False + }, + + "VM.refresh" : { + type: "custom", + call : function (){ + waitingNodes(dataTable_vMachines); + Sunstone.runAction("VM.list"); + }, + notify: False + }, + + "VM.deploy" : { + type: "multiple", + call: OpenNebula.VM.deploy, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.migrate" : { + type: "multiple", + call: OpenNebula.VM.migrate, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.livemigrate" : { + type: "multiple", + call: OpenNebula.VM.livemigrate, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.hold" : { + type: "multiple", + call: OpenNebula.VM.hold, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.release" : { + type: "multiple", + call: OpenNebula.VM.release, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.suspend" : { + type: "multiple", + call: OpenNebula.VM.suspend, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.resume" : { + type: "multiple", + call: OpenNebula.VM.resume, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.stop" : { + type: "multiple", + call: OpenNebula.VM.stop, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.restart" : { + type: "multiple", + call: OpenNebula.VM.restart, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.shutdown" : { + type: "multiple", + call: OpenNebula.VM.shutdown, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.cancel" : { + type: "multiple", + call: OpenNebula.VM.cancel, + callback: function (req) { + Sunstone.runAction("VM.show",req.request.data[0]); + }, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + }, + + "VM.delete" : { + type: "multiple", + call: OpenNebula.VM.delete, + callback: deleteVMachineElement, + dataTable: function(){return dataTable_vMachines}, + error: onError, + notify: False + } +} + + + + + +var vm_buttons = { + "VM.refresh" : { + type: "image", + text: "Refresh list", + img: "/images/Refresh-icon.png", + condition: True + }, + + "VM.create_dialog" : { + type: "create_dialog", + text: "+ New", + condition: True + }, + + "VM.shutdown" : { + type: "confirm", + text: "Shutdown", + tip: "This will initiate the shutdown process in the selected VMs", + condition: True + }, + + "action_list" : { + type: "select", + actions: { + "VM.deploy" : { + type: "confirm_with_select", + text: "Deploy", + tip: "This will deploy the selected VMs on the chosen host", + select: function(){ + if (hosts_select){return hosts_select} + else {return ""} + }, + condition: True + }, + "VM.migrate" : { + type: "confirm_with_select", + text: "Migrate", + tip: "This will migrate the selected VMs to the chosen host", + select: function(){ + if (hosts_select){return hosts_select} + else {return ""} + }, + condition: True + + }, + "VM.livemigrate" : { + type: "confirm_with_select", + text: "Live migrate", + tip: "This will live-migrate the selected VMs to the chosen host", + select: function(){ + if (hosts_select){return hosts_select} + else {return ""} + }, + condition: True + }, + "VM.hold" : { + type: "confirm", + text: "Hold", + tip: "This will hold selected pending VMs from being deployed", + condition: True + }, + "VM.release" : { + type: "confirm", + text: "Release", + tip: "This will release held machines", + condition: True + }, + "VM.suspend" : { + type: "confirm", + text: "Suspend", + tip: "This will suspend selected machines", + condition: True + }, + "VM.resume" : { + type: "confirm", + text: "Resume", + tip: "This will resume selected stopped or suspended VMs", + condition: True + }, + "VM.stop" : { + type: "confirm", + text: "Stop", + tip: "This will stop selected VMs", + condition: True + }, + "VM.restart" : { + type: "confirm", + text: "Restart", + tip: "This will redeploy selected VMs (in UNKNOWN or BOOT state)", + condition: True + }, + "VM.cancel" : { + type: "confirm", + text: "Cancel", + tip: "This will cancel selected VMs", + condition: True + } + }, + condition: True + }, + + "VM.delete" : { + type: "confirm", + text: "Delete", + tip: "This will delete the selected VMs from the database" + condition: True + } +} diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js new file mode 100644 index 0000000000..17b91bda5e --- /dev/null +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -0,0 +1,242 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2011, OpenNebula Project Leads (OpenNebula.org) */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +/*Virtual networks tab plugin*/ + +var vnets_tab_content = +''; + +var create_vn_tmpl = +''; + +var vnetworks_select=""; +var network_list_json = {}; +var dataTable_vNetworks; + +//Setup actions + +var vnet_actions = { + "Network.create" : { + type: "create", + call: OpenNebula.Network.create, + callback: addVNetworkElement, + error: onError, + notify: False + }, + + "Network.create_dialog" : { + type: "custom", + call: popUpCreateNetworkDialog + }, + + "Network.list" : { + type: "list", + call: OpenNebula.Network.list, + callback: updateVNetworksView, + error: onError, + notify: False + }, + + "Network.show" : { + type: "single", + call: OpenNebula.Network.show, + callback: updateVNetworkElement, + error: onError, + notify: False + }, + + "Network.showinfo" : { + type: "single", + call: OpenNebula.Network.show, + callback: updateVNetworkInfo, + error: onError, + notify: False + } + }, + + "Network.refresh" : { + type: "custom", + call: function(){ + waitingNodes(dataTable_vNetworks); + Sunstone.runAction("Network.list"); + }, + notify: False + }, + + "Network.publish" : { + type: "multiple", + call: OpenNebula.Network.publish, + callback: function (req) { + Sunstone.runAction("Network.show",req.request.data[0]); + }, + dataTable: function() { return dataTable_vNetworks; }, + error: onError, + notify: False + }, + + "Network.unpublish" : { + type: "multiple", + call: OpenNebula.Network.unpublish, + callback: function (req) { + Sunstone.runAction("Network.show",req.request.data[0]); + }, + dataTable: function() { return dataTable_vNetworks; }, + error: onError, + notify: False + }, + + "Network.delete" : { + type: "multiple", + call: OpenNebula.Network.delete, + callback: deleteVNetworkElement, + dataTable: function() { return dataTable_vNetworks; }, + error: onError, + notify: False + } + +} + + +var vnet_buttons = { + "Network.refresh" : { + type: "image", + text: "Refresh list", + img: "/images/Refresh-icon.png", + condition: True + }, + + "Network.create_dialog" : { + type: "create_dialog", + text: "+ New", + condition: True + }, + + "Network.publish" : { + type: "action", + text: "Publish", + condition: True + }, + + "Network.unpublish" : { + type: "action", + text: "Unpublish", + condition: True + }, + + "Network.delete" : { + type: "action", + text: "Delete", + condition: True + } +} diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 13a320bf52..0e44285cda 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -45,26 +45,43 @@ var Sunstone = { SunstoneCfg["actions"][name] = action_obj; }, - "updateAction" : function(action,new_action) { - + "updateAction" : function(name,action_obj) { + SunstoneCfg["actions"][name] = action_obj; }, "removeAction" : function(action) { - + SunstoneCfg["actions"][action] = null; }, - "addMainTab" : function(title_arg,content_arg, buttons_arg,tab_id) { + "addMainTab" : function(tab_id,title_arg,content_arg, buttons_arg,refresh) { SunstoneCfg["tabs"][tab_id] = {title: title_arg, content: content_arg, buttons: buttons_arg }; + if (refresh){ + + } }, - "updateMainTab" : function(tab_id,new_content){ - + "updateMainTabContent" : function(tab_id,content_arg,refresh){ + SunstoneCfg["tabs"][tab_id]["content"]=content_arg; + if (refresh){ + $('div#'+tab).html(tab_info.content); + } }, - "removeMainTab" : function(tab_id) { - + "updateMainTabButtons" : function(tab_id,buttons_arg,refresh){ + SunstoneCfg["tabs"][tab_id]["buttons"]=buttons_arg; + if (refresh){ + $('div#'+tab_name+' .action_blocks').empty(); + insertButtonsInTab(tab_name); + } + }, + + "removeMainTab" : function(tab_id,refresh) { + SunstoneCfg["tabs"][tab_id]=null; + if (refresh) { + $('div#'+tab_name).remove(); + } }, "getInfoPanelHTML" : function(name){ @@ -84,22 +101,23 @@ var Sunstone = { SunstoneCfg["info_panels"][name]=info_panel; }, - "updateInfoPanel" : function(name, info_panel,refresh){ + "updateInfoPanel" : function(name, info_panel){ SunstoneCfg["info_panels"][name]=info_panel; - if (refresh){ - refreshInfoPanel(name); - } }, "removeInfoPanel" : function(name){ SunstoneCfg["info_panels"][name] = null; }, - "addInfoTab" : function(info_panel, tab_name, tab){ + "popUpInfoPanel" : function(name){ + popDialog(Sunstone.getInfoPanelHTML(name)); + }, + + "addInfoPanelTab" : function(info_panel, tab_name, tab){ SunstoneCfg["info_panels"][info_panel][tab_name] = tab; }, - "updateInfoTab" : function(info_panel, tab_name, tab, refresh){ + "updateInfoPanelTab" : function(info_panel, tab_name, tab, refresh){ SunstoneCfg["info_panels"][info_panel][tab_name] = tab; if (refresh){ refreshInfoPanelTab(info_panel,tab_name); @@ -107,7 +125,7 @@ var Sunstone = { }, - "removeInfoTab" : function(info_panel,tab_name){ + "removeInfoPanelTab" : function(info_panel,tab_name){ SunstoneCfg["info_panels"][info_panel][tab_name] = null; }, @@ -190,112 +208,12 @@ var Sunstone = { button = buttons["action_list"]["actions"][button_name]; } return button; - }//meter coma y seguir aquí + } //end sunstone methods }; - - //~ "actions" : { - //~ - //~ "VM.create" = { - //~ - //~ }, - //~ - //~ "VM.deploy" = { - //~ - //~ }, - //~ - //~ "VM.migrate" = { - //~ - //~ }, - //~ - //~ "VM.livemigrate" = { - //~ - //~ }, - //~ - //~ "VM.hold" = { - //~ - //~ }, - //~ - //~ "VM.release" = { - //~ - //~ }, - //~ - //~ "VM.suspend" = { - //~ - //~ }, - //~ - //~ "VM.resume" = { - //~ - //~ }, - //~ - //~ "VM.stop" = { - //~ - //~ }, - //~ - //~ "VM.restart" = { - //~ - //~ }, - //~ - //~ "VM.shutdown" = { - //~ - //~ }, - //~ - //~ "VM.cancel" = { - //~ - //~ }, - //~ - //~ "VM.delete" = { - //~ - //~ }, - //~ - //~ "Network.publish" = { - //~ - //~ }, - //~ - //~ "Network.unpublish" = { - //~ - //~ }, - //~ - //~ "Network.delete" = { - //~ - //~ }, - //~ - //~ "User.create" = { - //~ - //~ }, - //~ - //~ "User.delete" = { - //~ - //~ }, - //~ - //~ "Image.enable" = { - //~ - //~ }, - //~ - //~ "Image.disable" = { - //~ - //~ }, - //~ - //~ "Image.persistent" = { - //~ - //~ }, - //~ - //~ "Image.nonpersistent" = { - //~ - //~ }, - //~ - //~ "Image.publish" = { - //~ - //~ }, - //~ - //~ "Image.unpublish" = { - //~ - //~ }, - //~ - //~ "Image.delete" = { - //~ - //~ } + + //plugins have done their jobs when we execute this @@ -398,48 +316,48 @@ function insertTabs(){ function insertButtons(){ - var buttons; - var tab_id; - var button_code; - var button_obj; + for (tab in SunstoneCfg["tabs"]){ + insertButtonsInTab(tab) + } +} + +function insertButtonsInTab(tab_name){ + var buttons = SunstoneCfg["tabs"][tab_name]["buttons"]; + var button_code=""; + var sel_obj=null; - for (tab in SunstoneCfg["tabs"]){ - buttons = SunstoneCfg["tabs"][tab].buttons; - content = SunstoneCfg["tabs"][tab].content; - if ($('div#'+tab+' .action_blocks').length){ - for (button_name in buttons){ - button_code = ""; - button = buttons[button_name]; - if (button.condition()) { - switch (button.type) { - case "select": - button_code = ''; + break; + case "image": + button_code = '