function _setup(context){ var that = this; Foundation.reflow(context, 'tabs'); $.each(["clusters", "hosts", "vnets", "datastores"], function(i,res_name){ if(that.resources != undefined){ if (that.resources[res_name].length == 1 && that.resources[res_name][0] == VDC_ALL_RESOURCES){ $("#all_"+res_name+"_"+that.unique_id, context).prop("checked", "checked"); } $("#all_"+res_name+"_"+that.unique_id, context).prop("disabled", true); } $("input[name='all_"+res_name+"_"+that.unique_id+"']", context).change(function(){ if ($(this).prop("checked")){ $("div.vdc_"+res_name+"_select", context).hide(); } else { $("div.vdc_"+res_name+"_select", context).show(); } }); }); $.each([that.clustersTable, that.hostsTable, that.vnetsTable, that.datastoresTable], function(){ this.initialize(); }); Tips.setup(context); }
function _setup(context) { var that = this; $(".selectTemplateTable", context).html(this.templatesTable.dataTableHTML); $(".table_wrapper", context).show(); this.templatesTable.initialize(); this.templatesTable.idInput().attr("required", ""); this.templatesTable.idInput().on("change", function(){ var templateId = $(this).val(); var inputs_div = $(".template_user_inputs", context); inputs_div.empty(); OpenNebulaTemplate.show({ data : { id: templateId }, timeout: true, success: function (request, template_json) { UserInputs.vmTemplateInsert( inputs_div, template_json, {text_header: '<i class="fa fa-gears"></i> '+Locale.tr("Custom Attributes")}); }, error: Notifier.onError }); }); Tips.setup(context); return false; }
// Set up the create datastore dialog function _setup(dialog) { Tips.setup(dialog); dialog.on('change', '#MARKET_MAD', function() { _setRequiredFields(dialog, this.value); }); }
function _setup(context) { var that = this; Tips.setup(context); // Template update // TODO: simplify interface? var hiddenKeys = [ "SUNSTONE", "TABLE_DEFAULT_PAGE_LENGTH", "OPENNEBULA"]; var strippedTemplate = $.extend({}, this.element.TEMPLATE); $.each(hiddenKeys, function(i, key){ delete strippedTemplate[key]; }); var hiddenValues = {}; $.each(hiddenKeys, function(i, key){ if (that.element.TEMPLATE[key] != undefined){ hiddenValues[key] = that.element.TEMPLATE[key]; } }); TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues); //=== return false; }
function _setup(context) { var that = this; if (that.snapshotId == -1){ //$(".snapshot_id_row", context).hide(); } else { $(".snapshot_id_row", context).show(); } Tips.setup(context); $('#' + DIALOG_ID + 'Form', context).submit(function() { var image_name = $('#image_name', this).val(); var obj = { "disk_id" : that.diskId, "image_name": image_name, "type": "", "snapshot_id": that.snapshotId, }; Sunstone.runAction('VM.disk_saveas', that.element.ID, obj); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
function _setup(context) { var that = this; that.hostsTable.initialize(); that.datastoresTable.initialize(); Tips.setup(context); $('#' + DIALOG_ID + 'Form', context).submit(function() { var extra_info = {}; if ($("#selected_resource_id_deploy_vm", context).val()) { extra_info['host_id'] = $("#selected_resource_id_deploy_vm", context).val(); } else { Notifier.notifyError(Locale.tr("You have not selected a host")); return false; } extra_info['ds_id'] = $("#selected_resource_id_deploy_vm_ds", context).val() || -1 extra_info['enforce'] = $("#enforce", this).is(":checked") ? true : false $.each(Sunstone.getDataTable(TAB_ID).elements(), function(index, elem) { Sunstone.runAction("VM.deploy_action", elem, extra_info); }); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
function _setup(context) { var that = this; Foundation.reflow(context, 'abide'); $('#' + DIALOG_ID + 'Form', context) .on('forminvalid.zf.abide', function(ev, frm) { Notifier.notifyError(Locale.tr("One or more required fields are missing or malformed.")); }) .on('formvalid.zf.abide', function(ev, frm) { var force = false; if ($("#force", context).is(":checked")) { force = true; } var obj = { "force": force, "cardinality": $("#cardinality", context).val(), }; Sunstone.runAction('Role.update', that.roleIds, obj); return false; }) .on("submit", function(ev) { ev.preventDefault(); }); Tips.setup(context); return false; }
function _setup(context) { var that = this; CustomTagsTable.setup($("#vdcCreateGeneralTab", context)); this.groupsTable.initialize(); // If this is an update, the _fill method may be called before the zone.list // finishes. And resourcesTab.fill only works if all the // resourcesTab.addResourcesZone have finished. // It's better to duplicate this code in _fill and make sure the // resourcesTab.fill is executed in the callback if (this.action != "update") { OpenNebulaZone.list({ timeout: true, success: function (request, obj_list){ var zoneSection = $("#vdcCreateResourcesTab",context); $.each(obj_list,function(){ that.resourcesTab.addResourcesZone( this.ZONE.ID, this.ZONE.NAME, zoneSection); }); that.resourcesTab.setup(zoneSection); }, error: Notifier.onError }); } Foundation.reflow(context, 'tabs'); Tips.setup(); }
$("select[name='repeat']", context).change(function () { var value = $(this).val(); that.repeat = value; var input_html = ""; switch (value) { case "week": input_html = "<div id=\"days_week_value\" style=\"margin: 10px 0 10px 0;\">\ <input type=\"checkbox\" id=\"mon\" name=\"days\" value=\"0\"><label for=\"mon\">" + Locale.tr("Mo") + "</label>\ <input type=\"checkbox\" id=\"tue\" name=\"days\" value=\"1\"><label for=\"tue\">" + Locale.tr("Tu") + "</label>\ <input type=\"checkbox\" id=\"wed\" name=\"days\" value=\"2\"><label for=\"wed\">" + Locale.tr("We") + "</label>\ <input type=\"checkbox\" id=\"thu\" name=\"days\" value=\"3\"><label for=\"thu\">" + Locale.tr("Th") + "</label>\ <input type=\"checkbox\" id=\"fri\" name=\"days\" value=\"4\"><label for=\"fri\">" + Locale.tr("Fr") + "</label>\ <input type=\"checkbox\" id=\"sat\" name=\"days\" value=\"5\"><label for=\"sat\">" + Locale.tr("Sa") + "</label>\ <input type=\"checkbox\" id=\"sun\" name=\"days\" value=\"6\"><label for=\"sun\">" + Locale.tr("Su") + "</label>\ </div>"; break; case "month": input_html = "<div style=\"display: -webkit-box;\"><input style=\"margin-right: 4px;\" id=\"days_month_value\" type=\"text\" placeholder=\"1,31\"/>\ <span class=\"tip\">"+ Locale.tr("Comma separated list of days of the month to repeat the action on. Ex: 1,15,25 repeats the action every first, 15th and 25th day of the month") + " </span></div>"; break; case "year": input_html = "<div style=\"display: -webkit-box;\"><input style=\"margin-right: 4px;\" id=\"days_year_value\" type=\"text\" placeholder=\"0,365\"/>\ <span class=\"tip\">"+ Locale.tr("Comma separated list of days of the year to repeat the action on. Ex: 1,30,330 repeats the action every first, 30th and 330th day of the year") + " </span></div>"; break; case "hour": input_html = "<div style=\"display: -webkit-box;\">\ <label style=\"margin-right: 5px;\">"+ Locale.tr("Each") + "</label>\ <input style=\"margin-right: 4px;\" id=\"days_hour_value\" min=\"0\" max=\"168\" type=\"number\" placeholder=\"5\"/>\ <label> "+ Locale.tr("hours") + "</label>\ </div>"; break; } $("#td_days").html(input_html); Tips.setup(context); });
function _setup(context) { var that = this; $('.resource-info-header', '#' + TAB_ID).text(that.element.NAME); Tips.setup(context); // Template update // TODO: simplify interface? var hiddenKeys = [ "GROUP_ADMIN_VIEWS", "SUNSTONE_VIEWS", "GROUP_ADMIN_DEFAULT_VIEW", "DEFAULT_VIEW", "TABLE_DEFAULT_PAGE_LENGTH"]; var strippedTemplate = $.extend({}, this.element.TEMPLATE); $.each(hiddenKeys, function(i, key){ delete strippedTemplate[key]; }); var hiddenValues = {}; $.each(hiddenKeys, function(i, key){ if (that.element.TEMPLATE[key] != undefined){ hiddenValues[key] = that.element.TEMPLATE[key]; } }); TemplateTable.setup(strippedTemplate, RESOURCE, this.element.ID, context, hiddenValues); //=== return false; }
function _setup(context) { var that = this; Tips.setup(context); $('#' + DIALOG_ID + 'Form', context).submit(function() { var template_name = $('#template_name', this).val(); var persistent = $('#saveas_persistency', this).is(":checked") ? true : false; var vm_id = Sunstone.getDataTable(TAB_ID).elements(); OpenNebula.VM.save_as_template({ data : { id: vm_id, extra_param: { name : template_name, persistent : persistent } }, success: function(request, response){ OpenNebula.Action.clear_cache("VMTEMPLATE"); Notifier.notifyMessage(Locale.tr("VM Template") + ' ' + template_name + ' ' + Locale.tr("saved successfully")) }, error: function(request, response){ Notifier.onError(request, response); } }) Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
function _setup_role_tab_content(role_section,context) { var that = this; this.role_section = role_section; Tips.setup(role_section); this.hostsTable.initialize(); $("#btn_host_vm_roles_anti_affined"+this.html_role_id, context).bind("click",function(){ var selectedHostsList = that.hostsTable.retrieveResourceTableSelect(); var selectedHosts = {}; $.each(selectedHostsList, function(i,e){ selectedHosts[e] = 1; }); var text = ""; for(key in selectedHosts){ _generateBox("ANTI_AFFINED",key,that); } }); $("#btn_host_vm_roles_affined"+this.html_role_id, context).bind("click",function(){ var selectedHostsList = that.hostsTable.retrieveResourceTableSelect(); var selectedHosts = {}; $.each(selectedHostsList, function(i,e){ selectedHosts[e] = 1; }); var text = ""; for(key in selectedHosts){ _generateBox("AFFINED",key,that); } }); }
function _setup(context) { var that = this; InstantiateTemplateFormPanel.prototype.setup.call(this, context); $(".selectTemplateTable", context).html(this.templatesTable.dataTableHTML); $(".table_wrapper", context).show(); $(".no_table_wrapper", context).hide(); this.templatesTable.initialize(); this.templatesTable.idInput().attr("required", ""); this.templatesTable.idInput().on("change", function(){ var template_id = $(this).val(); that.setTemplateId(context, template_id); }); $(".vr_attributes #name", context).on("input", function(){ $('#vm_name', context).val("vr-"+$(this).val()+"-%i"); }); Tips.setup(context); return false; }
dd_context.on("click", ".provision-pricing-table.more-than-one" , function() { var html = '<span style="color: #999; font-size: 14px">' + Locale.tr("INTERFACE") + "</span>  " + '<span style="color: #777;">' + $(this).attr("opennebula_name") + "</span>"; if (options.floatingIP){ html += '<div class="row noclick">' + '<div class="small-12 columns">' + '<label class="inline" style="color: #777; font-size: 16px">' + '<input type="checkbox" class="floating_ip" />' + Locale.tr("Floating IP") + " " + '<span class="tip">' + Locale.tr("If checked, each Virtual Machine will have a floating IP added to its network interface.") + '</span>' + '</label>' + '</div>' + '</div>'; } if (options.forceIPv4){ html += '<div class="row noclick">' + '<div class="small-5 columns">' + '<label class="right inline" style="color: #777; font-size: 16px">' + Locale.tr("Force IPv4:") + " " + '<span class="tip">' + Locale.tr("Optionally, you can force the IP assigned to the network interface.") + '</span>' + '</label>' + '</div>' + '<div class="small-7 columns">' + '<input type="text" class="manual_ip4" />' + '</div>' + '</div>'; } if (options.management){ html += '<div class="noclick">' + '<label style="color: #777; font-size: 16px">' + '<input type="checkbox" class="management" />' + Locale.tr("Management Interface") + " " + '<span class="tip">' + Locale.tr("If checked, this network interface will be a Virtual Router management interface. Traffic will not be forwarded.") + '</span>' + '</label>' + '</div>'; } $(".selected_network", dd_context).html(html); $(".selected_network", dd_context).attr("opennebula_id", $(this).attr("opennebula_id")) $(".selected_network", dd_context).removeAttr("template_nic") Tips.setup($(".selected_network", dd_context)); $('a', dd_context).first().trigger("click"); })
function _onShow(context) { Sunstone.disableFormPanelSubmit(this.tabId); var templatesContext = $(".list_of_vntemplates", context); templatesContext.html(""); Tips.setup(context); return false; }
function _setup(context) { var that = this; Tips.setup(context); $( ".diskSlider", context).html(RangeSlider.html({ min: that.diskSize, max: Humanize.sizeToMB("500GB")*1024, initial: that.diskSize, name: "resize" })); $( ".uinput-slider-val",context).prop('type', 'text'); $( ".uinput-slider-val",context).val(Humanize.size($( ".uinput-slider",context).val())); $( ".uinput-slider", context).on("input", function(){ $( ".uinput-slider-val",context).val(Humanize.size($( ".uinput-slider",context).val())); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*that.diskCost; if(isNaN(cost)){ cost = 0; } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); }); $( ".uinput-slider-val", context).on("change", function(){ $( ".uinput-slider",context).val(Humanize.sizeToMB(($( ".uinput-slider-val",context).val()).toString())*1024); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*that.diskCost; if(isNaN(cost)){ cost = 0; } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); }); var cost = Humanize.sizeToMB($( ".uinput-slider",context).val())*this.diskCost; if(isNaN(cost)){ cost = 0; } document.getElementById("new_cost_resize").textContent = Locale.tr("Cost")+": "+ convertCostNumber(cost); $('#' + DIALOG_ID + 'Form', context).submit(function() { var new_size = $( ".uinput-slider",context).val(); new_size = Math.round(parseInt(new_size) / 1024); new_size = new_size.toString(); var obj = { "vm_id": that.element.ID, "disk_id" : that.diskId, "new_size": new_size }; Sunstone.runAction('VM.disk_resize', that.element.ID, obj); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
function _add_role_tab(role_id, dialog) { var that = this; var html_role_id = 'role' + role_id; var role_tab = new RoleTab(html_role_id); that.roleTabObjects[role_id] = role_tab; // Append the new div containing the tab and add the tab to the list var role_section = $('<div id="'+html_role_id+'Tab" class="tabs-panel role_content wizard_internal_tab" role_id="'+role_id+'">'+ role_tab.html() + '</div>').appendTo($("#roles_tabs_content", dialog)); _redo_service_networks_selector_role(dialog, role_section); Tips.setup(role_section); var a = $("<li class='tabs-title'>\ <a class='text-center' id='"+html_role_id+"' href='#"+html_role_id+"Tab'>\ <span>\ <i class='off-color fas fa-cube fa-3x'/>\ <br>\ <span id='role_name_text'>"+Locale.tr("Role ")+role_id+"</span>\ </span>\ <i class='fas fa-times-circle remove-tab'></i>\ </a>\ </li>").appendTo($("ul#roles_tabs", dialog)); Foundation.reInit($("ul#roles_tabs", dialog)); $("a", a).trigger("click"); // close icon: removing the tab on click a.on("click", "i.remove-tab", function() { var target = $(this).parent().attr("href"); var li = $(this).closest('li'); var ul = $(this).closest('ul'); var content = $(target); var role_id = content.attr("role_id"); li.remove(); content.remove(); if (li.hasClass('is-active')) { $('a', ul.children('li').last()).click(); } delete that.roleTabObjects[role_id]; return false; }); role_tab.setup(role_section); role_tab.onShow(); }
function _onShow(context) { Sunstone.disableFormPanelSubmit(this.tabId); $("input.instantiate_pers", context).change(); var templatesContext = $(".list_of_templates", context); templatesContext.html(""); Tips.setup(context); return false; }
$.each(elements, function(id, element) { var opts = {}; opts.data = element; opts.id = UniqueId.id(); if (element.rp && element.rp !== '') { opts.resourcePool = UserInputs.unmarshall(element.rp); opts.resourcePool.params = opts.resourcePool.params.split(","); /* $.each(opts.resourcePool.params, function(){ $("#available_rps_" + opts.id + " [value ='" + this + "']").mousedown(function(e) { e.preventDefault(); $(this).prop('selected', !$(this).prop('selected')); return false; }); });*/ } var trow = $(RowTemplate(opts)).appendTo(tbody); Tips.setup(trow); $("#modify_rp_" + opts.id).change(function(){ var val = $("#modify_rp_" + opts.id).val(); if (val == "default"){ $("#div_rp_" + opts.id).hide(); } else if (val == "fixed"){ $("#div_rp_" + opts.id).show(); $("#available_rps_" + opts.id).attr("multiple", false); } else { $("#div_rp_" + opts.id).show(); $("#available_rps_" + opts.id).attr("multiple", true); } }); $("#linked_clone_"+opts.id).on("change", function(){ if ($("#linked_clone_"+opts.id).is(":checked")){ $("#create_"+opts.id).show(); } else { $("#create_"+opts.id).hide(); $("#create_copy_"+opts.id).prop("checked", false); $("#name_"+opts.id).hide(); } }); $("#create_copy_"+opts.id).on("change", function(){ if ($("#create_copy_"+opts.id).is(":checked")){ $("#name_"+opts.id).show(); } else { $("#name_"+opts.id).hide(); } }); $('.check_item', trow).data("import_data", element); });
$.each(response, function(template_name, element){ var opts = {}; opts.data = element; opts.id = UniqueId.id(); if (element.rp && element.rp !== "") { opts.resourcePool = UserInputs.unmarshall(element.rp); opts.resourcePool.params = opts.resourcePool.params.split(","); } var trow = $(RowTemplate(opts)).appendTo(tbody); Tips.setup(trow); setupAdvanced(opts, trow); $(".check_item", trow).data("import_data", element); });
function _setup_role_tab_content(role_section) { var that = this; Tips.setup(role_section); this.templatesTable.initialize(); this.templatesTable.idInput().attr("required", ""); role_section.on("change", "#role_name", function(){ $("#" + that.html_role_id +" #role_name_text").html($(this).val()); }); role_section.on("change", "select#type", function(){ var new_tr = $(this).closest('tr'); if ($(this).val() == "PERCENTAGE_CHANGE") { $("#min_adjust_step_td", new_tr).html('<input type="text" id="min_adjust_step" name="min_adjust_step"/>'); } else { $("#min_adjust_step_td", new_tr).empty(); } }); $("#tf_btn_elas_policies", role_section).bind("click", function(){ $( TemplateElasticityRowHTML({}) ).appendTo($("#elasticity_policies_tbody", role_section)); }); role_section.on("click", "#elasticity_policies_table i.remove-tab", function() { var tr = $(this).closest('tr'); tr.remove(); }); $("#tf_btn_sche_policies", role_section).bind("click", function(){ $( TemplateScheRowHTML({}) ).appendTo($("#scheduled_policies_tbody", role_section)); }); role_section.on("click", "#scheduled_policies_table i.remove-tab", function() { var tr = $(this).closest('tr'); tr.remove(); }); $("#tf_btn_elas_policies", role_section).trigger("click"); $("#tf_btn_sche_policies", role_section).trigger("click"); role_section.on("change", ".service_network_checkbox", function(){ var vm_template_contents = ""; $(".service_network_checkbox:checked", role_section).each(function(){ vm_template_contents += "NIC=[NETWORK_ID=\"$"+$(this).val()+"\"]\n"; }); $(".vm_template_contents", role_section).val(vm_template_contents); }); }
function _setup(context) { var that = this; //context.foundation('tabs'); Foundation.reflow(context, 'tabs'); this.userCreation.setup( $("#admin_user_wrapper",context) ); Tips.setup(context); $('input#name', context).change(function(){ var val = $(this).val(); that.userCreation.setName(context, val + "-admin"); }); $('input#admin_user', context).change(function(){ if ($(this).prop('checked')) { that.userCreation.enable( $("#admin_user_wrapper",context) ); } else { that.userCreation.disable( $("#admin_user_wrapper",context) ); } }); this.userCreation.disable( $("#admin_user_wrapper",context) ); $.each($('[id^="group_res"]', context), function(){ $(this).prop("checked", true); }); $("#group_res_net", context).prop("checked", false); $(context).off("change", ".admin_view_input"); $(context).on("change", ".admin_view_input", function(){ _generateViewsSelect(context, "admin"); }); $(context).off("change", ".user_view_input"); $(context).on("change", ".user_view_input", function(){ _generateViewsSelect(context, "user"); }); if (this.action == "create") { $("input#group_view_cloud").prop('checked', true).change(); $("input#group_admin_view_cloud").prop('checked', true).change(); $("input#group_admin_view_groupadmin").prop('checked', true).change(); _generateViewsSelect(context, "admin", "groupadmin"); _generateViewsSelect(context, "user", "cloud"); } }
// Set up the create datastore context function _setup(context) { Tips.setup(context); this.imagesTable.initialize(); this.marketPlacesTable.initialize(); this.marketPlacesTableAdvanced.initialize(); this.imagesTable.idInput(). attr('required', ''). attr('wizard_field', 'ORIGIN_ID'); this.marketPlacesTable.idInput().attr('required', ''); this.marketPlacesTableAdvanced.idInput().attr('required', ''); }
// Set up the create datastore context function _setup(context) { Tips.setup(context); this.datastoresTable.initialize(); this.datastoresTable.idInput().attr('required', ''); $('input#NAME', context).on('input', function(){ var vmname = $("#VMNAME", context).val(); if (vmname == "" || vmname == $(this).data("prev")){ $("#VMNAME", context).val($(this).val()); } $(this).data("prev", $(this).val()); }); }
function _setup(context) { var that = this; NicsSection.insert({}, $(".nicsContext", context), { floatingIP: true, forceIPv6:true, forceIPv4:true, management: true, securityGroups: Config.isFeatureEnabled("secgroups")}); $(".vr_attributes #name", context).on("input", function(){ $('#vm_name', context).val("vr-"+$(this).val()+"-%i"); }); Tips.setup(context); return false; }
function _setup(context) { var that = this; NicsSection.insert({}, $(".nicsContext", context), { floatingIP: true, forceIPv4:true, management: true, securityGroups: Config.isFeatureEnabled("secgroups")}); this.templatesTable.initialize(); this.templatesTable.idInput().attr("required", ""); this.templatesTable.idInput().on("change", function(){ var templateId = $(this).val(); var inputs_div = $(".template_user_inputs", context); inputs_div.empty(); OpenNebulaTemplate.show({ data : { id: templateId }, timeout: true, success: function (request, template_json) { UserInputs.vmTemplateInsert( inputs_div, template_json, {text_header: '<i class="fa fa-gears"></i> '+Locale.tr("Custom Attributes")}); }, error: Notifier.onError }); }); $(".vr_attributes #name", context).on("input", function(){ $('#vm_name', context).val("vr-"+$(this).val()+"-%i"); }); Tips.setup(context); return false; }
function _setup(context) { var that = this; that.hostsTable.initialize(); that.datastoresTable.initialize(); Tips.setup(context); $("#enforce", context).attr("checked", Config.isFeatureEnabled("migrate_enforce")); $('#' + DIALOG_ID + 'Form', context).submit(function() { var extra_info = {}; if ($("#selected_resource_id_migrate_vm", context).val()) { extra_info['host_id'] = $("#selected_resource_id_migrate_vm", context).val(); } else { Notifier.notifyError(Locale.tr("You have not selected a host")); return false; } extra_info['ds_id'] = $("#selected_resource_id_migrate_vm_ds", context).val() || -1 extra_info['enforce'] = $("#enforce", context).is(":checked"); $.each(Sunstone.getDataTable(TAB_ID).elements(), function(index, elem) { if (that.live) { Sunstone.runAction("VM.migrate_live_action", elem, extra_info); } else if (that.type == 0) { Sunstone.runAction("VM.migrate_action", elem, extra_info); } else if (that.type == 1){ Sunstone.runAction("VM.migrate_poff_action", elem, extra_info); } else if (that.type == 2){ Sunstone.runAction("VM.migrate_poff_hard_action", elem, extra_info); } }); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
/* FUNCTION DEFINITIONS */ function _setup(context) { var that = this; InstantiateTemplateFormPanel.prototype.setup.call(this, context); $(".selectTemplateTable", context).html( '<br/>' + this.templatesTable.dataTableHTML + '<br/>'); this.templatesTable.initialize(); $(".instantiate_wrapper", context).hide(); this.templatesTable.idInput().on("change", function(){ $(".instantiate_wrapper", context).show(); var template_id = $(this).val(); that.setTemplateId(context, template_id); }); Tips.setup(context); }
function _setup(context) { var that = this; Tips.setup(context); $('#' + DIALOG_ID + 'Form', context).submit(function() { var snapshot_name = $('#snapshot_name', this).val(); var obj = { "disk_id" : that.diskId, "snapshot_name": snapshot_name }; Sunstone.runAction('VM.disk_snapshot_create', that.element.ID, obj); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }
function _setup(context) { var that = this; that.diskTab.setup(context); Tips.setup(context); $('#' + DIALOG_ID + 'Form', context).submit(function() { var templateJSON = that.diskTab.retrieve(context); var obj = { "DISK": templateJSON } Sunstone.runAction('VM.attachdisk', that.element.ID, obj); Sunstone.getDialog(DIALOG_ID).hide(); Sunstone.getDialog(DIALOG_ID).reset(); return false; }); return false; }