'+
- '
' +
- '' +
- '
' +
- '
'+
- '
'+
+ '
'+
+ '
'+
+ '
' +
+ '' +
+ '
' +
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ ''+
+ ' | '+
+ '' + tr("ID") + ' | '+
+ '' + tr("Name") + ' | '+
+ '' + tr("Hosts") + ' | '+
+ '' + tr("VNets") + ' | '+
+ '' + tr("Datastores") + ' | '+
+ '
'+
+ ''+
+ ''+
+ ''+
+ '
'+
+ '
'+
+ '
'+
+ ''+tr("Please select one or more clusters from the list")+' '+
+ ''+tr("You selected the following clusters:")+' '+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '
'+tr("Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM")+'.
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ ''+
+ '
'+
+ ' '+tr("Packing")+
+ '
'+
+ '
'+
+ '
'+tr("Pack the VMs in the cluster nodes to reduce VM fragmentation")+'
'+
+ '
'+
+ '
'+
+ ' '+tr("Stripping")+
+ '
'+
+ '
'+
+ '
'+tr("Spread the VMs in the cluster nodes")+'
'+
+ '
'+
+ '
'+
+ ' '+tr("Load-aware")+
+ '
'+
+ '
'+
+ '
'+tr("Maximize the resources available to VMs in a node")+'
'+
+ '
'+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ ''+
+ '
'+
+ '
'+
+ '
'+tr("This field sets which attribute will be used to sort the suitable hosts for this VM")+'.
'+
'
'+
'
'+
- ''+
- '
'+
- ''+
- ''+tr("Please select one or more clusters from the list")+' '+
- ''+tr("You selected the following clusters:")+' '+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- '
'+tr("Boolean expression that rules out provisioning hosts from list of machines suitable to run this VM")+'.
'+
- '
'+
- '
'+
- ''+
- '
'+
- ''+
- '
'+
- ' '+tr("Packing")+
- '
'+
- '
'+
- '
'+tr("Pack the VMs in the cluster nodes to reduce VM fragmentation")+'
'+
- '
'+
- '
'+
- ' '+tr("Stripping")+
- '
'+
- '
'+
- '
'+tr("Spread the VMs in the cluster nodes")+'
'+
- '
'+
- '
'+
- ' '+tr("Load-aware")+
- '
'+
- '
'+
- '
'+tr("Maximize the resources available to VMs in a node")+'
'+
- '
'+
- '
'+
- '
'+
- ''+
- '
'+
- ''+
- '
'+
- '
'+
- ''+
- '
'+
- '
'+
- '
'+tr("This field sets which attribute will be used to sort the suitable hosts for this VM")+'.
'+
- '
'+
- '
'+
- ''+
- ''+
- ''+
- ''
-
- $("#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
- });
- }
- );
-
+ ''+
+ ''+
+ ''+
+ ''
$("
Scheduling").appendTo($("dl#template_create_tabs"));
$(html_tab_content).appendTo($("ul#template_create_tabs_content"));
- //$('#tabs-scheduling', dialog).tabs();
+ var dataTable_template_hosts = $("#datatable_template_hosts",dialog).dataTable({
+ "iDisplayLength": 4,
+ "sDom" : '<"H">t<"F"p>',
+ "bAutoWidth":false,
+ "aoColumnDefs": [
+ { "sWidth": "35px", "aTargets": [0,1] },
+ { "bVisible": false, "aTargets": [3,5,7,10,11,12]}
+ ]
+ });
- // hOSTS TABLE
- dataTable_template_hosts = $("#datatable_template_hosts",dialog).dataTable({
- "bSortClasses": false,
- "iDisplayLength": 4,
- "sDom" : '<"H">t<"F"p>',
- "oColVis": { //exclude checkbox column
- "aiExclude": [ 0 ]
- },
- "bAutoWidth":false,
- "aoColumnDefs": [
- { "sWidth": "35px", "aTargets": [0,1] },
- { "bVisible": false, "aTargets": [0,3,5,7,10,11,12]}
- ],
- "oLanguage": (datatable_lang != "") ?
- {
- sUrl: "locale/"+lang+"/"+datatable_lang
- } : ""
- });
+ $("#refresh_hosts_placement").die();
+ $("#refresh_hosts_placement").live('click', function(){
+ update_datatable_template_hosts(dataTable_template_hosts)
+ });
+ update_datatable_template_hosts(dataTable_template_hosts);
- //preload it
- //addElement([spinner,'','','','','','','','','','','',''],dataTable_template_hosts);
+ $('#hosts_search', dialog).keyup(function(){
+ dataTable_template_hosts.fnFilter( $(this).val() );
+ })
- OpenNebula.Host.list({
- timeout: true,
- success: function (request, host_list){
- var host_list_array = [];
+ var selected_hosts = {};
+ var host_row_hash = {};
- $.each(host_list,function(){
- //Grab table data from the host_list
- host_list_array.push(hostElementArray(this));
- });
+ $('#datatable_template_hosts', dialog).delegate("tr", "click", function(e){
+ console.log("pepepepe")
+ var aData = dataTable_template_hosts.fnGetData(this);
+ var host_id = aData[1];
- updateView(host_list_array, dataTable_template_hosts);
- },
- error: onError
- });
+ if ($.isEmptyObject(selected_hosts)) {
+ $('#hosts_selected', dialog).show();
+ $('#select_hosts', dialog).hide();
+ }
- $('#hosts_search', dialog).keyup(function(){
- dataTable_template_hosts.fnFilter( $(this).val() );
- })
+ if(!$("td:first", this).hasClass('markrowchecked')) {
+ $('input.check_item', this).attr('checked','checked');
+ selected_hosts[host_id]=1;
+ host_row_hash[host_id]=this;
+ $(this).children().each(function(){$(this).addClass('markrowchecked');});
+ if ($('#tag_host_'+aData[1], $('div#selected_hosts_template', dialog)).length == 0 ) {
+ $('div#selected_hosts_template', dialog).append('
'+aData[2]+' ');
+ }
+ } else {
+ $('input.check_item', this).removeAttr('checked');
+ delete selected_hosts[host_id];
+ $(this).children().each(function(){$(this).removeClass('markrowchecked');});
+ $('div#selected_hosts_template span#tag_host_'+host_id, dialog).remove();
+ }
- var selected_hosts = {};
- var host_row_hash = {};
+ if ($.isEmptyObject(selected_hosts)) {
+ $('#hosts_selected', dialog).hide();
+ $('#select_hosts', dialog).show();
+ }
- $('#datatable_template_hosts', dialog).delegate("tr", "click", function(e){
- if ($(e.target).is('input') ||
- $(e.target).is('select') ||
- $(e.target).is('option')) return true;
+ $('.alert-box', $('li#schedulingTab .host_select')).hide();
- var aData = dataTable_template_hosts.fnGetData(this);
- var host_id = aData[1];
+ generate_requirements();
- if ($.isEmptyObject(selected_hosts)) {
- $('#hosts_selected', dialog).show();
- $('#select_hosts', dialog).hide();
- }
+ return true;
+ });
- if(!$("td:first", this).hasClass('markrow'))
- {
- selected_hosts[host_id]=1;
- host_row_hash[host_id]=this;
- $(this).children().each(function(){$(this).addClass('markrow');});
- $('div#selected_hosts_template', dialog).append('
'+aData[2]+' ');
- }
- else
- {
+ $( "#selected_hosts_template span.icon-remove" ).live( "click", function() {
+ $(this).parent().remove();
+ var id = $(this).parent().attr("ID");
+
+ var host_id=id.substring(9,id.length);
delete selected_hosts[host_id];
- $(this).children().each(function(){$(this).removeClass('markrow');});
- $('div#selected_hosts_template span#tag_host_'+host_id, dialog).remove();
- }
+ $(host_row_hash[host_id]).children().each(function(){$(this).removeClass('markrowchecked');});
- if ($.isEmptyObject(selected_hosts)) {
- $('#hosts_selected', dialog).hide();
- $('#select_hosts', dialog).show();
- }
+ if ($.isEmptyObject(selected_hosts)) {
+ $('#hosts_selected', dialog).hide();
+ $('#select_hosts', dialog).show();
+ }
- $('.alert-box', $('li#schedulingTab .host_select')).hide();
+ generate_requirements();
+ });
- generate_requirements();
+ // Clusters TABLE
+ var dataTable_template_clusters = $("#datatable_template_clusters", dialog).dataTable({
+ "iDisplayLength": 4,
+ "sDom" : '<"H">t<"F"p>',
+ "bAutoWidth":false,
+ "aoColumnDefs": [
+ { "sWidth": "35px", "aTargets": [0,1] },
+ { "bVisible": false, "aTargets": []}
+ ]
+ });
- return false;
- });
+ $("#refresh_clusters_placement").die();
+ $("#refresh_clusters_placement").live('click', function(){
+ update_datatable_template_clusters(dataTable_template_clusters);
+ });
- $( "#selected_hosts_template span.icon-remove" ).live( "click", function() {
- $(this).parent().remove();
- var id = $(this).parent().attr("ID");
+ update_datatable_template_clusters(dataTable_template_clusters);
- var host_id=id.substring(9,id.length);
- delete selected_hosts[host_id];
- $(host_row_hash[host_id]).children().each(function(){$(this).removeClass('markrow');});
+ $('#clusters_search', dialog).keyup(function(){
+ dataTable_template_clusters.fnFilter( $(this).val() );
+ })
- if ($.isEmptyObject(selected_hosts)) {
- $('#hosts_selected', dialog).hide();
- $('#select_hosts', dialog).show();
- }
+ var selected_clusters = {};
+ var cluster_row_hash = {};
- generate_requirements();
- });
+ $('#datatable_template_clusters', dialog).delegate("tr", "click", function(e){
+ var aData = dataTable_template_clusters.fnGetData(this);
+ var cluster_id = aData[1];
- $("#refresh_clusters_placement").die();
+ if ($.isEmptyObject(selected_clusters)) {
+ $('#clusters_selected', dialog).show();
+ $('#select_clusters', dialog).hide();
+ }
- $("#refresh_clusters_placement").live('click', function(){
- // Retrieve the clusters to fill the datatable
+ if(!$("td:first", this).hasClass('markrowchecked'))
+ {
+ $('input.check_item', this).attr('checked','checked');
+ selected_clusters[cluster_id]=1;
+ cluster_row_hash[cluster_id]=this;
+ $(this).children().each(function(){$(this).addClass('markrowchecked');});
+ if ($('#tag_cluster_'+aData[1], $('div#selected_clusters_template', dialog)).length == 0 ) {
+ $('div#selected_clusters_template', dialog).append('
'+aData[2]+' ');
+ }
+ }
+ else
+ {
+ $('input.check_item', this).removeAttr('checked');
+ delete selected_clusters[cluster_id];
+ $(this).children().each(function(){$(this).removeClass('markrowchecked');});
+ $('div#selected_clusters_template span#tag_cluster_'+cluster_id, dialog).remove();
+ }
- 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));
+ if ($.isEmptyObject(selected_clusters)) {
+ $('#clusters_selected', dialog).hide();
+ $('#select_clusters', dialog).show();
+ }
+
+ $('.alert-box', $('li#schedulingTab .cluster_select')).hide();
+
+ generate_requirements();
+
+ return true;
+ });
+
+ $( "#selected_clusters_template span.icon-remove" ).live( "click", function() {
+ $(this).parent().remove();
+ var id = $(this).parent().attr("ID");
+
+ var cluster_id=id.substring(12,id.length);
+ delete selected_clusters[cluster_id];
+ $(cluster_row_hash[cluster_id]).children().each(function(){$(this).removeClass('markrowchecked');});
+
+ if ($.isEmptyObject(selected_clusters)) {
+ $('#clusters_selected', dialog).hide();
+ $('#select_clusters', dialog).show();
+ }
+
+ generate_requirements();
+ });
+
+ // Select Image or Volatile disk. The div is hidden depending on the selection, and the
+ // vm_param class is included to be computed when the template is generated.
+ $("input[name='req_select']").change(function(){
+ if ($("input[name='req_select']:checked").val() == "host_select") {
+ $("div.host_select", $('li#schedulingTab')).toggle();
+ $("div.host_select", $('li#schedulingTab')).addClass('vm_param');
+ $("div.cluster_select", $('li#schedulingTab')).hide();
+ $("div.cluster_select", $('li#schedulingTab')).removeClass('vm_param');
+ }
+ else {
+ $("div.host_select", $('li#schedulingTab')).hide();
+ $("div.host_select", $('li#schedulingTab')).removeClass('vm_param');
+ $("div.cluster_select", $('li#schedulingTab')).toggle();
+ $("div.cluster_select", $('li#schedulingTab')).addClass('vm_param');
+ }
+ });
+
+ $("input[name='rank_select']").change(function(){
+ $("#RANK", dialog).val(this.value);
+ });
+
+ var generate_requirements = function() {
+ var req_string=[];
+
+ $.each(selected_hosts, function(key, value) {
+ req_string.push('ID=\\"'+key+'\\"');
});
- var dataTable_template_clusters = $("#datatable_template_clusters",dialog).dataTable();
- updateView(list_array,dataTable_template_clusters);
- },
- error: onError
- });
- }
- );
+ $.each(selected_clusters, function(key, value) {
+ req_string.push('CLUSTER_ID=\\"'+key+'\\"');
+ });
- // Clusters TABLE
- dataTable_template_clusters = $("#datatable_template_clusters", dialog).dataTable({
- "bSortClasses": false,
- "iDisplayLength": 4,
- "sDom" : '<"H">t<"F"p>',
- "oColVis": {
- "aiExclude": [ 0 ]
- },
- "bAutoWidth":false,
- "aoColumnDefs": [
- { "sWidth": "35px", "aTargets": [0,1] },
- { "bVisible": false, "aTargets": [0]}
- ],
- "oLanguage": (datatable_lang != "") ?
- {
- sUrl: "locale/"+lang+"/"+datatable_lang
- } : ""
- });
-
- //preload it
-
- //addElement([spinner,'','','','',''],dataTable_template_clusters);
-
- 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));
- });
-
- updateView(list_array,dataTable_template_clusters);
- },
- error: onError
- });
-
-
- $('#clusters_search', dialog).keyup(function(){
- dataTable_template_clusters.fnFilter( $(this).val() );
- })
-
- var selected_clusters = {};
- var cluster_row_hash = {};
-
- $('#datatable_template_clusters', dialog).delegate("tr", "click", function(e){
- if ($(e.target).is('input') ||
- $(e.target).is('select') ||
- $(e.target).is('option')) return true;
-
- var aData = dataTable_template_clusters.fnGetData(this);
- var cluster_id = aData[1];
-
- if ($.isEmptyObject(selected_clusters)) {
- $('#clusters_selected', dialog).show();
- $('#select_clusters', dialog).hide();
- }
-
- if(!$("td:first", this).hasClass('markrow'))
- {
- selected_clusters[cluster_id]=1;
- cluster_row_hash[cluster_id]=this;
- $(this).children().each(function(){$(this).addClass('markrow');});
- $('div#selected_clusters_template', dialog).append('
'+aData[2]+' ');
- }
- else
- {
- delete selected_clusters[cluster_id];
- $(this).children().each(function(){$(this).removeClass('markrow');});
- $('div#selected_clusters_template span#tag_cluster_'+cluster_id, dialog).remove();
- }
-
-
- if ($.isEmptyObject(selected_clusters)) {
- $('#clusters_selected', dialog).hide();
- $('#select_clusters', dialog).show();
- }
-
- $('.alert-box', $('li#schedulingTab .cluster_select')).hide();
-
- generate_requirements();
-
- return false;
- });
-
- $( "#selected_clusters_template span.icon-remove" ).live( "click", function() {
- $(this).parent().remove();
- var id = $(this).parent().attr("ID");
-
- var cluster_id=id.substring(12,id.length);
- delete selected_clusters[cluster_id];
- $(cluster_row_hash[cluster_id]).children().each(function(){$(this).removeClass('markrow');});
-
- if ($.isEmptyObject(selected_clusters)) {
- $('#clusters_selected', dialog).hide();
- $('#select_clusters', dialog).show();
- }
-
- generate_requirements();
- });
-
- // Select Image or Volatile disk. The div is hidden depending on the selection, and the
- // vm_param class is included to be computed when the template is generated.
- $("input[name='req_select']").change(function(){
- if ($("input[name='req_select']:checked").val() == "host_select") {
- $("div.host_select", $('li#schedulingTab')).toggle();
- $("div.host_select", $('li#schedulingTab')).addClass('vm_param');
- $("div.cluster_select", $('li#schedulingTab')).hide();
- $("div.cluster_select", $('li#schedulingTab')).removeClass('vm_param');
- }
- else {
- $("div.host_select", $('li#schedulingTab')).hide();
- $("div.host_select", $('li#schedulingTab')).removeClass('vm_param');
- $("div.cluster_select", $('li#schedulingTab')).toggle();
- $("div.cluster_select", $('li#schedulingTab')).addClass('vm_param');
- }
- });
-
- $("input[name='rank_select']").change(function(){
- $("#RANK", dialog).val(this.value);
- });
-
- var generate_requirements = function() {
- var req_string=[];
-
- $.each(selected_hosts, function(key, value) {
- req_string.push('ID=\\"'+key+'\\"');
- });
-
- $.each(selected_clusters, function(key, value) {
- req_string.push('CLUSTER_ID=\\"'+key+'\\"');
- });
-
- $('#REQUIREMENTS', dialog).val(req_string.join(" | "));
- };
+ $('#REQUIREMENTS', dialog).val(req_string.join(" | "));
+ };
}
@@ -3258,32 +3208,11 @@ function setupCreateTemplateDialog(){
dialog.html(create_template_tmpl);
-
- //Prepare jquery dialog
- var height = Math.floor($(window).height()*0.9); //set height to a percentage of the window
- //dialog.dialog({
- // autoOpen: false,
- // modal: true,
- // width: 'auto',
- // height: height
- //});
dialog.addClass("reveal-modal xlarge max-height")
var tabs = $( "#template_create_tabs", dialog)//.tabs().addClass("ui-tabs-vertical");
-
- //$('#wizard_next').click(function(){
- // var selected = tabs.tabs('option', 'active');
- // tabs.tabs("option", "active", selected+1);
- //});
-//
- //$('#wizard_previous').click(function(){
- // var selected = tabs.tabs('option', 'active');
- // tabs.tabs("option", "active", selected-1);
- //});
-
-
$('#template_template_reset_button').click(function(){
$create_template_dialog.trigger('reveal:close');
$create_template_dialog.remove();
@@ -4080,42 +4009,31 @@ function fillTemplatePopUp(request, response){
if (hosts.length != 0) {
var dataTable_template_hosts = $("#datatable_template_hosts").dataTable();
- OpenNebula.Host.list({
- timeout: true,
- success: function (request, host_list){
- var host_list_array = [];
+ update_datatable_template_hosts(dataTable_template_hosts, function(){
+ dataTable_template_hosts.unbind('draw');
- $.each(host_list,function(){
- //Grab table data from the host_list
- host_list_array.push(hostElementArray(this));
- });
+ var rows = dataTable_template_hosts.fnGetNodes();
- updateView(host_list_array, dataTable_template_hosts);
+ for (var j=0;j
×'+
'';
- $("#datatable_template_hosts_wrapper", req_section).append(alert);
- }
- },
- error: onError
+ $("#datatable_template_hosts_wrapper", req_section).append(alert);
+ }
});
}
@@ -4124,42 +4042,31 @@ tr('The following HOSTs: [') + hosts.join(', ') + '] ' + tr(" do not exist any m
var dataTable_template_clusters = $("#datatable_template_clusters").dataTable();
- OpenNebula.Cluster.list({
- timeout: true,
- success: function (request, cluster_list){
- var cluster_list_array = [];
+ update_datatable_template_clusters(dataTable_template_clusters, function(){
+ dataTable_template_hosts.unbind('draw');
- $.each(cluster_list,function(){
- //Grab table data from the cluster_list
- cluster_list_array.push(clusterElementArray(this));
- });
+ var rows = dataTable_template_clusters.fnGetNodes();
- updateView(cluster_list_array, dataTable_template_clusters);
+ for (var j=0;j