From 44c96da70e3d6e3374c03413fd7924788fa144f6 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Tue, 2 Jan 2018 15:37:56 +0100 Subject: [PATCH] B #1617: Scroll to the bottom in VM log (#1618) --- .../public/app/tabs/vms-tab/panels/log.js | 61 ++++++++++--------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/log.js b/src/sunstone/public/app/tabs/vms-tab/panels/log.js index 9ad8cd3aba..812de82366 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/log.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/log.js @@ -19,16 +19,16 @@ define(function(require) { DEPENDENCIES */ - var Locale = require('utils/locale'); - var Notifier = require('utils/notifier'); - var OpenNebulaVM = require('opennebula/vm'); + var Locale = require("utils/locale"); + var Notifier = require("utils/notifier"); + var OpenNebulaVM = require("opennebula/vm"); /* CONSTANTS */ - var TAB_ID = require('../tabId'); - var PANEL_ID = require('./log/panelId'); + var TAB_ID = require("../tabId"); + var PANEL_ID = require("./log/panelId"); var RESOURCE = "VM" var XML_ROOT = "VM" @@ -58,15 +58,15 @@ define(function(require) { */ function _html() { - return '
' + - '
' + - '
' + - '' + - '' + - '' + - '
' + - '
' + - '
'; + return "
" + + "
" + + "
" + + "" + + "" + + "" + + "
" + + "
" + + "
"; } function _setup(context) { @@ -77,33 +77,34 @@ define(function(require) { OpenNebulaVM.log({ data: {id: that.element.ID}, success: function(req, response) { - var log_lines = response['vm_log'].split("\n"); - var colored_log = ''; + var log_lines = response["vm_log"].split("\n"); + var colored_log = ""; for (var i = 0; i < log_lines.length; i++) { var line = log_lines[i]; if (line.match(/\[E\]/)) { - line = '' + line + ''; + line = "" + line + ""; } colored_log += line + "
"; } - $('.vm_log_container', context).html( - '
' + - '
' + + $(".vm_log_container", context).html( + "
" + + "
" + colored_log + - '
' + - '
') + "
" + + "
"); + $(".vm_log_container", context).animate({scrollTop:"500px"}, "slow"); }, error: function(request, error_json) { - $('.vm_log_container', context).html( - '
' + - '
' + - '
' + - ' '+Locale.tr("Some ad-block extensions are known to filter the '/log?id=' URL")+'' + - '
' + - '
' + - '
'); + $(".vm_log_container", context).html( + "
" + + "
" + + "
" + + " "+Locale.tr("Some ad-block extensions are known to filter the '/log?id=' URL")+"" + + "
" + + "
" + + "
"); Notifier.onError(request, error_json); }