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 = $('
'+ - 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(''+ ''+