From edb88c2f0973c45094267a04d5c2824be9b8586b Mon Sep 17 00:00:00 2001 From: juanmont Date: Mon, 14 May 2018 16:57:17 +0200 Subject: [PATCH] Changes in Sunstone with schedule actions and instantiate dialog (#2093) * Changed texts on instantiate section * F #1548: Fixed bug with schedule actions in Sunstone --- .../templates-tab/form-panels/instantiate.js | 3 ++- .../form-panels/instantiate/templateRow.hbs | 22 +++++++++---------- .../public/app/tabs/vms-tab/panels/actions.js | 2 +- src/sunstone/public/app/utils/nics-section.js | 7 +++++- .../public/app/utils/nics-section/html.hbs | 2 +- .../public/app/utils/schedule_action.js | 19 ++++++++-------- .../app/utils/schedule_action/table.hbs | 2 +- 7 files changed, 32 insertions(+), 25 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 545a637432..dd35202195 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 @@ -485,7 +485,8 @@ define(function(require) { NicsSection.insert(template_json, $(".nicsContext" + template_json.VMTEMPLATE.ID, context), { "forceIPv4": true, - "securityGroups": Config.isFeatureEnabled("secgroups") + "securityGroups": Config.isFeatureEnabled("secgroups"), + "name": " " }); VMGroupSection.insert(template_json, diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs index 872c4243e4..6bb370d05e 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/instantiate/templateRow.hbs @@ -58,13 +58,13 @@ {{/isFeatureEnabled}} {{/advancedSection}} - {{#advancedSection (tr "User / Group") }} + {{#advancedSection (tr "Instantiate as different user / group")}} {{#isFeatureEnabled "show_as_uid_instantiate"}}
- {{tr "Instantiate as a different user"}} +
{{{usersDatatable}}}
@@ -76,7 +76,7 @@
- {{tr "Instantiate as a different group"}} +
{{{groupDatatable}}}
@@ -84,13 +84,13 @@
{{/isFeatureEnabled}} {{/advancedSection}} - {{#advancedSection (tr "Host") }} + {{#advancedSection (tr "Deploy VM in a specific Host") }} {{#isFeatureEnabled "show_host_instantiate"}}
- {{tr "Deploy VM in a specific Host"}} +
{{{hostsDatatable}}}
@@ -107,13 +107,13 @@
{{/isFeatureEnabled}} {{/advancedSection}} - {{#advancedSection (tr "Datastore") }} + {{#advancedSection (tr "Deploy VM in a specific Datastore") }} {{#isFeatureEnabled "show_ds_instantiate"}}
- {{tr "Deploy VM in a specific Datastore"}} +
{{{dsDatatable}}}
@@ -130,25 +130,25 @@
{{/isFeatureEnabled}} {{/advancedSection}} - {{#advancedSection (tr "Actions") }} + {{#advancedSection (tr "Schedule Actions for VM") }}
- {{tr "Schedule Actions for VM"}} + {{{table_sched_actions}}}
{{/advancedSection}} - {{#advancedSection (tr "VM Group") }} + {{#advancedSection (tr "Associate VM to a VM Group") }} {{#isFeatureEnabled "show_vmgroup_instantiate"}}
- {{tr "Associate VM to a VM Group"}} +
diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/actions.js b/src/sunstone/public/app/tabs/vms-tab/panels/actions.js index 0ea01d25b4..94484f0abf 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/actions.js @@ -73,7 +73,7 @@ define(function(require) { ' + Locale.tr("End") + '\ ' + Locale.tr("Done") + '\ ' + Locale.tr("Message") + '\ - ' + Locale.tr("Actions") + '\ + \ \ \ \ diff --git a/src/sunstone/public/app/utils/nics-section.js b/src/sunstone/public/app/utils/nics-section.js index c2516beda0..ea8279c074 100644 --- a/src/sunstone/public/app/utils/nics-section.js +++ b/src/sunstone/public/app/utils/nics-section.js @@ -293,7 +293,12 @@ define(function(require) { */ function _generate_provision_network_accordion(context, options) { context.off(); - context.html(TemplateSection()); + var name = "Network"; + if (options.name) + name = options.name; + context.html(TemplateSection({ + "name": Locale.tr(name) + })); if (options.hide_add_button == true){ $(".provision_add_network_interface", context).hide(); diff --git a/src/sunstone/public/app/utils/nics-section/html.hbs b/src/sunstone/public/app/utils/nics-section/html.hbs index c21b9f353a..c97447e5c9 100644 --- a/src/sunstone/public/app/utils/nics-section/html.hbs +++ b/src/sunstone/public/app/utils/nics-section/html.hbs @@ -1,6 +1,6 @@
- {{tr "Network"}} + {{name}}
diff --git a/src/sunstone/public/app/utils/schedule_action.js b/src/sunstone/public/app/utils/schedule_action.js index 4287c5db5f..f9b3dbeddc 100644 --- a/src/sunstone/public/app/utils/schedule_action.js +++ b/src/sunstone/public/app/utils/schedule_action.js @@ -156,6 +156,7 @@ define(function (require) { } function _retrieve(context) { + $("#scheduling_" + this.res + "_actions_table .create", context).remove(); var actionsJSON = []; $("#scheduling_" + this.res + "_actions_table tbody tr").each(function (index) { var first = $(this).children("td")[0]; @@ -286,18 +287,18 @@ define(function (require) { var end_str = ""; if (scheduling_action.REPEAT !== undefined) { - if (scheduling_action.REPEAT === 0) { + if (scheduling_action.REPEAT == 0) { rep_str = "Weekly "; - } else if (scheduling_action.REPEAT === 1) { + } else if (scheduling_action.REPEAT == 1) { rep_str = "Monthly "; - } else if (scheduling_action.REPEAT === 2) { + } else if (scheduling_action.REPEAT == 2) { rep_str = "Yearly "; - } else if (scheduling_action.REPEAT === 3) { + } else if (scheduling_action.REPEAT == 3) { rep_str = "Each " + scheduling_action.DAYS + " hours"; } - if (scheduling_action.REPEAT !== 3) { - if (scheduling_action.REPEAT !== 0) { + if (scheduling_action.REPEAT != 3) { + if (scheduling_action.REPEAT != 0) { rep_str += scheduling_action.DAYS; } else { rep_str += Humanize.week_days(scheduling_action.DAYS); @@ -306,11 +307,11 @@ define(function (require) { } if (scheduling_action.END_TYPE !== undefined) { - if (scheduling_action.END_TYPE === 0) { + if (scheduling_action.END_TYPE == 0) { end_str = "None"; - } else if (scheduling_action.END_TYPE === 1) { + } else if (scheduling_action.END_TYPE == 1) { end_str = "After " + scheduling_action.END_VALUE + " times"; - } else if (scheduling_action.END_TYPE === 2) { + } else if (scheduling_action.END_TYPE == 2) { end_str = "on " + Humanize.prettyTime(scheduling_action.END_VALUE); } } diff --git a/src/sunstone/public/app/utils/schedule_action/table.hbs b/src/sunstone/public/app/utils/schedule_action/table.hbs index 87b0051030..aeb33fc04c 100644 --- a/src/sunstone/public/app/utils/schedule_action/table.hbs +++ b/src/sunstone/public/app/utils/schedule_action/table.hbs @@ -28,7 +28,7 @@ {{tr "Time"}} {{tr "Rep"}} {{tr "Ends"}} - {{tr "Actions"}} +