mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-24 20:58:46 +00:00
feat(logs): improvements to searching
This commit is contained in:
@@ -2,6 +2,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getLogType, type LogLine } from "./utils";
|
||||
import React from "react";
|
||||
import { escapeRegExp } from 'lodash';
|
||||
|
||||
interface LogLineProps {
|
||||
log: LogLine;
|
||||
@@ -27,7 +28,7 @@ export function TerminalLine({ log, searchTerm }: LogLineProps) {
|
||||
const highlightMessage = (text: string, term: string) => {
|
||||
if (!term) return text;
|
||||
|
||||
const parts = text.split(new RegExp(`(${term})`, "gi"));
|
||||
const parts = text.split(new RegExp(`(${escapeRegExp(term)})`, "gi"));
|
||||
return parts.map((part, index) =>
|
||||
part.toLowerCase() === term.toLowerCase() ? (
|
||||
<span key={index} className="bg-yellow-200 dark:bg-yellow-900">
|
||||
|
||||
Reference in New Issue
Block a user