From cac60e589a937ec0669aa6e7eb0792cef711eb2a Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 26 Sep 2014 13:23:15 +0200 Subject: [PATCH] feature #2911: Remove debugging code --- src/sunstone/public/js/plugins/hosts-tab.js | 114 ++++++++++---------- 1 file changed, 55 insertions(+), 59 deletions(-) diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index 562315e18d..785b5714de 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -1019,7 +1019,6 @@ function setupCreateHostDialog(){ "X_VCENTER_HOST": $("#vcenter_host", $create_host_dialog).val() }, success: function(response){ - console.log(response); $("#vcenter_user", $create_host_dialog).attr("disabled", "disabled") $("#vcenter_password", $create_host_dialog).attr("disabled", "disabled") $("#vcenter_host", $create_host_dialog).attr("disabled", "disabled") @@ -1099,7 +1098,7 @@ function setupCreateHostDialog(){ }, success: function(response){ $(".content", templates_container).html(""); - console.log(response); + $.each(response, function(id, template){ var trow = $('
' + '
' + @@ -1152,10 +1151,8 @@ function setupCreateHostDialog(){ if (!cluster_id) cluster_id = "-1"; $.each($(".cluster_name:checked", $create_host_dialog), function(){ - console.log($(this).data("cluster_name")); - - var context = $(this).closest(".vcenter_cluster"); - $(".vcenter_host_result:not(.success)", context).html(''+ + var cluster_context = $(this).closest(".vcenter_cluster"); + $(".vcenter_host_result:not(.success)", cluster_context).html(''+ ''+ ''+ ''); @@ -1173,70 +1170,69 @@ function setupCreateHostDialog(){ OpenNebula.Host.create({ timeout: true, data: host_json, - success: function (cluster_context){ - return function(request, response) { - $(".vcenter_host_result", cluster_context).addClass("success").html( - ''+ - ''+ - ''+ - ''); + success: function(request, response) { + OpenNebula.Helper.clear_cache("HOST"); - $(".vcenter_host_response", cluster_context).html('

'+ - tr("Host created successfully")+' ID:'+response.HOST.ID+ - '

'); + $(".vcenter_host_result", cluster_context).addClass("success").html( + ''+ + ''+ + ''+ + ''); - var template_raw = - "VCENTER_USER=\"" + $("#vcenter_user", $create_host_dialog).val() + "\"\n" + - "VCENTER_PASSWORD=\"" + $("#vcenter_password", $create_host_dialog).val() + "\"\n" + - "VCENTER_HOST=\"" + $("#vcenter_host", $create_host_dialog).val() + "\"\n"; + $(".vcenter_host_response", cluster_context).html('

'+ + tr("Host created successfully")+' ID:'+response.HOST.ID+ + '

'); - Sunstone.runAction("Host.update_template", response.HOST.ID, template_raw); + var template_raw = + "VCENTER_USER=\"" + $("#vcenter_user", $create_host_dialog).val() + "\"\n" + + "VCENTER_PASSWORD=\"" + $("#vcenter_password", $create_host_dialog).val() + "\"\n" + + "VCENTER_HOST=\"" + $("#vcenter_host", $create_host_dialog).val() + "\"\n"; - $.each($(".template_name:checked", cluster_context), function(){ - console.log($(this).data("one_template")); + Sunstone.runAction("Host.update_template", response.HOST.ID, template_raw); - var template_context = $(this).closest(".vcenter_template"); + $.each($(".template_name:checked", cluster_context), function(){ + var template_context = $(this).closest(".vcenter_template"); - $(".vcenter_template_result:not(.success)", template_context).html( + $(".vcenter_template_result:not(.success)", template_context).html( + ''+ + ''+ + ''+ + ''); + + var template_json = { + "vmtemplate": { + "template_raw": $(this).data("one_template") + } + }; + + OpenNebula.Template.create({ + timeout: true, + data: template_json, + success: function(request, response) { + OpenNebula.Helper.clear_cache("VMTEMPLATE"); + $(".vcenter_template_result", template_context).addClass("success").html( ''+ ''+ - ''+ + ''+ ''); - var template_json = { - "vmtemplate": { - "template_raw": $(this).data("one_template") - } - }; + $(".vcenter_template_response", template_context).html('

'+ + tr("Template created successfully")+' ID:'+response.VMTEMPLATE.ID+ + '

'); + }, + error: function (request, error_json){ + $(".vcenter_template_result", template_context).html(''+ + ''+ + ''+ + ''); - OpenNebula.Template.create({ - timeout: true, - data: template_json, - success: function(request, response) { - $(".vcenter_template_result", template_context).addClass("success").html( - ''+ - ''+ - ''+ - ''); - - $(".vcenter_template_response", template_context).html('

'+ - tr("Template created successfully")+' ID:'+response.VMTEMPLATE.ID+ - '

'); - }, - error: function (request, error_json){ - $(".vcenter_template_result", template_context).html(''+ - ''+ - ''+ - ''); - - $(".vcenter_template_response", template_context).html('

'+ - (error_json.error.message || tr("Cannot contact server: is it running and reachable?"))+ - '

'); - } - }); - }) - }; - }(context), + $(".vcenter_template_response", template_context).html('

'+ + (error_json.error.message || tr("Cannot contact server: is it running and reachable?"))+ + '

'); + } + }); + }) + }, error: function (request, error_json){ $(".vcenter_host_result", context).html(''+ ''+