/** * Copyright (c) OpenLens Authors. All rights reserved. * Licensed under MIT License. See LICENSE in root directory for more information. */ import "./search.scss"; import React, { useEffect } from "react"; import { observer } from "mobx-react"; import { SearchInput } from "../../input"; import { Icon } from "../../icon"; import type { LogTabViewModel } from "./logs-view-model"; export interface PodLogSearchProps { onSearch: (query: string) => void; toPrevOverlay: () => void; toNextOverlay: () => void; model: LogTabViewModel; } export const LogSearch = observer(({ onSearch, toPrevOverlay, toNextOverlay, model }: PodLogSearchProps) => { const tabData = model.logTabData.get(); if (!tabData) { return null; } const logs = tabData.showTimestamps ? model.logs.get() : model.logsWithoutTimestamps.get(); const { setNextOverlayActive, setPrevOverlayActive, searchQuery, occurrences, activeFind, totalFinds } = model.searchStore; const jumpDisabled = !searchQuery || !occurrences.length; const findCounts = (