From 617b79ea07701a84bd11a7fdfe78ba823a85c789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 26 Apr 2016 12:56:57 +0200 Subject: [PATCH] Feature #4320: Fix labels removing duplicated IDs --- .../form-panels/create/wizard-tabs/context.js | 54 ++--- .../create/wizard-tabs/context/html.hbs | 49 +++-- .../form-panels/create/wizard-tabs/io.js | 10 +- .../create/wizard-tabs/io/html.hbs | 40 ++-- .../form-panels/create/wizard-tabs/os.js | 4 +- .../create/wizard-tabs/os/html.hbs | 206 +++++++++--------- .../form-panels/create/wizard-tabs/other.js | 11 +- .../create/wizard-tabs/other/html.hbs | 20 +- .../create/wizard-tabs/scheduling/html.hbs | 4 +- .../app/utils/custom-tags-table/html.hbs | 4 +- 10 files changed, 205 insertions(+), 197 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js index ca80eb56dd..267cd6d8c3 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js @@ -108,19 +108,19 @@ define(function(require) { } }); - context.on("change", "select#vcenter_customizations", function(){ + context.on("change", "select.vcenter_customizations", function(){ var option = $("option:selected", this); if (option.attr("custom") == "true"){ - $('input#vcenter_customizations_value', context).show(); + $('input.vcenter_customizations_value', context).show(); } else { - $('input#vcenter_customizations_value', context).hide(); + $('input.vcenter_customizations_value', context).hide(); } - $('input#vcenter_customizations_value', context).val( $(this).val() ); + $('input.vcenter_customizations_value', context).val( $(this).val() ); }); - $('input#vcenter_customizations_value', context).hide(); + $('input.vcenter_customizations_value', context).hide(); OpenNebulaHost.vcenterCustomizations({ data : {}, @@ -136,14 +136,14 @@ define(function(require) { } }); - context.on("change", "input#vcenter_customizations_value", function(){ + context.on("change", "input.vcenter_customizations_value", function(){ var opt = $('option'+ - '[value="'+$('input#vcenter_customizations_value', context).val()+'"]', context); + '[value="'+$('input.vcenter_customizations_value', context).val()+'"]', context); if (opt.size() == 0){ opt = $('option[custom="true"]', context); - $('input#vcenter_customizations_value', context).show(); + $('input.vcenter_customizations_value', context).show(); } opt.attr('selected', 'selected'); @@ -180,14 +180,14 @@ define(function(require) { html += ''; - $("#vcenter_customizations", context).html(html); + $(".vcenter_customizations", context).html(html); } function _retrieve(context) { var templateJSON = {}; if($("input[name='context_type']:checked", context).val() == "context_type_vcenter"){ - var customization = $('input#vcenter_customizations_value', context).val(); + var customization = $('input.vcenter_customizations_value', context).val(); if (customization) { templateJSON["VCENTER_PUBLIC_CLOUD"] = { @@ -198,7 +198,7 @@ define(function(require) { var contextJSON = WizardFields.retrieve(context); $.extend(contextJSON, CustomTagsTable.retrieve(context)); - if ($("#ssh_context", context).is(":checked")) { + if ($(".ssh_context", context).is(":checked")) { var public_key = $("#ssh_public_key", context).val(); if (public_key) { contextJSON["SSH_PUBLIC_KEY"] = TemplateUtils.escapeDoubleQuotes(public_key); @@ -207,11 +207,11 @@ define(function(require) { } } - if ($("#network_context", context).is(":checked")) { + if ($(".network_context", context).is(":checked")) { contextJSON["NETWORK"] = "YES"; } - if ($("#token_context", context).is(":checked")) { + if ($(".token_context", context).is(":checked")) { contextJSON["TOKEN"] = "YES"; } @@ -222,9 +222,9 @@ define(function(require) { contextJSON[name] = "$" + name; }); - var start_script = $("#START_SCRIPT", context).val(); + var start_script = $(".START_SCRIPT", context).val(); if (start_script != "") { - if ($("#ENCODE_START_SCRIPT", context).is(":checked")) { + if ($(".ENCODE_START_SCRIPT", context).is(":checked")) { contextJSON["START_SCRIPT_BASE64"] = btoa(start_script); } else { contextJSON["START_SCRIPT"] = start_script; @@ -255,7 +255,7 @@ define(function(require) { $("input#context_type_vcenter", context).click(); if(this["CUSTOMIZATION_SPEC"]){ - $('input#vcenter_customizations_value', context).val(this["CUSTOMIZATION_SPEC"]).change(); + $('input.vcenter_customizations_value', context).val(this["CUSTOMIZATION_SPEC"]).change(); } else if(userInputsJSON || contextJSON) { $("input#context_type_opennebula", context).click(); } @@ -265,8 +265,8 @@ define(function(require) { }); } - $("#ssh_context", context).removeAttr('checked'); - $("#network_context", context).removeAttr('checked'); + $(".ssh_context", context).removeAttr('checked'); + $(".network_context", context).removeAttr('checked'); if (userInputsJSON) { UserInputs.fill(context, templateJSON); @@ -293,19 +293,19 @@ define(function(require) { var customTagsJSON = {}; $.each(contextJSON, function(key, value) { if (ssh_regexp.test(key)) { - $("#ssh_context", context).prop('checked', 'checked'); + $(".ssh_context", context).prop('checked', 'checked'); if (!publickey_regexp.test(value)) { $("#ssh_public_key", context).val(TemplateUtils.htmlDecode(value)); } } else if (token_regexp.test(key)) { - $("#token_context", context).prop('checked', 'checked'); + $(".token_context", context).prop('checked', 'checked'); } else if (net_regexp.test(key)) { - $("#network_context", context).prop('checked', 'checked'); + $(".network_context", context).prop('checked', 'checked'); } else if ("INIT_SCRIPTS" == key) { - $("input#INIT_SCRIPTS").val(TemplateUtils.htmlDecode(value)); + $("input.INIT_SCRIPTS").val(TemplateUtils.htmlDecode(value)); } else if ("FILES_DS" == key) { - $('#FILES_DS', context).val(TemplateUtils.escapeDoubleQuotes(TemplateUtils.htmlDecode(contextJSON["FILES_DS"]))) + $('.FILES_DS', context).val(TemplateUtils.escapeDoubleQuotes(TemplateUtils.htmlDecode(contextJSON["FILES_DS"]))) var files = []; while (match = file_ds_regexp.exec(value)) { files.push(match[1]) @@ -316,10 +316,10 @@ define(function(require) { } that.contextFilesTable.selectResourceTableSelect(selectedResources); } else if ("START_SCRIPT_BASE64" == key) { - $("#ENCODE_START_SCRIPT", context).prop('checked', 'checked'); - $("#START_SCRIPT", context).val(atob(value)); + $(".ENCODE_START_SCRIPT", context).prop('checked', 'checked'); + $(".START_SCRIPT", context).val(atob(value)); } else if ("START_SCRIPT" == key) { - $("#START_SCRIPT", context).val(TemplateUtils.escapeDoubleQuotes(TemplateUtils.htmlDecode(value))); + $(".START_SCRIPT", context).val(TemplateUtils.escapeDoubleQuotes(TemplateUtils.htmlDecode(value))); } else { customTagsJSON[key] = value; } @@ -339,6 +339,6 @@ define(function(require) { req_string.push("$FILE[IMAGE_ID="+ fileId +"]"); }); - $('#FILES_DS', context).val(req_string.join(" ")); + $('.FILES_DS', context).val(req_string.join(" ")); }; }); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context/html.hbs index ffcc2fb36c..292e42cf3c 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context/html.hbs @@ -25,12 +25,15 @@
@@ -53,8 +56,8 @@
- -
- -