From b4a78b27bac3d7853a2d0e3eb179cda2443c85b0 Mon Sep 17 00:00:00 2001 From: Frederick Borges Date: Thu, 24 Feb 2022 14:34:37 +0100 Subject: [PATCH] F #5744: Display scheduler error message in info tab (#1813) Signed-off-by: Frederick Ernesto Borges Noronha --- .../public/app/tabs/vms-tab/panels/info.js | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/info.js b/src/sunstone/public/app/tabs/vms-tab/panels/info.js index 67fc394cbf..58ea464eb2 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -124,7 +124,20 @@ define(function(require) { error_msg: this.element.USER_TEMPLATE.ERROR, error_title: Locale.tr("Driver Error"), canDismiss: true, - dismisId: "close_vm_async_error" + dismissId: "close_vm_async_error" + } + ); + } + + if (this.element && + this.element.USER_TEMPLATE && + this.element.USER_TEMPLATE.SCHED_MESSAGE){ + errorMessageHTML += TemplateInfoError( + { + error_msg: this.element.USER_TEMPLATE.SCHED_MESSAGE, + error_title: Locale.tr("Scheduler Error"), + canDismiss: true, + dismissId: "close_vm_scheduler_async_error" } ); } @@ -142,7 +155,7 @@ define(function(require) { error_msg: lastErrorAndId.error, error_title: Locale.tr("Scheduled Action Error") + " (ID: #" + lastErrorAndId.id + ")", canDismiss: false, - dismisId: "" + dismissId: "" } ); } @@ -219,6 +232,16 @@ define(function(require) { Sunstone.runAction(RESOURCE + ".update_template", resourceId, template_str); }); + context.off("click", "#close_vm_scheduler_async_error"); + context.on("click", "#close_vm_scheduler_async_error", function() { + var resourceId = that.element.ID; + var templateJSON = $.extend({}, that.element.USER_TEMPLATE); + delete templateJSON.SCHED_MESSAGE; + template_str = TemplateUtils.templateToString(templateJSON); + + Sunstone.runAction(RESOURCE + ".update_template", resourceId, template_str); + }); + if (OpenNebula.VM.isvCenterVM(this.element)) { $("button[href=\"VM.upload_marketplace_dialog\"]").attr("disabled","disabled"); } else {