mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Cleanup SearchStore (#2299)
This commit is contained in:
1 parent
373d2d2a47
commit
c0d18ff19e
4 files changed
+70
-61
No files matched your search
@@ -8,7 +8,7 @@ import { action, computed, observable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import { Align, ListOnScrollProps } from "react-window";
|
||||
|
||||
import { searchStore } from "../../../common/search-store";
|
||||
import { SearchStore, searchStore } from "../../../common/search-store";
|
||||
import { cssNames } from "../../utils";
|
||||
import { Button } from "../button";
|
||||
import { Icon } from "../icon";
|
||||
@@ -164,7 +164,7 @@ export class LogList extends React.Component<Props> {
|
||||
|
||||
if (searchQuery) { // If search is enabled, replace keyword with backgrounded <span>
|
||||
// Case-insensitive search (lowercasing query and keywords in line)
|
||||
const regex = new RegExp(searchStore.escapeRegex(searchQuery), "gi");
|
||||
const regex = new RegExp(SearchStore.escapeRegex(searchQuery), "gi");
|
||||
const matches = item.matchAll(regex);
|
||||
const modified = item.replace(regex, match => match.toLowerCase());
|
||||
// Splitting text line by keyword
|
||||
|
||||
@@ -59,9 +59,9 @@ export class LogStore {
|
||||
};
|
||||
|
||||
/**
|
||||
* Function is used to refreser/stream-like requests.
|
||||
* Function is used to refresher/stream-like requests.
|
||||
* It changes 'sinceTime' param each time allowing to fetch logs
|
||||
* starting from last line recieved.
|
||||
* starting from last line received.
|
||||
* @param tabId
|
||||
*/
|
||||
loadMore = async (tabId: TabId) => {
|
||||
@@ -91,7 +91,7 @@ export class LogStore {
|
||||
|
||||
return podsApi.getLogs({ namespace, name }, {
|
||||
...params,
|
||||
timestamps: true, // Always setting timestampt to separate old logs from new ones
|
||||
timestamps: true, // Always setting timestamp to separate old logs from new ones
|
||||
container: selectedContainer.name,
|
||||
previous
|
||||
}).then(result => {
|
||||
@@ -120,11 +120,7 @@ export class LogStore {
|
||||
* Returns logs with timestamps for selected tab
|
||||
*/
|
||||
get logs() {
|
||||
const id = dockStore.selectedTabId;
|
||||
|
||||
if (!this.podLogs.has(id)) return [];
|
||||
|
||||
return this.podLogs.get(id);
|
||||
return this.podLogs.get(dockStore.selectedTabId) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user