1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00

B #5679: Fix alert sched action in vm info (#1684)

This commit is contained in:
Jorge Miguel Lobo Escalona 2022-01-05 16:17:13 +01:00 committed by GitHub
parent 246a90a016
commit 95abfcd023
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,14 +136,16 @@ define(function(require) {
this.element.TEMPLATE.SCHED_ACTION : this.element.TEMPLATE.SCHED_ACTION :
[this.element.TEMPLATE.SCHED_ACTION]; [this.element.TEMPLATE.SCHED_ACTION];
var lastErrorAndId = getLastSchedErrorAndId(arraySchedActions); var lastErrorAndId = getLastSchedErrorAndId(arraySchedActions);
errorMessageHTML += TemplateInfoError( if(lastErrorAndId.error){
{ errorMessageHTML += TemplateInfoError(
error_msg: lastErrorAndId.error, {
error_title: Locale.tr("Scheduled Action Error") + " (ID: #" + lastErrorAndId.id + ")", error_msg: lastErrorAndId.error,
canDismiss: false, error_title: Locale.tr("Scheduled Action Error") + " (ID: #" + lastErrorAndId.id + ")",
dismisId: "" canDismiss: false,
} dismisId: ""
); }
);
}
} }
return TemplateInfo({ return TemplateInfo({
@ -172,15 +174,16 @@ define(function(require) {
var lastErrorAndId = { var lastErrorAndId = {
error: "", error: "",
id: 0 id: 0
} };
var lastEnd = 0; var lastEnd = 0;
$.each(sched_array, function(_, sched_action){ $.each(sched_array, function(_, sched_action){
if (sched_action.MESSAGE && if (sched_action.MESSAGE &&
sched_action.END_VALUE && sched_action.END_VALUE &&
parseInt(sched_action.END_VALUE) > lastEnd){ parseInt(sched_action.END_VALUE, 10) > lastEnd
){
lastErrorAndId.error = sched_action.MESSAGE; lastErrorAndId.error = sched_action.MESSAGE;
lastErrorAndId.id = parseInt(sched_action.ID); lastErrorAndId.id = parseInt(sched_action.ID, 10);
lastEnd = parseInt(sched_action.END_VALUE); lastEnd = parseInt(sched_action.END_VALUE, 10);
} }
}); });
return lastErrorAndId; return lastErrorAndId;