1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-20 10:50:08 +03:00

Feature #3748: Oneflow service log panel

This commit is contained in:
Carlos Martín 2015-06-15 12:19:58 +02:00
parent 74651042c7
commit c6dd5e9f67
3 changed files with 70 additions and 1 deletions

View File

@ -13,7 +13,8 @@ define(function(require) {
var _panels = [
require('./oneflow-services-tab/panels/info'),
require('./oneflow-services-tab/panels/roles')
require('./oneflow-services-tab/panels/roles'),
require('./oneflow-services-tab/panels/log')
];
var _formPanels = [

View File

@ -0,0 +1,65 @@
define(function(require) {
/*
DEPENDENCIES
*/
var Locale = require('utils/locale');
var Humanize = require('utils/humanize');
/*
CONSTANTS
*/
var TAB_ID = require('../tabId');
var PANEL_ID = require('./log/panelId');
var XML_ROOT = "DOCUMENT";
var RESOURCE = "Service";
/*
CONSTRUCTOR
*/
function Panel(info) {
this.title = Locale.tr("Log");
this.icon = "fa-file-text";
this.element = info[XML_ROOT];
return this;
}
Panel.PANEL_ID = PANEL_ID;
Panel.prototype.html = _html;
Panel.prototype.setup = _setup;
return Panel;
/*
FUNCTION DEFINITIONS
*/
function _html() {
var logs = this.element.TEMPLATE.BODY.log;
var log_info = '';
if (logs) {
log_info += '<div class="row"><div class="large-12 columns log-tab">';
for (var i = 0; i < logs.length; i++) {
var line = Humanize.prettyTime(logs[i].timestamp)+' ['+logs[i].severity + '] ' + logs[i].message+ '<br>';
if (logs[i].severity == 'E'){
line = '<span class="vm_log_error">'+line+'</span>';
}
log_info += line;
}
log_info += '</div></div>';
}
return log_info;
}
function _setup(context) {
}
});

View File

@ -0,0 +1,3 @@
define(function(require){
return 'service_log_tab';
});