From c05b9588e8f2d545bc33bcb104d36760a2a57f58 Mon Sep 17 00:00:00 2001 From: Jorge Lobo <47326048+jloboescalona2@users.noreply.github.com> Date: Mon, 9 Mar 2020 11:56:15 +0100 Subject: [PATCH] B # 4132: Rename vars and fix charter (#4281) Signed-off-by: Jorge Lobo --- .../tabs/templates-tab/form-panels/instantiate.js | 14 +++++--------- src/sunstone/public/app/tabs/vms-tab/actions.js | 4 ++-- .../public/app/tabs/vms-tab/form-panels/create.js | 13 ++----------- .../app/tabs/vms-tab/utils/datatable-common.js | 10 +++++----- src/sunstone/public/app/utils/custom-tags-table.js | 3 +-- src/sunstone/public/app/utils/leases.js | 6 ++++-- src/sunstone/public/bower.json | 4 ++-- 7 files changed, 21 insertions(+), 33 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js index 674ba4a7c8..f4df7bcebc 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate.js @@ -97,11 +97,14 @@ define(function(require) { function _setup(context) { var that = this; - + var leasesThat = {}; + var objLeases = Object.assign(leasesThat, that); + objLeases.resource = "template"; + objLeases.__proto__ = FormPanel.prototype; + Leases.actions(objLeases); if(Config.isFeatureEnabled("instantiate_persistent")){ $("input.instantiate_pers", context).on("change", function(){ var persistent = $(this).prop("checked"); - if(persistent){ $("#vm_n_times_disabled", context).show(); $("#vm_n_times", context).hide(); @@ -109,7 +112,6 @@ define(function(require) { $("#vm_n_times_disabled", context).hide(); $("#vm_n_times", context).show(); } - $.each(that.template_objects, function(index, template_json) { DisksResize.insert({ template_json: template_json, @@ -124,18 +126,14 @@ define(function(require) { $("#vm_n_times_disabled", context).hide(); $("#vm_n_times", context).show(); } - context.off("click", "#add_scheduling_inst_action"); context.on("click", "#add_scheduling_inst_action", function() { var actions = ["terminate", "terminate-hard", "hold", "release", "stop", "suspend", "resume", "reboot", "reboot-hard", "poweroff", "poweroff-hard", "undeploy", "undeploy-hard", "snapshot-create"]; $("#add_scheduling_inst_action", context).attr("disabled", "disabled"); - ScheduleActions.htmlNewAction(actions, context, "inst"); ScheduleActions.setup(context); - return false; }); - context.off("click", "#add_inst_action_json"); context.on("click" , "#add_inst_action_json", function(){ var sched_action = ScheduleActions.retrieveNewAction(context); @@ -145,12 +143,10 @@ define(function(require) { return false; }); - context.on("focusout" , "#time_input", function(){ $("#time_input").removeAttr("data-invalid"); $("#time_input").removeAttr("class"); }); - context.off("click", ".remove_action_x"); context.on("click", ".remove_action_x", function(){ $(this).parents("tr").remove(); diff --git a/src/sunstone/public/app/tabs/vms-tab/actions.js b/src/sunstone/public/app/tabs/vms-tab/actions.js index e30dce750e..63dd5bdf14 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -191,8 +191,8 @@ define(function(require) { (propUpperCase === "USERNAME" || propUpperCase === "PASSWORD") && (credentials[propUpperCase] = context[prop]); } - var pblc = vm.TEMPLATE.CONTEXT.MAP_PUBLIC; - var prvt = vm.TEMPLATE.CONTEXT.MAP_PRIVATE; + var pblc = vm.TEMPLATE.CONTEXT.MAP_EXTERNAL; + var prvt = vm.TEMPLATE.CONTEXT.MAP_INTERNAL; var mapp = new mapips(pblc, prvt); var foundip = mapp.renderPublicIp(ip); ip = foundip || ip diff --git a/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js b/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js index b4329db896..145f65aad4 100644 --- a/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js @@ -67,16 +67,12 @@ define(function(require) { function _setup(context) { var that = this; InstantiateTemplateFormPanel.prototype.setup.call(this, context); - - $(".selectTemplateTable", context).html( - '
' + this.templatesTable.dataTableHTML + '
'); - + $(".selectTemplateTable", context).html('
' + this.templatesTable.dataTableHTML + '
'); this.templatesTable.initialize(); - this.templatesTable.idInput().on("change", function(){ $(".nameContainer", context).show(); $(".persistentContainer", context).show(); - + var templatesContext = $(".list_of_templates", context); templatesContext.html(""); templatesContext.show(); @@ -85,15 +81,12 @@ define(function(require) { if(template_id){ that.setTemplateIds(context, [template_id]); var leasesThat = {}; - function FormPanel() { this.name = this.name; } - Object.assign(leasesThat, that); leasesThat.resource = "vm"; leasesThat.resourceId = template_id; - if( OpenNebulaAction && OpenNebulaAction.cache && @@ -105,12 +98,10 @@ define(function(require) { ){ leasesThat.jsonTemplate = OpenNebulaAction.cache("VMTEMPLATE").data[template_id].VMTEMPLATE.TEMPLATE; } - leasesThat.__proto__ = FormPanel.prototype; Leases.actions(leasesThat); } }); - Tips.setup(context); } diff --git a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js index 11e1265103..0eb094c643 100644 --- a/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js +++ b/src/sunstone/public/app/tabs/vms-tab/utils/datatable-common.js @@ -43,7 +43,7 @@ define(function(require) { Locale.tr("Hidden Template"), Locale.tr("Labels"), "search_data", - Locale.tr("Leases") //clock leases + Locale.tr("Charter") //clock leases ]; return { @@ -103,8 +103,8 @@ define(function(require) { element.NAME && element.TEMPLATE && element.TEMPLATE.CONTEXT && - element.TEMPLATE.CONTEXT.MAP_PRIVATE && - element.TEMPLATE.CONTEXT.MAP_PUBLIC && + element.TEMPLATE.CONTEXT.MAP_EXTERNAL && + element.TEMPLATE.CONTEXT.MAP_INTERNAL && element.TEMPLATE.NIC && config && config.system_config && @@ -116,8 +116,8 @@ define(function(require) { var nics = element.TEMPLATE.NIC; var credentials = {}; var context = element.TEMPLATE.CONTEXT; - var pblc = element.TEMPLATE.CONTEXT.MAP_PUBLIC; //"10.0.0.0/8"; - var prvt = element.TEMPLATE.CONTEXT.MAP_PRIVATE; //"192.168.0.0/16"; + var pblc = element.TEMPLATE.CONTEXT.MAP_EXTERNAL; //"10.0.0.0/8"; + var prvt = element.TEMPLATE.CONTEXT.MAP_INTERNAL; //"192.168.0.0/16"; var renderTitle = true; if (!$.isArray(nics)){ nics = [nics]; diff --git a/src/sunstone/public/app/utils/custom-tags-table.js b/src/sunstone/public/app/utils/custom-tags-table.js index 8c9b95155a..522a0c7f63 100644 --- a/src/sunstone/public/app/utils/custom-tags-table.js +++ b/src/sunstone/public/app/utils/custom-tags-table.js @@ -50,7 +50,7 @@ define(function(require) { return TemplateHTML({ 'titleKey': Locale.tr("Name"), 'titleMandatory': showMandatory ? Locale.tr("Type") : '', - 'titleValue': Locale.tr("Description"), + 'titleValue': Locale.tr("Value"), 'titleDefault': showDefault? Locale.tr("Default Value"): '', 'classTable': classTableName, 'classButton': classButtonName @@ -61,7 +61,6 @@ define(function(require) { if (!hide_vector_button) { hide_vector_button = false; } - console.log("VALIDATE: ",showMandatory? 'M' : ''); context.off("click", ".add_custom_tag"); context.on("click", ".add_custom_tag", function(){ $("tbody.custom_tags", context).append( diff --git a/src/sunstone/public/app/utils/leases.js b/src/sunstone/public/app/utils/leases.js index 77adcec78c..6c8bfb646a 100644 --- a/src/sunstone/public/app/utils/leases.js +++ b/src/sunstone/public/app/utils/leases.js @@ -29,7 +29,7 @@ define(function(require) { CONSTANTS */ - var classButton = 'button warning leases'; + var classButton = 'button leases'; var idElementSchedActions = '#sched_temp_actions_body, #sched_inst_actions_body'; /* @@ -52,7 +52,9 @@ define(function(require) { config.system_config.leases && (config.system_config.leases.suspense || config.system_config.leases.terminate) ){ - return $("