mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
parent
eb49ad2e6f
commit
e5331ccb1d
@ -34,6 +34,7 @@ define(function(require) {
|
||||
*/
|
||||
|
||||
var TemplateInfo = require("hbs!./info/html");
|
||||
var TemplateInfoError = require("hbs!utils/info-error/html");
|
||||
|
||||
/*
|
||||
CONSTANTS
|
||||
@ -118,26 +119,31 @@ define(function(require) {
|
||||
if (this.element &&
|
||||
this.element.USER_TEMPLATE &&
|
||||
this.element.USER_TEMPLATE.ERROR){
|
||||
errorMessageHTML =
|
||||
"<div class='row'>" +
|
||||
"<div class='large-9 columns'>" +
|
||||
"<div class='callout warning warning-message' style='border-radius: .5em;' data-closable>" +
|
||||
"<div class='row'>"+
|
||||
"<div class='columns large-1'>" +
|
||||
"<i class='fas fa-exclamation-circle'></i>"+
|
||||
"</div>"+
|
||||
"<div class='columns large-9'>"+
|
||||
"<p>" + this.element.USER_TEMPLATE.ERROR + "</p>" +
|
||||
"</div>"+
|
||||
"<div class='columns large-2'>" +
|
||||
"<a id='close_vm_async_error' data-close>" +
|
||||
"<u>Dismiss</u>"+
|
||||
"</a>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
errorMessageHTML = TemplateInfoError(
|
||||
{
|
||||
error_msg: this.element.USER_TEMPLATE.ERROR,
|
||||
error_title: Locale.tr("Driver Error"),
|
||||
canDismiss: true,
|
||||
dismisId: "close_vm_async_error"
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (this.element &&
|
||||
this.element.TEMPLATE &&
|
||||
this.element.TEMPLATE.SCHED_ACTION){
|
||||
var arraySchedActions = Array.isArray(this.element.TEMPLATE.SCHED_ACTION) ?
|
||||
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: ""
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return TemplateInfo({
|
||||
@ -162,6 +168,24 @@ define(function(require) {
|
||||
});
|
||||
}
|
||||
|
||||
function getLastSchedErrorAndId(sched_array){
|
||||
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){
|
||||
lastErrorAndId.error = sched_action.MESSAGE;
|
||||
lastErrorAndId.id = parseInt(sched_action.ID);
|
||||
lastEnd = parseInt(sched_action.END_VALUE);
|
||||
}
|
||||
});
|
||||
return lastErrorAndId;
|
||||
}
|
||||
|
||||
function _setup(context) {
|
||||
var that = this;
|
||||
|
||||
|
38
src/sunstone/public/app/utils/info-error/html.hbs
Normal file
38
src/sunstone/public/app/utils/info-error/html.hbs
Normal file
@ -0,0 +1,38 @@
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
{{! Copyright 2002-2021, OpenNebula Project, OpenNebula Systems }}
|
||||
{{! }}
|
||||
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }}
|
||||
{{! not use this file except in compliance with the License. You may obtain }}
|
||||
{{! a copy of the License at }}
|
||||
{{! }}
|
||||
{{! http://www.apache.org/licenses/LICENSE-2.0 }}
|
||||
{{! }}
|
||||
{{! Unless required by applicable law or agreed to in writing, software }}
|
||||
{{! distributed under the License is distributed on an "AS IS" BASIS, }}
|
||||
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }}
|
||||
{{! See the License for the specific language governing permissions and }}
|
||||
{{! limitations under the License. }}
|
||||
{{! -------------------------------------------------------------------------- }}
|
||||
|
||||
<div class='row'>
|
||||
<div class='large-9 columns'>
|
||||
<div class='callout warning warning-message' style='border-radius: .5em;' data-closable>
|
||||
<div class='row'>
|
||||
<div class='columns large-1'>
|
||||
<i class='fas fa-exclamation-circle'></i>
|
||||
</div>
|
||||
<div class='columns large-9'>
|
||||
<b>{{error_title}}</b><br>
|
||||
{{error_msg}}
|
||||
</div>
|
||||
<div class='columns large-2'>
|
||||
{{#if canDismiss}}
|
||||
<a id='{{dismissId}}' data-close>
|
||||
<u>Dismiss</u>
|
||||
</a>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user