|
@@ -16,206 +16,15 @@
|
|
|
<%!
|
|
<%!
|
|
|
import re
|
|
import re
|
|
|
import sys
|
|
import sys
|
|
|
-
|
|
|
|
|
-from desktop.lib.conf import BoundConfig
|
|
|
|
|
-from desktop.lib.i18n import smart_str
|
|
|
|
|
from desktop.views import commonheader, commonfooter
|
|
from desktop.views import commonheader, commonfooter
|
|
|
-
|
|
|
|
|
-if sys.version_info[0] > 2:
|
|
|
|
|
- from django.utils.translation import gettext as _
|
|
|
|
|
-else:
|
|
|
|
|
- from django.utils.translation import ugettext as _
|
|
|
|
|
%>
|
|
%>
|
|
|
|
|
|
|
|
-<%namespace name="actionbar" file="actionbar.mako" />
|
|
|
|
|
<%namespace name="layout" file="about_layout.mako" />
|
|
<%namespace name="layout" file="about_layout.mako" />
|
|
|
|
|
|
|
|
-% if not is_embeddable:
|
|
|
|
|
-${ commonheader(_('Server Logs'), "about", user, request) | n,unicode }
|
|
|
|
|
-% endif
|
|
|
|
|
-
|
|
|
|
|
${ layout.menubar(section='log_view') }
|
|
${ layout.menubar(section='log_view') }
|
|
|
|
|
|
|
|
-<style type="text/css">
|
|
|
|
|
- pre {
|
|
|
|
|
- margin: 0;
|
|
|
|
|
- padding: 2px;
|
|
|
|
|
- border: 0;
|
|
|
|
|
- white-space: pre-wrap;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- pre.nowrap {
|
|
|
|
|
- white-space: nowrap;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- pre.highlighted {
|
|
|
|
|
- background-color: #FFFF88;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- #hue-logs {
|
|
|
|
|
- overflow: auto;
|
|
|
|
|
- background-color: #F5F5F5;
|
|
|
|
|
- width: 100%;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- #hue-logs pre:first-child {
|
|
|
|
|
- padding-top: 10px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- #hue-logs pre:last-child {
|
|
|
|
|
- padding-bottom: 10px;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- .notFound {
|
|
|
|
|
- background-color: #f09999 !important;
|
|
|
|
|
- }
|
|
|
|
|
-</style>
|
|
|
|
|
-
|
|
|
|
|
-<div id="logsComponents" class="container-fluid">
|
|
|
|
|
- <div class="card card-small">
|
|
|
|
|
- <%actionbar:render>
|
|
|
|
|
- <%def name="search()">
|
|
|
|
|
- <input type="text" class="input-xlarge" id="hue-logs-search-query" placeholder="${ _('Search in the logs') }" value="${ query }">
|
|
|
|
|
- </%def>
|
|
|
|
|
- <%def name="creation()">
|
|
|
|
|
- <form class="form-inline">
|
|
|
|
|
- <label class="checkbox margin-right-10">
|
|
|
|
|
- ${ _('Host') }: ${ hostname }
|
|
|
|
|
- </label>
|
|
|
|
|
- <label class="checkbox margin-right-10">
|
|
|
|
|
- <input type="checkbox" id="forcedDebug" data-bind="checked: forcedDebug">
|
|
|
|
|
- ${ _('Force DEBUG level') }
|
|
|
|
|
- </label>
|
|
|
|
|
- <label class="checkbox margin-right-10">
|
|
|
|
|
- <input id="wrapLogs" id="wrap" type="checkbox" checked="checked">
|
|
|
|
|
- ${ _('Wrap logs') }
|
|
|
|
|
- </label>
|
|
|
|
|
- <a href="javascript:void(0)" onclick="huePubSub.publish('open.link', '/desktop/download_logs');" class="btn">
|
|
|
|
|
- <i class="fa fa-download"></i> ${ _('Download entire log as zip') }
|
|
|
|
|
- </a>
|
|
|
|
|
- </form>
|
|
|
|
|
- </%def>
|
|
|
|
|
- </%actionbar:render>
|
|
|
|
|
-
|
|
|
|
|
- <% log.reverse() %>
|
|
|
|
|
-
|
|
|
|
|
- <div id="hue-logs">
|
|
|
|
|
- % for l in log:
|
|
|
|
|
- <pre>${ smart_str(l, errors='ignore') }</pre>
|
|
|
|
|
- % endfor
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- </div>
|
|
|
|
|
|
|
+<script src="${ static('desktop/js/logs-inline.js') }" type="text/javascript"></script>
|
|
|
|
|
|
|
|
|
|
+<div id="ServerLogs">
|
|
|
|
|
+<ServerLogsTab class='antd cuix' data-reactcomponent='ServerLogs'></ServerLogsTab>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
-<script>
|
|
|
|
|
- var LiveDebugging = function () {
|
|
|
|
|
- var self = this;
|
|
|
|
|
-
|
|
|
|
|
- self.forcedDebug = ko.observable();
|
|
|
|
|
- self.forcedDebug.subscribe(function(oldValue) {
|
|
|
|
|
- if (oldValue != null) {
|
|
|
|
|
- self.setLogLevel(! oldValue);
|
|
|
|
|
- }
|
|
|
|
|
- }, this, "beforeChange");
|
|
|
|
|
-
|
|
|
|
|
- self.getDebugLevel = function() {
|
|
|
|
|
- $.get("/desktop/get_debug_level", function(data) { self.forcedDebug(data.debug_all); });
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- self.setLogLevel = function(set_debug) {
|
|
|
|
|
- var _url = "";
|
|
|
|
|
- if (set_debug) {
|
|
|
|
|
- _url = "/desktop/set_all_debug";
|
|
|
|
|
- } else {
|
|
|
|
|
- _url = "/desktop/reset_all_debug";
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $.post(_url, {}, function(data) {
|
|
|
|
|
- if (data,status != 0) {
|
|
|
|
|
- huePubSub.publish('hue.global.error', {message: data.message});
|
|
|
|
|
- }
|
|
|
|
|
- }).fail(function (xhr, textStatus, errorThrown) {
|
|
|
|
|
- huePubSub.publish('hue.global.error', {message: xhr.responseText});
|
|
|
|
|
- });
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $(document).ready(function () {
|
|
|
|
|
- var viewModel = new LiveDebugging();
|
|
|
|
|
- ko.applyBindings(viewModel, $("#logsComponents")[0]);
|
|
|
|
|
-
|
|
|
|
|
- viewModel.getDebugLevel();
|
|
|
|
|
-
|
|
|
|
|
- resizeScrollingLogs();
|
|
|
|
|
-
|
|
|
|
|
- var resizeTimeout = -1;
|
|
|
|
|
- $(window).resize(function () {
|
|
|
|
|
- window.clearTimeout(resizeTimeout);
|
|
|
|
|
- resizeTimeout = window.setTimeout(function () {
|
|
|
|
|
- resizeScrollingLogs();
|
|
|
|
|
- }, 200);
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- $("#hue-logs-search-query").jHueDelayedInput(function(){
|
|
|
|
|
- filterLogs($("#hue-logs-search-query").val());
|
|
|
|
|
- }, 500);
|
|
|
|
|
-
|
|
|
|
|
- if ("${query}" != "") {
|
|
|
|
|
- filterLogs("${query}");
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function resizeScrollingLogs() {
|
|
|
|
|
- var _el = $("#hue-logs");
|
|
|
|
|
- if (_el.length > 0) {
|
|
|
|
|
- if (!$.browser.msie) {
|
|
|
|
|
- _el.css("overflow-y", "").css("height", "");
|
|
|
|
|
- }
|
|
|
|
|
- var heightAfter = 0;
|
|
|
|
|
- _el.nextAll(":visible").each(function () {
|
|
|
|
|
- heightAfter += $(this).outerHeight(true);
|
|
|
|
|
- });
|
|
|
|
|
- if (_el.height() > ($(window).height() - _el.offset().top - heightAfter)) {
|
|
|
|
|
- _el.css("overflow-y", "auto").height($(window).height() - _el.offset().top - heightAfter - 30);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- function filterLogs(query) {
|
|
|
|
|
- $("#hue-logs-search-query").removeClass("notFound");
|
|
|
|
|
- if ($.trim(query) == "") {
|
|
|
|
|
- $("#hue-logs").scrollTop(0);
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- $("pre.highlighted").removeClass("highlighted");
|
|
|
|
|
- var found = false;
|
|
|
|
|
- $("#hue-logs pre").each(function () {
|
|
|
|
|
- var _el = $(this);
|
|
|
|
|
- if (_el.text().toLowerCase().replace(/\s/g, "").indexOf(query.toLowerCase().replace(/\s/g, "")) > -1) {
|
|
|
|
|
- _el.addClass("highlighted");
|
|
|
|
|
- $("#hue-logs").scrollTop(_el.offset().top - $("#hue-logs").position().top - 100);
|
|
|
|
|
- found = true;
|
|
|
|
|
- return false;
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- if (!found) {
|
|
|
|
|
- $("#hue-logs-search-query").addClass("notFound");
|
|
|
|
|
- $("#hue-logs").scrollTop(0);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- $("#wrapLogs").on("change", function(){
|
|
|
|
|
- if ($(this).is(":checked")){
|
|
|
|
|
- $("pre").removeClass("nowrap");
|
|
|
|
|
- }
|
|
|
|
|
- else {
|
|
|
|
|
- $("pre").addClass("nowrap");
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-</script>
|
|
|
|
|
-
|
|
|
|
|
-% if not is_embeddable:
|
|
|
|
|
-${ commonfooter(request, messages) | n,unicode }
|
|
|
|
|
-% endif
|
|
|