diff --git a/src/sunstone/public/js/plugins/acls-tab.js b/src/sunstone/public/js/plugins/acls-tab.js index 298df139ec..421dde9b89 100644 --- a/src/sunstone/public/js/plugins/acls-tab.js +++ b/src/sunstone/public/js/plugins/acls-tab.js @@ -182,17 +182,6 @@ var acl_actions = { } }, - "Acl.autorefresh" : { - type: "custom", - call: function(){ - OpenNebula.Acl.list({ - timeout: true, - success: updateAclsView, - error: onError - }); - } - }, - "Acl.delete" : { type: "multiple", call: OpenNebula.Acl.del, @@ -217,6 +206,11 @@ var acl_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Acl.create_dialog" : { type: "create_dialog", layout: "create" @@ -634,18 +628,6 @@ function popUpCreateAclDialog(){ dialog.foundation().foundation('reveal', 'open'); } -// Prepare the autorefresh of the list -function setAclAutorefresh(){ - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_acls); - var filter = $('#acl_search').attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Acl.autorefresh"); - } - },INTERVAL+someTime()); - -} - $(document).ready(function(){ var tab_name = 'acls-tab'; @@ -672,7 +654,6 @@ $(document).ready(function(){ Sunstone.runAction("Acl.list"); setupCreateAclDialog(); - setAclAutorefresh(); initCheckAllBoxes(dataTable_acls); tableCheckboxesListener(dataTable_acls); diff --git a/src/sunstone/public/js/plugins/clusters-tab.js b/src/sunstone/public/js/plugins/clusters-tab.js index e9ff501ca3..e27d776dca 100644 --- a/src/sunstone/public/js/plugins/clusters-tab.js +++ b/src/sunstone/public/js/plugins/clusters-tab.js @@ -954,13 +954,6 @@ var cluster_actions = { error: onError }, - "Cluster.autorefresh" : { - type: "custom", - call : function() { - OpenNebula.Cluster.list({timeout: true, success: updateClustersView,error: onError}); - } - }, - "Cluster.addhost" : { type: "single", call : OpenNebula.Cluster.addhost, @@ -1068,6 +1061,11 @@ var cluster_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Cluster.create_dialog" : { type: "create_dialog", layout: "create" @@ -1395,17 +1393,6 @@ function clusterResourceViewListeners(){ }); }; -//Prepares the autorefresh for hosts -function setClusterAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_clusters); - var filter = $("#cluster_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Cluster.autorefresh"); - } - },INTERVAL+someTime()); -} - function clusters_sel() { return clusters_select; } @@ -1439,7 +1426,6 @@ $(document).ready(function(){ setupCreateClusterDialog(); - setClusterAutorefresh(); clusterResourceViewListeners(); initCheckAllBoxes(dataTable_clusters); diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 8238e592d5..068f9e0455 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -370,13 +370,6 @@ var datastore_actions = { error: onError }, - "Datastore.autorefresh" : { - type: "custom", - call : function() { - OpenNebula.Datastore.list({timeout: true, success: updateDatastoresView,error: onError}); - } - }, - "Datastore.delete" : { type: "multiple", call : OpenNebula.Datastore.del, @@ -463,6 +456,11 @@ var datastore_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Datastore.create_dialog" : { type: "create_dialog", layout: "create", @@ -1112,16 +1110,6 @@ function popUpCreateDatastoreDialog(){ $("input#name",$create_datastore_dialog).focus(); } -//Prepares autorefresh -function setDatastoreAutorefresh(){ - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_datastores); - var filter = $("#datastore_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Datastore.autorefresh"); - }; - },INTERVAL+someTime()); -} $(document).ready(function(){ var tab_name = 'datastores-tab'; @@ -1148,7 +1136,6 @@ $(document).ready(function(){ Sunstone.runAction("Datastore.list"); setupCreateDatastoreDialog(); - setDatastoreAutorefresh(); initCheckAllBoxes(dataTable_datastores); tableCheckboxesListener(dataTable_datastores); diff --git a/src/sunstone/public/js/plugins/files-tab.js b/src/sunstone/public/js/plugins/files-tab.js index 04d1069486..1963ced99a 100644 --- a/src/sunstone/public/js/plugins/files-tab.js +++ b/src/sunstone/public/js/plugins/files-tab.js @@ -191,13 +191,6 @@ var file_actions = { } }, - "File.autorefresh" : { - type: "custom", - call: function() { - OpenNebula.Image.list({timeout: true, success: updateFilesView, error: onError}); - } - }, - "File.update_template" : { type: "single", call: OpenNebula.Image.update, @@ -305,6 +298,11 @@ var file_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "File.create_dialog" : { type: "create_dialog", layout: "create" @@ -804,17 +802,6 @@ function popUpCreateFileDialog(){ $("input#file_name",$create_file_dialog).focus(); } -// Set the autorefresh interval for the datatable -function setFileAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_files); - var filter = $("#file_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("File.autorefresh"); - } - },INTERVAL+someTime()); -}; - function is_persistent_file(id){ var data = getElementData(id,"#file",dataTable_files)[8]; return $(data).is(':checked'); @@ -845,7 +832,6 @@ $(document).ready(function(){ Sunstone.runAction("File.list"); setupCreateFileDialog(); - setFileAutorefresh(); initCheckAllBoxes(dataTable_files); tableCheckboxesListener(dataTable_files); diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 2f822c8580..2a3676ec78 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -237,13 +237,6 @@ var group_actions = { error: onError }, - "Group.autorefresh" : { - type: "custom", - call: function () { - OpenNebula.Group.list({timeout: true, success: updateGroupsView,error: onError}); - } - }, - "Group.refresh" : { type: "custom", call: function() { @@ -382,6 +375,11 @@ var group_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Group.create_dialog" : { type: "create_dialog", layout: "create", @@ -1340,17 +1338,6 @@ function popUpGroupQuotasDialog(){ popUpQuotasDialog($group_quotas_dialog, 'Group', groupElements()) } -//Prepares the autorefresh -function setGroupAutorefresh(){ - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_groups); - var filter = $("#group_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Group.autorefresh"); - } - },INTERVAL+someTime()); -} - $(document).ready(function(){ var tab_name = 'groups-tab'; @@ -1375,7 +1362,6 @@ $(document).ready(function(){ Sunstone.runAction("Group.list"); setupCreateGroupDialog(); setupGroupQuotasDialog(); - setGroupAutorefresh(); initCheckAllBoxes(dataTable_groups); tableCheckboxesListener(dataTable_groups); diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 1eb0b0fcd7..92d61d9ed9 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -169,13 +169,6 @@ var host_actions = { error: onError }, - "Host.autorefresh" : { - type: "custom", - call : function() { - OpenNebula.Host.list({timeout: true, success: updateHostsView,error: onError}); - } - }, - "Host.enable" : { type: "multiple", call : OpenNebula.Host.enable, @@ -291,6 +284,11 @@ var host_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Host.create_dialog" : { type: "create_dialog", layout: "create", @@ -966,17 +964,6 @@ function popUpCreateHostDialog(){ return false; } -//Prepares the autorefresh for hosts -function setHostAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_hosts); - var filter = $("#hosts_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Host.autorefresh"); - } - },INTERVAL+someTime()); -} - // Call back when individual host history monitoring fails function hostMonitorError(req,error_json){ var message = error_json.error.message; @@ -1016,8 +1003,6 @@ $(document).ready(function(){ setupCreateHostDialog(); - setHostAutorefresh(); - initCheckAllBoxes(dataTable_hosts); tableCheckboxesListener(dataTable_hosts); infoListener(dataTable_hosts, "Host.show"); diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 21a8e06fab..d50fe2a233 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -297,13 +297,6 @@ var image_actions = { } }, - "Image.autorefresh" : { - type: "custom", - call: function() { - OpenNebula.Image.list({timeout: true, success: updateImagesView, error: onError}); - } - }, - "Image.update_template" : { type: "single", call: OpenNebula.Image.update, @@ -446,6 +439,11 @@ var image_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Image.create_dialog" : { type: "create_dialog", layout: "create" @@ -1182,17 +1180,6 @@ function popUpCreateImageDialog(){ $("input#img_name",$create_image_dialog).focus(); } -// Set the autorefresh interval for the datatable -function setImageAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_images); - var filter = $("#image_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Image.autorefresh"); - } - },INTERVAL+someTime()); -}; - function is_persistent_image(id){ var data = getElementData(id,"#image",dataTable_images)[8]; return $(data).is(':checked'); @@ -1301,7 +1288,6 @@ $(document).ready(function(){ setupCreateImageDialog(); setupImageCloneDialog(); - setImageAutorefresh(); initCheckAllBoxes(dataTable_images); tableCheckboxesListener(dataTable_images); diff --git a/src/sunstone/public/js/plugins/oneflow-services.js b/src/sunstone/public/js/plugins/oneflow-services.js index 96002a394e..569e19da75 100644 --- a/src/sunstone/public/js/plugins/oneflow-services.js +++ b/src/sunstone/public/js/plugins/oneflow-services.js @@ -937,22 +937,6 @@ var service_actions = { } }, - "Service.autorefresh" : { - type: "custom", - call: function() { - Service.list({ - timeout: true, - success: function(request, service_list) { - $("#oneflow-services #error_message").hide(); - updateServicesView(request, service_list); - }, - error: function(request, error_json) { - onError(request, error_json, $("#oneflow-services #error_message")); - } - }); - } - }, - "Service.delete" : { type: "multiple", call: Service.del, @@ -1015,7 +999,11 @@ var service_buttons = { layout: "refresh", alwaysActive: true }, - + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Service.chown" : { type: "confirm_with_select", text: tr("Change owner"), @@ -1706,17 +1694,6 @@ function popUpScaleDialog(){ return false; } -// Set the autorefresh interval for the datatable -function setServiceAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_services); - var filter = $("#services_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Service.autorefresh"); - } - },INTERVAL+someTime()); -}; - //The DOM is ready at this point $(document).ready(function(){ var tab_name = "oneflow-services"; @@ -1741,8 +1718,6 @@ $(document).ready(function(){ Sunstone.runAction("Service.list"); - setServiceAutorefresh(); - initCheckAllBoxes(dataTable_services); tableCheckboxesListener(dataTable_services); infoListener(dataTable_services,'Service.show'); diff --git a/src/sunstone/public/js/plugins/oneflow-templates.js b/src/sunstone/public/js/plugins/oneflow-templates.js index 57bc1295ac..1dc75e4dba 100644 --- a/src/sunstone/public/js/plugins/oneflow-templates.js +++ b/src/sunstone/public/js/plugins/oneflow-templates.js @@ -408,22 +408,6 @@ var service_template_actions = { } }, - "ServiceTemplate.autorefresh" : { - type: "custom", - call: function() { - ServiceTemplate.list({ - timeout: true, - success: function(request, service_list) { - $("#oneflow-templates #error_message").hide(); - updateServiceTemplatesView(request, service_list); - }, - error: function(request, error_json) { - onError(request, error_json, $("#oneflow-templates #error_message")); - } - }); - } - }, - "ServiceTemplate.delete" : { type: "multiple", call: ServiceTemplate.del, @@ -478,6 +462,11 @@ var service_template_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "ServiceTemplate.create_dialog" : { type: "create_dialog", layout: "create" @@ -1413,18 +1402,6 @@ function fillUpUpdateServiceTemplateDialog(request, response){ dialog.foundation('reveal', 'open'); } -// Set the autorefresh interval for the datatable -function setServiceTemplateAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_service_templates); - var filter = $("#service_template_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("ServiceTemplate.autorefresh"); - } - },INTERVAL+someTime()); -}; - - //The DOM is ready at this point $(document).ready(function(){ var tab_name = "oneflow-templates"; @@ -1449,8 +1426,6 @@ $(document).ready(function(){ Sunstone.runAction("ServiceTemplate.list"); - setServiceTemplateAutorefresh(); - initCheckAllBoxes(dataTable_service_templates); tableCheckboxesListener(dataTable_service_templates); infoListener(dataTable_service_templates,'ServiceTemplate.show'); diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index f7e568ed19..7f82e6c023 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -283,13 +283,6 @@ var template_actions = { } }, - "Template.autorefresh" : { - type: "custom", - call: function() { - OpenNebula.Template.list({timeout: true, success: updateTemplatesView, error: onError}); - } - }, - "Template.show_to_update" : { type: "single", call: OpenNebula.Template.show, @@ -454,6 +447,11 @@ var template_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Template.create_dialog" : { type: "create_dialog", layout: "create" @@ -4612,17 +4610,6 @@ function popUpTemplateCloneDialog(){ $("input[name='name']",dialog).focus(); } -// Set the autorefresh interval for the datatable -function setTemplateAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_templates); - var filter = $("#template_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Template.autorefresh"); - } - },INTERVAL+someTime()); -}; - // Instantiate dialog // Sets up the instiantiate template dialog and all the processing associated to it function setupInstantiateTemplateDialog(easy_provision){ @@ -4839,7 +4826,6 @@ $(document).ready(function(){ Sunstone.runAction("Template.list"); setupTemplateCloneDialog(); - setTemplateAutorefresh(); initCheckAllBoxes(dataTable_templates); tableCheckboxesListener(dataTable_templates); diff --git a/src/sunstone/public/js/plugins/users-tab.js b/src/sunstone/public/js/plugins/users-tab.js index aa0aeed103..31692933d4 100644 --- a/src/sunstone/public/js/plugins/users-tab.js +++ b/src/sunstone/public/js/plugins/users-tab.js @@ -307,17 +307,6 @@ var user_actions = { } }, - "User.autorefresh" : { - type: "custom", - call: function(){ - OpenNebula.User.list({ - timeout: true, - success: updateUsersView, - error: onError - }); - } - }, - "User.update_password" : { type: "custom", call: popUpUpdatePasswordDialog @@ -446,6 +435,11 @@ var user_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "User.create_dialog" : { type: "create_dialog", layout: "create", @@ -896,17 +890,6 @@ function popUpChangeAuthenticationDialog(){ $change_auth_dialog.foundation().foundation('reveal', 'open');; } -// Prepare the autorefresh of the list -function setUserAutorefresh(){ - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_users); - var filter = $("#user_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("User.autorefresh"); - } - },INTERVAL+someTime()); -} - $(document).ready(function(){ var tab_name = 'users-tab'; @@ -936,7 +919,6 @@ $(document).ready(function(){ setupUpdatePasswordDialog(); setupChangeAuthenticationDialog(); setupUserQuotasDialog(); - setUserAutorefresh(); //Setup quota icons //Also for group tab setupQuotaIcons(); diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index de2147ddbd..a0b7e7381f 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -462,13 +462,6 @@ var vm_actions = { } }, - "VM.autorefresh" : { - type: "custom", - call : function() { - OpenNebula.VM.list({timeout: true, success: updateVMachinesView,error: onError}); - } - }, - "VM.deploy" : { type: "custom", call: function(){ @@ -937,7 +930,11 @@ var vm_buttons = { layout: "refresh", alwaysActive: true }, - + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "VM.create_dialog" : { type: "action", layout: "create", @@ -3331,18 +3328,6 @@ function popUpMigrateVMDialog(live){ $migrate_vm_dialog.foundation().foundation('reveal', 'open'); } - -//Prepares autorefresh -function setVMAutorefresh(){ - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_vMachines); - var filter = $("#vms_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("VM.autorefresh"); - }; - },INTERVAL+someTime()); -} - //This is taken from noVNC examples function updateVNCState(rfb, state, oldstate, msg) { var s, sb, cad, klass; @@ -3519,7 +3504,6 @@ $(document).ready(function(){ Sunstone.runAction("VM.list"); - setVMAutorefresh(); setupVNC(); hotpluggingOps(); setup_vm_network_tab(); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index ca3dd55c6c..90413e1806 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -373,13 +373,6 @@ var vnet_actions = { } }, - "Network.autorefresh" : { - type: "custom", - call: function() { - OpenNebula.Network.list({timeout: true, success: updateVNetworksView, error: onError}); - } - }, - "Network.publish" : { type: "multiple", call: OpenNebula.Network.publish, @@ -524,6 +517,12 @@ var vnet_buttons = { alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, + "Network.create_dialog" : { type: "create_dialog", layout: "create" @@ -1351,16 +1350,6 @@ function setupLeasesOps(){ } } -function setVNetAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_vNetworks); - var filter = $("#vnet_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Network.autorefresh"); - } - },INTERVAL+someTime()); -}; - //The DOM is ready and the ready() from sunstone.js //has been executed at this point. $(document).ready(function(){ @@ -1388,7 +1377,6 @@ $(document).ready(function(){ setupCreateVNetDialog(); setupLeasesOps(); - setVNetAutorefresh(); initCheckAllBoxes(dataTable_vNetworks); tableCheckboxesListener(dataTable_vNetworks); diff --git a/src/sunstone/public/js/plugins/zones-tab.js b/src/sunstone/public/js/plugins/zones-tab.js index d027790eaa..ca50405259 100644 --- a/src/sunstone/public/js/plugins/zones-tab.js +++ b/src/sunstone/public/js/plugins/zones-tab.js @@ -146,13 +146,6 @@ var zone_actions = { error: onError }, - "Zone.autorefresh" : { - type: "custom", - call : function() { - OpenNebula.Zone.list({timeout: true, success: updateZonesView,error: onError}); - } - }, - "Zone.delete" : { type: "multiple", call : OpenNebula.Zone.del, @@ -200,6 +193,11 @@ var zone_buttons = { layout: "refresh", alwaysActive: true }, + "Sunstone.toggle_top" : { + type: "custom", + layout: "top", + alwaysActive: true + }, "Zone.create_dialog" : { type: "create_dialog", layout: "create" @@ -366,17 +364,6 @@ function updateZoneInfo(request,zone){ Sunstone.popUpInfoPanel("zone_info_panel", "zones-tab"); } -//Prepares the autorefresh for zones -function setZoneAutorefresh() { - setInterval(function(){ - var checked = $('input.check_item:checked',dataTable_zones); - var filter = $("#zone_search").attr('value'); - if ((checked.length==0) && !filter){ - Sunstone.runAction("Zone.autorefresh"); - } - },INTERVAL+someTime()); -} - function zones_sel() { return zones_select; } @@ -411,8 +398,6 @@ $(document).ready(function(){ dialogs_context.append('
'); - setZoneAutorefresh(); - initCheckAllBoxes(dataTable_zones); tableCheckboxesListener(dataTable_zones); infoListener(dataTable_zones, "Zone.show"); diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index c4a694f7b8..8598fc12e5 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -39,6 +39,10 @@ var info_panels_context; panel_extended = false; +// global settings +var top_interval = 10000; //ms +var top_interval_ids = {}; + //Sunstone configuration is formed by predifined "actions", main tabs //and "info_panels". Each tab has "content" and "buttons". Each //"info_panel" has "tabs" with "content". @@ -699,7 +703,7 @@ function insertButtonsInTab(tab_name, panel_name, panel_buttons, custom_context) switch (button.layout) { case "create": context = $("#"+custom_id+"create_buttons", buttons_row); - text = button.text ? ' ' + button.text : ' ' + tr("Create"); + text = button.text ? ' ' + button.text : ''; str_class.push("success", "button", "small", "radius"); button_code = ''; break; @@ -709,6 +713,12 @@ function insertButtonsInTab(tab_name, panel_name, panel_buttons, custom_context) str_class.push("secondary", "button", "small", "radius"); button_code = ''; break; + case "top": + context = $("#"+custom_id+"refresh_buttons", buttons_row); + text = ''; + str_class.push("toggle_top_button", "only-right-list","secondary", "button", "small", "radius"); + button_code = ''; + break; case "main": context = $("#"+custom_id+"main_buttons", buttons_row); text = button.text; @@ -3669,6 +3679,29 @@ $(document).ready(function(){ return false; }); + //Listen .toggle_top_buttons. + $(".toggle_top_button").live("click", function(){ + var tab = $(this).parents(".tab"); + var custom_id = tab.attr('id'); + + if(top_interval_ids[custom_id] == null){ + $(this).html(''); + + var refresh_button = $(".fa-refresh", $(this).parents(".action_blocks")); + top_interval_ids[custom_id] = setInterval(function(){ + if(Sunstone.rightListVisible(tab)){ + //console.log("top for "+custom_id); + refresh_button.click(); + } + //else {console.log("top not visible for "+custom_id);} + }, top_interval); + } else { + clearInterval(top_interval_ids[custom_id]); + top_interval_ids[custom_id] = null; + + $(this).html(''); + } + }); //Listen .confirm_buttons. These buttons show a confirmation dialog //before running the action.