mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove unused code
Signed-off-by: alexfront <alex.andreev.email@gmail.com>
This commit is contained in:
parent
dadd69ef03
commit
1898a4d68e
@ -13,11 +13,10 @@ import type { LogTabViewModel } from "./logs-view-model";
|
|||||||
|
|
||||||
export interface PodLogSearchProps {
|
export interface PodLogSearchProps {
|
||||||
onSearch?: (query: string) => void;
|
onSearch?: (query: string) => void;
|
||||||
scrollToOverlay: (lineNumber: number | undefined) => void;
|
|
||||||
model: LogTabViewModel;
|
model: LogTabViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const LogSearch = observer(({ onSearch, scrollToOverlay, model: { logTabData, searchStore, ...model }}: PodLogSearchProps) => {
|
export const LogSearch = observer(({ onSearch, model: { logTabData, searchStore, ...model }}: PodLogSearchProps) => {
|
||||||
const tabData = logTabData.get();
|
const tabData = logTabData.get();
|
||||||
|
|
||||||
if (!tabData) {
|
if (!tabData) {
|
||||||
@ -33,17 +32,14 @@ export const LogSearch = observer(({ onSearch, scrollToOverlay, model: { logTabD
|
|||||||
const setSearch = (query: string) => {
|
const setSearch = (query: string) => {
|
||||||
searchStore.onSearch(logs, query);
|
searchStore.onSearch(logs, query);
|
||||||
onSearch?.(query);
|
onSearch?.(query);
|
||||||
scrollToOverlay(searchStore.activeOverlayLine);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPrevOverlay = () => {
|
const onPrevOverlay = () => {
|
||||||
setPrevOverlayActive();
|
setPrevOverlayActive();
|
||||||
scrollToOverlay(searchStore.activeOverlayLine);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onNextOverlay = () => {
|
const onNextOverlay = () => {
|
||||||
setNextOverlayActive();
|
setNextOverlayActive();
|
||||||
scrollToOverlay(searchStore.activeOverlayLine);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClear = () => {
|
const onClear = () => {
|
||||||
|
|||||||
@ -3,12 +3,10 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { createRef, useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { InfoPanel } from "../info-panel";
|
import { InfoPanel } from "../info-panel";
|
||||||
import { LogResourceSelector } from "./resource-selector";
|
import { LogResourceSelector } from "./resource-selector";
|
||||||
import type { LogListRef } from "./list";
|
|
||||||
// import { LogList } from "./list";
|
|
||||||
import { LogSearch } from "./search";
|
import { LogSearch } from "./search";
|
||||||
import { LogControls } from "./controls";
|
import { LogControls } from "./controls";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
@ -20,7 +18,6 @@ import type { SubscribeStores } from "../../../kube-watch-api/kube-watch-api";
|
|||||||
import subscribeStoresInjectable from "../../../kube-watch-api/subscribe-stores.injectable";
|
import subscribeStoresInjectable from "../../../kube-watch-api/subscribe-stores.injectable";
|
||||||
import type { PodStore } from "../../+workloads-pods/store";
|
import type { PodStore } from "../../+workloads-pods/store";
|
||||||
import podStoreInjectable from "../../+workloads-pods/store.injectable";
|
import podStoreInjectable from "../../+workloads-pods/store.injectable";
|
||||||
import { noop } from "lodash";
|
|
||||||
import { LogList } from "./log-list";
|
import { LogList } from "./log-list";
|
||||||
|
|
||||||
export interface LogsDockTabProps {
|
export interface LogsDockTabProps {
|
||||||
@ -41,7 +38,6 @@ const NonInjectedLogsDockTab = observer(({
|
|||||||
subscribeStores,
|
subscribeStores,
|
||||||
podStore,
|
podStore,
|
||||||
}: Dependencies & LogsDockTabProps) => {
|
}: Dependencies & LogsDockTabProps) => {
|
||||||
const logListElement = createRef<LogListRef>();
|
|
||||||
const data = model.logTabData.get();
|
const data = model.logTabData.get();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -55,27 +51,6 @@ const NonInjectedLogsDockTab = observer(({
|
|||||||
namespaces: data ? [data.namespace] : [],
|
namespaces: data ? [data.namespace] : [],
|
||||||
}), [data?.namespace]);
|
}), [data?.namespace]);
|
||||||
|
|
||||||
const scrollToOverlay = (overlayLine: number | undefined) => {
|
|
||||||
if (!logListElement.current || overlayLine === undefined) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scroll vertically
|
|
||||||
logListElement.current.scrollToItem(overlayLine, "center");
|
|
||||||
// Scroll horizontally in timeout since virtual list need some time to prepare its contents
|
|
||||||
setTimeout(() => {
|
|
||||||
const overlay = document.querySelector(".PodLogs .list span.active");
|
|
||||||
|
|
||||||
if (!overlay) return;
|
|
||||||
// Note: .scrollIntoViewIfNeeded() is non-standard and thus not present in js-dom.
|
|
||||||
overlay?.scrollIntoViewIfNeeded?.();
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!data) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cssNames("PodLogs flex column", className)}>
|
<div className={cssNames("PodLogs flex column", className)}>
|
||||||
<InfoPanel
|
<InfoPanel
|
||||||
@ -83,10 +58,7 @@ const NonInjectedLogsDockTab = observer(({
|
|||||||
controls={(
|
controls={(
|
||||||
<div className="flex gaps">
|
<div className="flex gaps">
|
||||||
<LogResourceSelector model={model} />
|
<LogResourceSelector model={model} />
|
||||||
<LogSearch
|
<LogSearch model={model}/>
|
||||||
model={model}
|
|
||||||
scrollToOverlay={noop}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
showSubmitClose={false}
|
showSubmitClose={false}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user