From d498c4831f448ac0d9a31c22d2e164ab19a3df09 Mon Sep 17 00:00:00 2001 From: Jorge Miguel Lobo Escalona <47326048+jloboescalona2@users.noreply.github.com> Date: Wed, 5 Jan 2022 16:17:13 +0100 Subject: [PATCH] B #5679: Fix alert sched action in vm info (#1684) (cherry picked from commit 95abfcd02320b6bea53392b6da911098f981e2ae) --- .../public/app/tabs/vms-tab/panels/info.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 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 7cfb23b6e2..67fc394cbf 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/info.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/info.js @@ -136,14 +136,16 @@ define(function(require) { this.element.TEMPLATE.SCHED_ACTION : [this.element.TEMPLATE.SCHED_ACTION]; var lastErrorAndId = getLastSchedErrorAndId(arraySchedActions); - errorMessageHTML += TemplateInfoError( - { - error_msg: lastErrorAndId.error, - error_title: Locale.tr("Scheduled Action Error") + " (ID: #" + lastErrorAndId.id + ")", - canDismiss: false, - dismisId: "" - } - ); + if(lastErrorAndId.error){ + errorMessageHTML += TemplateInfoError( + { + error_msg: lastErrorAndId.error, + error_title: Locale.tr("Scheduled Action Error") + " (ID: #" + lastErrorAndId.id + ")", + canDismiss: false, + dismisId: "" + } + ); + } } return TemplateInfo({ @@ -172,15 +174,16 @@ define(function(require) { var lastErrorAndId = { error: "", id: 0 - } + }; var lastEnd = 0; $.each(sched_array, function(_, sched_action){ if (sched_action.MESSAGE && sched_action.END_VALUE && - parseInt(sched_action.END_VALUE) > lastEnd){ + parseInt(sched_action.END_VALUE, 10) > lastEnd + ){ lastErrorAndId.error = sched_action.MESSAGE; - lastErrorAndId.id = parseInt(sched_action.ID); - lastEnd = parseInt(sched_action.END_VALUE); + lastErrorAndId.id = parseInt(sched_action.ID, 10); + lastEnd = parseInt(sched_action.END_VALUE, 10); } }); return lastErrorAndId;