diff --git a/src/main/html/webapp/components/admin/settings/logs/logs.js b/src/main/html/webapp/components/admin/settings/logs/logs.js index d2cc5661..222d8b52 100644 --- a/src/main/html/webapp/components/admin/settings/logs/logs.js +++ b/src/main/html/webapp/components/admin/settings/logs/logs.js @@ -3,15 +3,34 @@ import $ from 'jquery'; import template from './logs.stache'; - export default Control.extend({ - "init": function(element, options) { - - $(element).hide(); $(element).html(template()); $(element).fadeIn(); - $("#log-cloudgene").load("api/v2/admin/server/logs/cloudgene.log"); + + // Load log content + $("#log-cloudgene").load("api/v2/admin/server/logs/cloudgene.log", function() { + // Add search functionality after log is loaded + $("#log-search").on("input", function() { + const searchText = $(this).val(); + const logContent = $("#log-cloudgene").text(); + + if (searchText) { + // Escape special characters in search text + const escapedSearch = searchText.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + const regex = new RegExp(escapedSearch, 'gi'); + + // Replace matches with highlighted spans + const highlightedContent = logContent.replace(regex, + match => `${match}`); + + $("#log-cloudgene").html(highlightedContent); + } else { + // If search is empty, show original content + $("#log-cloudgene").text(logContent); + } + }); + }); } }); diff --git a/src/main/html/webapp/components/admin/settings/logs/logs.stache b/src/main/html/webapp/components/admin/settings/logs/logs.stache index 980e9d65..40ef717d 100644 --- a/src/main/html/webapp/components/admin/settings/logs/logs.stache +++ b/src/main/html/webapp/components/admin/settings/logs/logs.stache @@ -1,6 +1,33 @@

Logs

-

logs/cloudgene.log

+
+ +

logs/cloudgene.log

+

+
-

+