From 5c247672ade4639ab8429e3e5afb60a4b6588200 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 23 Apr 2020 04:48:24 +0200 Subject: [PATCH 1/2] Highlight error/warnings/... in tools > logs --- src/js/yunohost/controllers/tools.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index 3b86285f..a766e250 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -137,11 +137,19 @@ log.metadata.env = log.metadata.args } } + c.view('tools/tools_log', { "log": log, "next_number": log.logs.length == number ? number * 10:false, "locale": y18n.locale }, function() { + log = $("#log").html(); + log = log.replace(/.*: ERROR - .*/g, function (match) { return ''+match+''}); + log = log.replace(/.*: WARNING - .*/g, function (match) { return ''+match+''}); + log = log.replace(/.*: SUCCESS - .*/g, function (match) { return ''+match+''}); + log = log.replace(/.*: INFO - .*/g, function (match) { return ''+match+''}); + $("#log").html(log); + // Configure behavior for the button to share log on Yunohost (it calls display --share) $('button[data-action="share"]').on("click", function() { c.api('GET', '/logs/display?path='+$(this).data('log-id')+'&share', {}, From 981407edfc6b574c9f8ec30e34425f9663c9d853 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 23 Apr 2020 05:18:26 +0200 Subject: [PATCH 2/2] More accurate selector because of asynchronous shit related to slider effect --- src/js/yunohost/controllers/tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/yunohost/controllers/tools.js b/src/js/yunohost/controllers/tools.js index a766e250..21420f42 100644 --- a/src/js/yunohost/controllers/tools.js +++ b/src/js/yunohost/controllers/tools.js @@ -143,12 +143,12 @@ "next_number": log.logs.length == number ? number * 10:false, "locale": y18n.locale }, function() { - log = $("#log").html(); + log = $("#main #log").html(); log = log.replace(/.*: ERROR - .*/g, function (match) { return ''+match+''}); log = log.replace(/.*: WARNING - .*/g, function (match) { return ''+match+''}); log = log.replace(/.*: SUCCESS - .*/g, function (match) { return ''+match+''}); log = log.replace(/.*: INFO - .*/g, function (match) { return ''+match+''}); - $("#log").html(log); + $("#main #log").html(log); // Configure behavior for the button to share log on Yunohost (it calls display --share) $('button[data-action="share"]').on("click", function() {