mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-21 12:22:38 +09:00
feature #1825: Refresh for all datatables in the create template dialog
This commit is contained in:
1 parent
025503b2fc
commit
0ffa9cbeee
1 file changed
+167
-37
@@ -764,8 +764,8 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){
|
||||
'<hr>'+
|
||||
'<div id="disk_type" class="vm_param image">'+
|
||||
'<div class="row collapse">'+
|
||||
'<div id="refresh_template_images_table_div_class'+str_disk_tab_id+'" class="seven columns">' +
|
||||
'<button id="refresh_template_images_table_button_class'+str_disk_tab_id+'" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_template_images_table_button_class'+str_disk_tab_id+'" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns">'+
|
||||
'<input id="'+str_disk_tab_id+'_search" type="text" placeholder="Search"/>'+
|
||||
@@ -918,23 +918,22 @@ function generate_disk_tab_content(str_disk_tab_id, str_datatable_id){
|
||||
'</div>'+
|
||||
'</div>';
|
||||
|
||||
$("#refresh_template_images_table_div_class"+str_disk_tab_id).die();
|
||||
$("#refresh_template_images_table_button_class"+str_disk_tab_id).die();
|
||||
|
||||
$("#refresh_template_images_table_div_class"+str_disk_tab_id).live('click', function(){
|
||||
$("#refresh_template_images_table_button_class"+str_disk_tab_id).live('click', function(){
|
||||
// Retrieve the images to fill the datatable
|
||||
OpenNebula.Image.list({
|
||||
timeout: true,
|
||||
success: function (request, images_list){
|
||||
var image_list_array = [];
|
||||
var image_list_array = [];
|
||||
|
||||
$.each(images_list,function(){
|
||||
image_list_array.push(imageElementArray(this));
|
||||
});
|
||||
|
||||
var dataTable_template_images = $("#datatable_template_images" + str_disk_tab_id.substring(4,str_disk_tab_id.length)).dataTable();
|
||||
updateView(image_list_array, dataTable_template_images);
|
||||
dataTable_template_images.fnFilter("OS|DATABLOCK|CDROM", 7, true);
|
||||
}
|
||||
$.each(images_list,function(){
|
||||
image_list_array.push(imageElementArray(this));
|
||||
});
|
||||
|
||||
var dataTable_template_images = $('table[id='+str_datatable_id+']').dataTable();
|
||||
updateView(image_list_array, dataTable_template_images);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -1138,7 +1137,7 @@ function setup_disk_tab_content(disk_section, str_disk_tab_id, str_datatable_id)
|
||||
function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){
|
||||
var html = '<div class="row">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_template_nic_table_button_class'+str_nic_tab_id+'" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'<button id="refresh_template_nic_table_button_class'+str_nic_tab_id+'" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="'+str_nic_tab_id+'_search" type="text" placeholder="Search"/>'+
|
||||
@@ -1269,6 +1268,25 @@ function generate_nic_tab_content(str_nic_tab_id, str_datatable_id){
|
||||
'</div>'+
|
||||
'</div>';
|
||||
|
||||
$("#refresh_template_nic_table_button_class"+str_nic_tab_id).die();
|
||||
|
||||
$("#refresh_template_nic_table_button_class"+str_nic_tab_id).live('click', function(){
|
||||
// Retrieve the nics to fill the datatable
|
||||
OpenNebula.Network.list({
|
||||
timeout: true,
|
||||
success: function (request, networks_list){
|
||||
var network_list_array = [];
|
||||
|
||||
$.each(networks_list,function(){
|
||||
network_list_array.push(vNetworkElementArray(this));
|
||||
});
|
||||
var dataTable_template_networks = $('table[id='+str_datatable_id+']').dataTable();
|
||||
updateView(network_list_array, dataTable_template_networks);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
@@ -1309,7 +1327,6 @@ function setup_nic_tab_content(nic_section, str_nic_tab_id, str_datatable_id) {
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#'+str_nic_tab_id+'_search', nic_section).keyup(function(){
|
||||
dataTable_template_networks.fnFilter( $(this).val() );
|
||||
})
|
||||
@@ -1697,11 +1714,15 @@ function setupCreateTemplateDialog(){
|
||||
$(html_tab_content).appendTo($("ul#template_create_storage_tabs_content"));
|
||||
|
||||
var a = $("<dd>\
|
||||
<a href='#"+str_disk_tab_id+"'>DISK <i class='icon-remove-sign remove-tab'></i></a>\
|
||||
<a id='disk_tab"+str_disk_tab_id+"' href='#"+str_disk_tab_id+"'>DISK <i class='icon-remove-sign remove-tab'></i></a>\
|
||||
</dd>").appendTo($("dl#template_create_storage_tabs"));
|
||||
|
||||
$(document).foundationTabs("set_tab", a);
|
||||
|
||||
$("#disk_tab"+str_disk_tab_id).live('click', function(){
|
||||
$("#refresh_template_images_table_button_class"+str_disk_tab_id).click();
|
||||
});
|
||||
|
||||
|
||||
var disk_section = $('li#' +str_disk_tab_id+'Tab', dialog);
|
||||
setup_disk_tab_content(disk_section, str_disk_tab_id, str_datatable_id)
|
||||
@@ -1763,38 +1784,21 @@ function setupCreateTemplateDialog(){
|
||||
'</li>'
|
||||
|
||||
// Append the new div containing the tab and add the tab to the list
|
||||
var a = $("<dd><a href='#"+str_nic_tab_id+"'>NIC <i class='icon-remove-sign remove-tab'></i></a></dd>").appendTo($("dl#template_create_network_tabs"));
|
||||
var a = $("<dd><a id='nic_tab"+str_nic_tab_id+"' href='#"+str_nic_tab_id+"'>NIC <i class='icon-remove-sign remove-tab'></i></a></dd>").appendTo($("dl#template_create_network_tabs"));
|
||||
|
||||
$(html_tab_content).appendTo($("ul#template_create_network_tabs_content"));
|
||||
|
||||
$(document).foundationTabs("set_tab", a);
|
||||
|
||||
$('#nic_tab'+str_nic_tab_id).live('click', function(){
|
||||
$("#refresh_template_nic_table_button_class"+str_nic_tab_id).click();
|
||||
});
|
||||
|
||||
var nic_section = $('li#' + str_nic_tab_id + 'Tab', dialog);
|
||||
setup_nic_tab_content(nic_section, str_nic_tab_id, str_datatable_id)
|
||||
|
||||
number_of_nics++;
|
||||
nics_index++;
|
||||
|
||||
$("refresh_template_nic_table_button_class"+str_nic_tab_id).die();
|
||||
|
||||
$("refresh_template_nic_table_button_class"+str_nic_tab_id).live('click', function(){
|
||||
// Retrieve the images to fill the datatable
|
||||
OpenNebula.Network.list({
|
||||
timeout: true,
|
||||
success: function (request, images_list){
|
||||
var network_list_array = [];
|
||||
|
||||
$.each(networks_list,function(){
|
||||
network_list_array.push(vNetworkElementArray(this));
|
||||
});
|
||||
|
||||
var dataTable_template_networks = $("#datatable_template_networks"+str_nic_tab_id.substring(3,str_nic_tab_id.length)).dataTable();
|
||||
updateView(network_list_array, dataTable_template_networks);
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1896,6 +1900,9 @@ function setupCreateTemplateDialog(){
|
||||
'<hr>'+
|
||||
'<div class="row kernel_ds">'+
|
||||
'<div class="row collapse ">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_kernel_table" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="kernel_search" type="text" placeholder="Search"/>'+
|
||||
'</div>'+
|
||||
@@ -1953,6 +1960,9 @@ function setupCreateTemplateDialog(){
|
||||
'<hr>'+
|
||||
'<div class="row initrd_ds">'+
|
||||
'<div class="row collapse ">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_ramdisk_table" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="initrd_search" type="text" placeholder="Search"/>'+
|
||||
'</div>'+
|
||||
@@ -2002,6 +2012,52 @@ function setupCreateTemplateDialog(){
|
||||
'</form>'+
|
||||
'</li>'
|
||||
|
||||
$("#refresh_kernel_table").die();
|
||||
|
||||
$("#refresh_kernel_table").live('click', function(){
|
||||
|
||||
OpenNebula.Image.list({
|
||||
timeout: true,
|
||||
success: function (request, images_list){
|
||||
var image_list_array = [];
|
||||
|
||||
$.each(images_list,function(){
|
||||
var file = fileElementArray(this);
|
||||
if (file)
|
||||
image_list_array.push(file);
|
||||
});
|
||||
|
||||
var dataTable_template_kernel = $('#datatable_kernel').dataTable();
|
||||
updateView(image_list_array, dataTable_template_kernel);
|
||||
dataTable_template_kernel.fnFilter("KERNEL", 7)
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
});
|
||||
|
||||
$("#refresh_ramdisk_table").die();
|
||||
|
||||
$("#refresh_ramdisk_table").live('click', function(){
|
||||
|
||||
OpenNebula.Image.list({
|
||||
timeout: true,
|
||||
success: function (request, images_list){
|
||||
var image_list_array = [];
|
||||
|
||||
$.each(images_list,function(){
|
||||
var file = fileElementArray(this);
|
||||
if (file)
|
||||
image_list_array.push(file);
|
||||
});
|
||||
|
||||
var datTable_template_initrd = $('#datatable_initrd').dataTable();
|
||||
updateView(image_list_array, datTable_template_initrd);
|
||||
datTable_template_initrd.fnFilter("RAMDISK", 7)
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("<dd><a href='#os'>OS Booting</a></dd>").appendTo($("dl#template_create_tabs"));
|
||||
$(html_tab_content).appendTo($("ul#template_create_tabs_content"));
|
||||
@@ -2407,6 +2463,9 @@ function setupCreateTemplateDialog(){
|
||||
'</li>'+
|
||||
'<li class="wizard_internal_tab vm_param" id="filesTab">'+
|
||||
'<div class="row collapse ">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_context_table" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="files_search" type="text" placeholder="Search"/>'+
|
||||
'</div>'+
|
||||
@@ -2474,6 +2533,26 @@ function setupCreateTemplateDialog(){
|
||||
'</form>'+
|
||||
'</li>'
|
||||
|
||||
$("#refresh_context_table").die();
|
||||
|
||||
$("#refresh_context_table").live('click', function(){
|
||||
// Retrieve the nics to fill the datatable
|
||||
OpenNebula.Image.list({
|
||||
timeout: true,
|
||||
success: function (request, files_list){
|
||||
var files_list_array = [];
|
||||
|
||||
$.each(files_list,function(){
|
||||
var image = fileElementArray(this);
|
||||
if (image)
|
||||
files_list_array.push(image);
|
||||
});
|
||||
var datTable_template_context = $('table[id="datatable_context"]').dataTable();
|
||||
updateView(files_list_array, datTable_template_context);
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
});
|
||||
|
||||
$("<dd><a href='#context'>Context</a></dd>").appendTo($("dl#template_create_tabs"));
|
||||
$(html_tab_content).appendTo($("ul#template_create_tabs_content"));
|
||||
@@ -2657,6 +2736,9 @@ function setupCreateTemplateDialog(){
|
||||
'<hr>'+
|
||||
'<div id="req_type" class="host_select row">'+
|
||||
'<div class="row collapse ">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_hosts_placement" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="hosts_search" type="text" placeholder="Search"/>'+
|
||||
'</div>'+
|
||||
@@ -2691,6 +2773,9 @@ function setupCreateTemplateDialog(){
|
||||
'</div>'+
|
||||
'<div id="req_type" class="cluster_select hidden row">'+
|
||||
'<div class="row collapse ">'+
|
||||
'<div class="seven columns">' +
|
||||
'<button id="refresh_clusters_placement" type="button" class="button small radius secondary"><i class="icon-refresh" /></button>' +
|
||||
'</div>' +
|
||||
'<div class="five columns push-seven">'+
|
||||
'<input id="clusters_search" type="text" placeholder="Search"/>'+
|
||||
'</div>'+
|
||||
@@ -2767,6 +2852,28 @@ function setupCreateTemplateDialog(){
|
||||
'</form>'+
|
||||
'</li>'
|
||||
|
||||
$("#refresh_hosts_placement").die();
|
||||
|
||||
$("#refresh_hosts_placement").live('click', function(){
|
||||
// Retrieve the hosts to fill the datatable
|
||||
OpenNebula.Host.list({
|
||||
timeout: true,
|
||||
success: function (request, host_list){
|
||||
var host_list_array = [];
|
||||
|
||||
$.each(host_list,function(){
|
||||
//Grab table data from the host_list
|
||||
host_list_array.push(hostElementArray(this));
|
||||
});
|
||||
|
||||
var dataTable_template_hosts = $("#datatable_template_hosts",dialog).dataTable();
|
||||
updateView(host_list_array, dataTable_template_hosts);
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
$("<dd><a href='#scheduling'>Scheduling</a></dd>").appendTo($("dl#template_create_tabs"));
|
||||
$(html_tab_content).appendTo($("ul#template_create_tabs_content"));
|
||||
@@ -2873,6 +2980,29 @@ function setupCreateTemplateDialog(){
|
||||
generate_requirements();
|
||||
});
|
||||
|
||||
$("#refresh_clusters_placement").die();
|
||||
|
||||
$("#refresh_clusters_placement").live('click', function(){
|
||||
// Retrieve the clusters to fill the datatable
|
||||
|
||||
OpenNebula.Cluster.list({
|
||||
timeout: true,
|
||||
success: function (request, cluster_list){
|
||||
var list_array = [];
|
||||
|
||||
$.each(cluster_list,function(){
|
||||
//Grab table data from the list
|
||||
list_array.push(clusterElementArray(this));
|
||||
});
|
||||
|
||||
var dataTable_template_clusters = $("#datatable_template_clusters",dialog).dataTable();
|
||||
updateView(list_array,dataTable_template_clusters);
|
||||
},
|
||||
error: onError
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
// Clusters TABLE
|
||||
dataTable_template_clusters = $("#datatable_template_clusters", dialog).dataTable({
|
||||
"bSortClasses": false,
|
||||
|
||||
Reference in new issue
Block a user