mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-26 06:50:09 +03:00
Feature #2778: Improve cache
* Refresh table when changing tabs (using cache) * Refresh/top button ignores the cache, and forces a list call * Increase cache value to 1 minute
This commit is contained in:
parent
cba45def08
commit
7a7529d10c
@ -25,7 +25,7 @@ $.ajaxSetup({
|
||||
var list_cache = {};
|
||||
var list_waiting = {};
|
||||
var list_callbacks = {};
|
||||
var cache_expire = 5000; //ms
|
||||
var cache_expire = 60000; //ms
|
||||
|
||||
|
||||
var OpenNebula = {
|
||||
@ -356,7 +356,14 @@ var OpenNebula = {
|
||||
var req_path = path ? path : resource.toLowerCase();
|
||||
var cache_name = params.cache_name ? params.cache_name : resource;
|
||||
|
||||
if( list_cache[cache_name] &&
|
||||
var options = params.options;
|
||||
var force = false;
|
||||
if (options){
|
||||
force = options.force;
|
||||
}
|
||||
|
||||
if( !force &&
|
||||
list_cache[cache_name] &&
|
||||
list_cache[cache_name]["timestamp"] + cache_expire > new Date().getTime()){
|
||||
|
||||
//console.log(cache_name+" list. Cache used");
|
||||
|
@ -207,7 +207,7 @@ var acl_actions = {
|
||||
type: "custom",
|
||||
call: function () {
|
||||
waitingNodes(dataTable_acls);
|
||||
Sunstone.runAction("Acl.list");
|
||||
Sunstone.runAction("Acl.list", {force: true});
|
||||
}
|
||||
},
|
||||
|
||||
@ -258,6 +258,7 @@ var acl_buttons = {
|
||||
|
||||
var acls_tab = {
|
||||
title: tr("ACLs"),
|
||||
resource: 'Acl',
|
||||
buttons: acl_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'system-tab',
|
||||
|
@ -952,7 +952,7 @@ var cluster_actions = {
|
||||
Sunstone.runAction("Cluster.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_clusters);
|
||||
Sunstone.runAction("Cluster.list");
|
||||
Sunstone.runAction("Cluster.list", {force: true});
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
@ -1088,6 +1088,7 @@ var cluster_buttons = {
|
||||
|
||||
var clusters_tab = {
|
||||
title: tr("Clusters"),
|
||||
resource: 'Cluster',
|
||||
buttons: cluster_buttons,
|
||||
showOnTopMenu: false,
|
||||
tabClass: "subTab",
|
||||
|
@ -335,7 +335,7 @@ var datastore_actions = {
|
||||
Sunstone.runAction("Datastore.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_datastores);
|
||||
Sunstone.runAction("Datastore.list");
|
||||
Sunstone.runAction("Datastore.list", {force: true});
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
@ -507,6 +507,7 @@ var datastore_info_panel = {
|
||||
|
||||
var datastores_tab = {
|
||||
title: tr("Datastores"),
|
||||
resource: 'Datastore',
|
||||
buttons: datastore_buttons,
|
||||
tabClass: "subTab",
|
||||
parentTab: "infra-tab",
|
||||
|
@ -187,7 +187,7 @@ var file_actions = {
|
||||
Sunstone.runAction("File.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_files);
|
||||
Sunstone.runAction("File.list");
|
||||
Sunstone.runAction("File.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -350,6 +350,7 @@ var file_info_panel = {
|
||||
|
||||
var files_tab = {
|
||||
title: tr("Files & Kernels"),
|
||||
resource: 'File',
|
||||
buttons: file_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'vresources-tab',
|
||||
|
@ -244,7 +244,7 @@ var group_actions = {
|
||||
Sunstone.runAction("Group.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_groups);
|
||||
Sunstone.runAction("Group.list");
|
||||
Sunstone.runAction("Group.list", {force: true});
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
@ -409,6 +409,7 @@ var group_info_panel = {
|
||||
|
||||
var groups_tab = {
|
||||
title: tr("Groups"),
|
||||
resource: 'Group',
|
||||
buttons: group_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'system-tab',
|
||||
|
@ -162,7 +162,7 @@ var host_actions = {
|
||||
Sunstone.runAction("Host.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_hosts);
|
||||
Sunstone.runAction("Host.list");
|
||||
Sunstone.runAction("Host.list", {force: true});
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
@ -337,6 +337,7 @@ var host_info_panel = {
|
||||
|
||||
var hosts_tab = {
|
||||
title: tr("Hosts"),
|
||||
resource: 'Host',
|
||||
buttons: host_buttons,
|
||||
tabClass: "subTab",
|
||||
parentTab: "infra-tab",
|
||||
|
@ -296,7 +296,7 @@ var image_actions = {
|
||||
Sunstone.runAction("Image.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_images);
|
||||
Sunstone.runAction("Image.list");
|
||||
Sunstone.runAction("Image.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -509,6 +509,7 @@ var image_info_panel = {
|
||||
|
||||
var images_tab = {
|
||||
title: tr("Images"),
|
||||
resource: 'Image',
|
||||
buttons: image_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'vresources-tab',
|
||||
|
@ -932,7 +932,7 @@ var service_actions = {
|
||||
Sunstone.runAction("Service.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_services);
|
||||
Sunstone.runAction("Service.list");
|
||||
Sunstone.runAction("Service.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1045,6 +1045,7 @@ var service_info_panel = {
|
||||
|
||||
var services_tab = {
|
||||
title: "Services",
|
||||
resource: 'Service',
|
||||
buttons: service_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'oneflow-dashboard',
|
||||
|
@ -403,7 +403,7 @@ var service_template_actions = {
|
||||
Sunstone.runAction("ServiceTemplate.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_service_templates);
|
||||
Sunstone.runAction("ServiceTemplate.list");
|
||||
Sunstone.runAction("ServiceTemplate.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -515,6 +515,7 @@ var service_template_info_panel = {
|
||||
|
||||
var service_templates_tab = {
|
||||
title: "Templates",
|
||||
resource: 'ServiceTemplate',
|
||||
buttons: service_template_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'oneflow-dashboard',
|
||||
|
@ -281,7 +281,7 @@ var template_actions = {
|
||||
Sunstone.runAction("Template.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_templates);
|
||||
Sunstone.runAction("Template.list");
|
||||
Sunstone.runAction("Template.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -517,6 +517,7 @@ var template_info_panel = {
|
||||
|
||||
var templates_tab = {
|
||||
title: tr("Templates"),
|
||||
resource: 'Template',
|
||||
buttons: template_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'vresources-tab',
|
||||
|
@ -301,7 +301,7 @@ var user_actions = {
|
||||
Sunstone.runAction("User.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_users);
|
||||
Sunstone.runAction("User.list");
|
||||
Sunstone.runAction("User.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -509,6 +509,7 @@ var user_info_panel = {
|
||||
|
||||
var users_tab = {
|
||||
title: tr("Users"),
|
||||
resource: 'User',
|
||||
buttons: user_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'system-tab',
|
||||
|
@ -457,7 +457,7 @@ var vm_actions = {
|
||||
Sunstone.runAction("VM.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_vMachines);
|
||||
Sunstone.runAction("VM.list");
|
||||
Sunstone.runAction("VM.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1119,6 +1119,7 @@ var vm_info_panel = {
|
||||
|
||||
var vms_tab = {
|
||||
title: tr("Virtual Machines"),
|
||||
resource: 'VM',
|
||||
buttons: vm_buttons,
|
||||
tabClass: 'subTab',
|
||||
parentTab: 'vresources-tab',
|
||||
|
@ -368,7 +368,7 @@ var vnet_actions = {
|
||||
Sunstone.runAction("Network.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_vNetworks);
|
||||
Sunstone.runAction("Network.list");
|
||||
Sunstone.runAction("Network.list", {force: true});
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -574,6 +574,7 @@ var vnet_info_panel = {
|
||||
|
||||
var vnets_tab = {
|
||||
title: tr("Virtual Networks"),
|
||||
resource: 'Network',
|
||||
buttons: vnet_buttons,
|
||||
tabClass: "subTab",
|
||||
parentTab: "infra-tab",
|
||||
|
@ -139,7 +139,7 @@ var zone_actions = {
|
||||
Sunstone.runAction("Zone.show", Sunstone.rightInfoResourceId(tab))
|
||||
} else {
|
||||
waitingNodes(dataTable_zones);
|
||||
Sunstone.runAction("Zone.list");
|
||||
Sunstone.runAction("Zone.list", {force: true});
|
||||
}
|
||||
},
|
||||
error: onError
|
||||
@ -216,6 +216,7 @@ var zone_buttons = {
|
||||
|
||||
var zones_tab = {
|
||||
title: tr("Zones"),
|
||||
resource: 'Zone',
|
||||
buttons: zone_buttons,
|
||||
tabClass: "subTab",
|
||||
parentTab: "infra-tab",
|
||||
|
@ -271,7 +271,7 @@ var Sunstone = {
|
||||
};
|
||||
break;
|
||||
case "list":
|
||||
call({success: callback, error:err});
|
||||
call({success: callback, error:err, options:data_arg});
|
||||
break;
|
||||
case "monitor_global":
|
||||
call({
|
||||
@ -3548,7 +3548,13 @@ function showTab(tabname,highlight_tab){
|
||||
$(".only-right-info", tab).hide();
|
||||
|
||||
recountCheckboxes($(".dataTable", tab).first());
|
||||
//$("#refresh_buttons .button", $('#'+activeTab)).click()
|
||||
|
||||
var res = SunstoneCfg['tabs'][activeTab]['resource']
|
||||
if (res){
|
||||
Sunstone.runAction(res+".list");
|
||||
} else {
|
||||
// $(".fa-refresh", $('#'+activeTab)).click();
|
||||
}
|
||||
}
|
||||
|
||||
function setupTabs(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user