callback : function (req) { OpenNebulaAction.clear_cache("DATASTORE"); Sunstone.runAction('Cluster.show',req.request.data[0]); },
context.on("change", "#chg_type_select", function() { var new_value = $(this).val(); Sunstone.runAction("Image.chtype", that.element.ID, new_value); });
context.on("change", "#view_select", function() { var sunstone_setting = {DEFAULT_VIEW : $(this).val()}; if (sunstone_setting.DEFAULT_VIEW !== ""){ Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); } });
function getNext() { // Update the template if (disks_and_nets.length == index) { var template_json = { "extra_param": template }; Sunstone.runAction('Template.append_template', template_id, template); VCenterCommon.importSuccess({ context : row_context, message : Locale.tr("Template created successfully. ID: %1$s", template_id) }); } else { if (disks_and_nets[index].type === "NEW_DISK") { var image_json = { "image": { "image_raw": disks_and_nets[index].image_tmpl }, "ds_id" : disks_and_nets[index].ds_id }; OpenNebulaImage.create({ timeout: true, data: image_json, success: function(request, response) { var image_id = response.IMAGE.ID; var image_uname = response.IMAGE.UNAME; ++index; template += "DISK=[\n"; template += "IMAGE_ID=\"" + image_id + "\",\n"; template += "OPENNEBULA_MANAGED=\"NO\"\n"; template += "]\n"; var rollback_info = { type: "IMAGE", id: image_id}; rollback.push(rollback_info); getNext(); }, error: function (request, error_json) { var error_message_str = error_json.error.message; // Rollback VCenterCommon.importFailure({ context : row_context, message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?")) }); rollback_nics_and_disk(error_json.error.message, template_id, rollback, row_context); } }); } if (disks_and_nets[index].type === "EXISTING_DISK") { template += disks_and_nets[index].image_tmpl; ++index; getNext(); } if (disks_and_nets[index].type === "NEW_NIC") { var vnet_json = { "vnet": { "vnet_raw": disks_and_nets[index].network_tmpl } }; var one_cluster_id = disks_and_nets[index].one_cluster_id; OpenNebulaNetwork.create({ timeout: true, data: vnet_json, success: function(request, response) { var network_id = response.VNET.ID; if (one_cluster_id != -1) { Sunstone.runAction("Cluster.addvnet",one_cluster_id,response.VNET.ID); //Remove bnet from default datastore Sunstone.runAction("Cluster.delvnet",0,response.VNET.ID); } duplicated_nics[disks_and_nets[index].network_name]=network_id; ++index; template += "NIC=[\n"; template += "NETWORK_ID=\"" + network_id + "\",\n"; template += "OPENNEBULA_MANAGED=\"NO\"\n"; template += "]\n"; var rollback_info = { type: "NETWORK", id: network_id}; rollback.push(rollback_info); getNext(); }, error: function (request, error_json) { // Rollback VCenterCommon.importFailure({ context : row_context, message : (error_json.error.message || Locale.tr("Cannot contact server: is it running and reachable?")) }); rollback_nics_and_disk(error_json.error.message, template_id, rollback, row_context); } }); } if (disks_and_nets[index] != undefined && disks_and_nets[index].type == "EXISTING_NIC") { template += disks_and_nets[index].network_tmpl; ++index; getNext(); } if (disks_and_nets[index] != undefined && disks_and_nets[index].type == "DUPLICATED_NIC") { var network_id = duplicated_nics[disks_and_nets[index].network_name]; template += "NIC=[\n"; template += "NETWORK_ID=\"" + network_id + "\",\n"; template += "OPENNEBULA_MANAGED=\"NO\"\n"; template += "]\n"; ++index; getNext(); } } }
$.each(that.originalGroupIds, function(index, groupId) { if ($.inArray(groupId, selectedGroupsList) === -1) { Sunstone.runAction('User.delgroup', [that.element.ID], groupId); } });
parent_container.on("click", "#submit_quotas_button", function() { var obj = retrieveQuotasValues(parent_container); Sunstone.runAction(resource_name+".set_quota", [resource_info.ID], obj); return false; });
callback: function(request) { Sunstone.getDialog(QUOTAS_DIALOG_ID).hide(); Sunstone.runAction(RESOURCE+'.show',request.request.data[0]); },
context.on("change", ".input_edit_value_secret", function() { var valueSecret = $(".input_edit_value_secret").val(); that.element["EC2_SECRET"] = valueSecret; Sunstone.runAction(resourceType+".update_template",resourceId, TemplateUtils.templateToString(that.element)); });
function _submitWizard(context) { var that = this; var upload = false; var ds_id = $('#file_datastore .resource_list_select', context).val(); if (!ds_id) { Sunstone.hideFormPanelLoading(TAB_ID); Notifier.notifyError(Locale.tr("Please select a datastore for this file")); return false; } var img_json = {}; var name = $('#file_name', context).val(); img_json["NAME"] = name; var desc = $('#file_desc', context).val(); if (desc.length) { img_json["DESCRIPTION"] = desc; } var type = $('#file_type', context).val(); img_json["TYPE"] = type; switch ($('#src_path_select input:checked', context).val()){ case "path": path = $('#file_path', context).val(); if (path) img_json["PATH"] = path; break; case "upload": upload = true; break; } var img_obj = { "image" : img_json, "ds_id" : ds_id }; //this is an image upload we trigger FileUploader //to start the upload if (upload) { if (that.uploader.files.length == 0) { Sunstone.hideFormPanelLoading(TAB_ID); Notifier.notifyError(Locale.tr("Please select a file to upload")); return false; } Sunstone.resetFormPanel(that.tabId, that.formPanelId); Sunstone.hideFormPanel(that.tabId); that.uploader.on('fileSuccess', function(file) { $('div[id="files-' + file.fileName + '-info"]').text(Locale.tr("Registering in OpenNebula")); $.ajax({ url: 'upload', type: "POST", data: { csrftoken: csrftoken, img : JSON.stringify(img_obj), file: file.fileName, tempfile: file.uniqueIdentifier }, success: function() { Notifier.notifyMessage("Image uploaded correctly"); $('div[id="files-' + file.fileName + 'progressBar"]').remove(); Sunstone.runAction("File.refresh"); }, error: function(response) { Notifier.onError({}, OpenNebulaError(response)); $('div[id="files-' + file.fileName + 'progressBar"]').remove(); } }); }); that.uploader.upload(); } else { Sunstone.runAction("File.create", img_obj); } return false; }
success: function() { Notifier.notifyMessage("Image uploaded correctly"); $('div[id="files-' + file.fileName + 'progressBar"]').remove(); Sunstone.runAction("File.refresh"); },
$(".user-zone-info a.quickconf_view").click(function() { var sunstone_setting = {DEFAULT_VIEW : $(this).attr("view")}; Sunstone.runAction("User.append_sunstone_setting_refresh", -1, sunstone_setting); });
$("#provision_change_language_form").submit(function() { var sunstone_setting = {LANG : $('#provision_new_language', this).val()}; Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); return false; });
$("#provision_change_view_form").submit(function() { var sunstone_setting = {DEFAULT_VIEW : $('#provision_user_views_select', this).val()}; Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); return false; });
context.on("change", ".input_edit_value_region", function() { var valueRegion = $(".input_edit_value_region").val(); that.element["REGION_NAME"] = valueRegion; Sunstone.runAction(resourceType+".update_template",resourceId, TemplateUtils.templateToString(that.element)); });
callback : function (req) { Sunstone.runAction(RESOURCE+'.show',req.request.data[0][0]); },
context.on("change", ".input_edit_value_access", function() { var valueAccess = $(".input_edit_value_access").val(); that.element["EC2_ACCESS"] = valueAccess; Sunstone.runAction(resourceType+".update_template",resourceId, TemplateUtils.templateToString(that.element)); });
context.on("change", "#table_order_select", function() { var sunstone_setting = {TABLE_ORDER : $(this).val()}; if (sunstone_setting.TABLE_ORDER !== ""){ Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); } });
submit : function(){ Sunstone.runAction('Image.snapshot_delete', that.element.ID, { "snapshot_id": snapshot_id}); }
context.on("change", "#language_select", function() { var sunstone_setting = {LANG : $(this).val()}; if (sunstone_setting.LANG !== ""){ Sunstone.runAction("User.append_sunstone_setting_refresh", that.element.ID, sunstone_setting); } });
setTimeout(function() { Sunstone.runAction('User.refresh'); }, 1500);
parent_container.on("click", "#cancel_quotas_button", function() { Sunstone.runAction(resource_name+".show", resource_info.ID); return false; });