diff --git a/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js b/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js index 809976472e..f94ba5e5ad 100644 --- a/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/vnets-tab/form-panels/create.js @@ -20,30 +20,30 @@ define(function(require) { */ // require('foundation.tab'); - var BaseFormPanel = require('utils/form-panels/form-panel'); - var Sunstone = require('sunstone'); - var Locale = require('utils/locale'); - var Tips = require('utils/tips'); - var CustomTagsTable = require('utils/custom-tags-table'); - var ArTab = require('tabs/vnets-tab/utils/ar-tab'); - var SecurityGroupsTable = require('tabs/secgroups-tab/datatable'); - var TemplateUtils = require('utils/template-utils'); - var WizardFields = require('utils/wizard-fields'); - var ResourceSelect = require('utils/resource-select'); + var BaseFormPanel = require("utils/form-panels/form-panel"); + var Sunstone = require("sunstone"); + var Locale = require("utils/locale"); + var Tips = require("utils/tips"); + var CustomTagsTable = require("utils/custom-tags-table"); + var ArTab = require("tabs/vnets-tab/utils/ar-tab"); + var SecurityGroupsTable = require("tabs/secgroups-tab/datatable"); + var TemplateUtils = require("utils/template-utils"); + var WizardFields = require("utils/wizard-fields"); + var ResourceSelect = require("utils/resource-select"); /* TEMPLATES */ - var TemplateWizardHTML = require('hbs!./create/wizard'); - var TemplateAdvancedHTML = require('hbs!./create/advanced'); + var TemplateWizardHTML = require("hbs!./create/wizard"); + var TemplateAdvancedHTML = require("hbs!./create/advanced"); /* CONSTANTS */ - var FORM_PANEL_ID = require('./create/formPanelId'); - var TAB_ID = require('../tabId'); + var FORM_PANEL_ID = require("./create/formPanelId"); + var TAB_ID = require("../tabId"); /* CONSTRUCTOR @@ -53,15 +53,15 @@ define(function(require) { this.formPanelId = FORM_PANEL_ID; this.tabId = TAB_ID; this.actions = { - 'create': { - 'title': Locale.tr("Create Virtual Network"), - 'buttonText': Locale.tr("Create"), - 'resetButton': true + "create": { + "title": Locale.tr("Create Virtual Network"), + "buttonText": Locale.tr("Create"), + "resetButton": true }, - 'update': { - 'title': Locale.tr("Update Virtual Network"), - 'buttonText': Locale.tr("Update"), - 'resetButton': false + "update": { + "title": Locale.tr("Update Virtual Network"), + "buttonText": Locale.tr("Update"), + "resetButton": false } }; @@ -96,9 +96,9 @@ define(function(require) { this.securityGroupsTable = new SecurityGroupsTable("vnet_create", opts); return TemplateWizardHTML({ - 'formPanelId': this.formPanelId, - 'customTagsHTML': CustomTagsTable.html(), - 'securityGroupsTableHTML': this.securityGroupsTable.dataTableHTML + "formPanelId": this.formPanelId, + "customTagsHTML": CustomTagsTable.html(), + "securityGroupsTableHTML": this.securityGroupsTable.dataTableHTML }); } @@ -117,7 +117,7 @@ define(function(require) { that.addARTab(number_of_ar, context); number_of_ar++; var mode = $("#network_mode", context).val(); - if(mode == "vcenter"){ + if (mode == "vcenter"){ $(".sec_groups_datatable", context).hide(); } return false; @@ -125,108 +125,109 @@ define(function(require) { $("#vnetCreateARTab #vnetCreateARTabUpdate", context).hide(); - $('#network_mode', context).change(function() { + $("#network_mode", context).change(function() { $("div.mode_param", context).hide(); - $("div.mode_param [wizard_field]", context).prop('wizard_field_disabled', true); + $("div.mode_param [wizard_field]", context).prop("wizard_field_disabled", true); - $('input#vn_mad', context).removeAttr('required'); - $('input#vn_mad', context).removeAttr('value'); - $('#vcenter_switch_name', context).removeAttr('required'); - $('#vcenter_cluster_id', context).removeAttr('required'); + $("input#vn_mad", context).removeAttr("required"); + $("input#vn_mad", context).removeAttr("value"); + $("#vcenter_switch_name", context).removeAttr("required"); + $("#vcenter_cluster_id", context).removeAttr("required"); $(".sec_groups_datatable", context).show(); - $('#vnetCreateSecurityTab-label').show(); + $("#vnetCreateSecurityTab-label").show(); switch ($(this).val()) { case "dummy": $("div.mode_param.dummy", context).show(); - $("div.mode_param.dummy [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.dummy [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).attr('required', ''); + $("input#bridge", context).attr("required", ""); break; case "fw": $("div.mode_param.fw", context).show(); - $("div.mode_param.fw [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.fw [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).attr('required', ''); + $("input#bridge", context).attr("required", ""); break; case "802.1Q": $("div.mode_param.8021Q", context).show(); - $("div.mode_param.8021Q [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.8021Q [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).removeAttr('required'); + $("input#bridge", context).removeAttr("required"); break; case "vxlan": $("div.mode_param.vxlan", context).show(); - $("div.mode_param.vxlan [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.vxlan [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).removeAttr('required'); + $("input#bridge", context).removeAttr("required"); break; case "ebtables": $("div.mode_param.ebtables", context).show(); - $("div.mode_param.ebtables [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.ebtables [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).attr('required', ''); + $("input#bridge", context).attr("required", ""); break; case "ovswitch": $("div.mode_param.ovswitch", context).show(); - $("div.mode_param.ovswitch [wizard_field]", context).prop('wizard_field_disabled', false); + $("#vnetCreateSecurityTab-label").hide(); + $("div.mode_param.ovswitch [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).attr('required', ''); + $("input#bridge", context).attr("required", ""); break; case "vcenter": $("div.mode_param.vcenter", context).show(); $(".sec_groups_datatable", context).hide(); - $("div.mode_param.vcenter [wizard_field]", context).prop('wizard_field_disabled', false); - $('input#bridge', context).attr('value', $('#name', context).val()); - $('#vcenter_switch_name', context).attr('required', ''); - $('#vnetCreateSecurityTab-label').hide(); + $("div.mode_param.vcenter [wizard_field]", context).prop("wizard_field_disabled", false); + $("input#bridge", context).attr("value", $("#name", context).val()); + $("#vcenter_switch_name", context).attr("required", ""); + $("#vnetCreateSecurityTab-label").hide(); ResourceSelect.insert({ - context: $('#vcenter_cluster_id', context), - resourceName: 'Host', + context: $("#vcenter_cluster_id", context), + resourceName: "Host", emptyValue: true, nameValues: false, - filterKey: 'VM_MAD', - filterValue: 'vcenter', + filterKey: "VM_MAD", + filterValue: "vcenter", required: true, callback: function(element){ - element.attr('wizard_field', 'VCENTER_ONE_HOST_ID'); + element.attr("wizard_field", "VCENTER_ONE_HOST_ID"); } }); - $('input#vn_mad', context).attr('required', ''); - $('input#vn_mad', context).attr('value', 'vcenter'); + $("input#vn_mad", context).attr("required", ""); + $("input#vn_mad", context).attr("value", "vcenter"); - $('#div_vn_mad', context).hide(); + $("#div_vn_mad", context).hide(); break; case "custom": $("div.mode_param.custom", context).show(); - $("div.mode_param.custom [wizard_field]", context).prop('wizard_field_disabled', false); + $("div.mode_param.custom [wizard_field]", context).prop("wizard_field_disabled", false); - $('input#bridge', context).removeAttr('required'); - $('input#vn_mad', context).attr('required', ''); + $("input#bridge", context).removeAttr("required"); + $("input#vn_mad", context).attr("required", ""); break; } $("div.network_mode_description").hide(); - $('div.network_mode_description[value="' + $(this).val() + '"]').show(); + $("div.network_mode_description[value=\"" + $(this).val() + "\"]").show(); }); - $('select[wizard_field=AUTOMATIC_VLAN_ID]', context).change(function(){ + $("select[wizard_field=AUTOMATIC_VLAN_ID]", context).change(function(){ if($(this).val() != "") { - $('input[wizard_field="VLAN_ID"]', context).hide().prop('wizard_field_disabled', true); + $("input[wizard_field=\"VLAN_ID\"]", context).hide().prop("wizard_field_disabled", true); } else { - $('input[wizard_field="VLAN_ID"]', context).show().prop('wizard_field_disabled', false); + $("input[wizard_field=\"VLAN_ID\"]", context).show().prop("wizard_field_disabled", false); } }); //Initialize shown options - $('#network_mode', context).trigger("change"); - $('select[wizard_field=AUTOMATIC_VLAN_ID]', context).trigger("change"); + $("#network_mode", context).trigger("change"); + $("select[wizard_field=AUTOMATIC_VLAN_ID]", context).trigger("change"); this.securityGroupsTable.initialize(); CustomTagsTable.setup($("#vnetCreateContextTab", context)); - Foundation.reflow(context, 'tabs'); + Foundation.reflow(context, "tabs"); // Add first AR $("#vnet_wizard_ar_btn", context).trigger("click"); @@ -237,15 +238,15 @@ define(function(require) { function _add_ar_tab(ar_id, context) { var that = this; - var str_ar_tab_id = 'ar' + ar_id; + var str_ar_tab_id = "ar" + ar_id; var ar_tab = new ArTab(); this.arTabObjects[ar_id] = ar_tab; var html_tab_content = - '