mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix search within timestamps if they not provided
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
fcf94224d4
commit
de536b8436
@ -1,6 +1,6 @@
|
||||
import "./pod-log-search.scss";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { SearchInput } from "../input";
|
||||
import { searchStore } from "./search.store";
|
||||
@ -40,6 +40,11 @@ export const PodLogSearch = observer((props: PodLogSearchProps) => {
|
||||
toNextOverlay();
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
// Refresh search when logs changed
|
||||
searchStore.onSearch(logs);
|
||||
}, [logs]);
|
||||
|
||||
return (
|
||||
<div className="PodLogsSearch flex box grow justify-flex-end gaps align-center">
|
||||
<SearchInput
|
||||
|
||||
@ -48,8 +48,6 @@ export class PodLogsStore extends DockTabStore<IPodLogsData> {
|
||||
|
||||
reaction(() => this.logs.get(dockStore.selectedTabId), () => {
|
||||
this.setNewLogSince(dockStore.selectedTabId);
|
||||
// Refresh search when logs changed
|
||||
searchStore.onSearch(this.logs.get(dockStore.selectedTabId));
|
||||
})
|
||||
|
||||
reaction(() => dockStore.selectedTabId, () => {
|
||||
|
||||
@ -18,7 +18,7 @@ export class SearchStore {
|
||||
this.reset();
|
||||
return;
|
||||
}
|
||||
this.occurrences = this.findOccurencies(text, query);
|
||||
this.occurrences = this.findOccurences(text, query);
|
||||
if (!this.occurrences.length) return;
|
||||
|
||||
// If new highlighted keyword in exact same place as previous one, then no changing in active overlay
|
||||
@ -33,7 +33,7 @@ export class SearchStore {
|
||||
* @param query Search query from input
|
||||
* @returns {Array} Array of line indexes [0, 0, 14, 17, 17, 17, 20...]
|
||||
*/
|
||||
findOccurencies(text: string[], query: string) {
|
||||
findOccurences(text: string[], query: string) {
|
||||
if (!text) return [];
|
||||
const occurences: number[] = [];
|
||||
text.forEach((line, index) => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user