diff --git a/src/renderer/components/dock/logs/get-visible-logs.injectable.ts b/src/renderer/components/dock/logs/get-visible-logs.injectable.ts index debd13f84a..d2df3f87d6 100644 --- a/src/renderer/components/dock/logs/get-visible-logs.injectable.ts +++ b/src/renderer/components/dock/logs/get-visible-logs.injectable.ts @@ -1,3 +1,7 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ import { getInjectable } from "@ogre-tools/injectable"; import moment from "moment"; import userStoreInjectable from "../../../../common/user-store/user-store.injectable"; @@ -13,7 +17,7 @@ const getVisibleLogsInjectable = getInjectable({ return (tabId: TabId) => { const getLogTabData = di.inject(getLogTabDataInjectable); const getTimestampSplitLogs = di.inject(getTimestampSplitLogsInjectable); - const userStore = di.inject(userStoreInjectable) + const userStore = di.inject(userStoreInjectable); const logTabData = getLogTabData(tabId); if (!logTabData) { @@ -31,8 +35,8 @@ const getVisibleLogsInjectable = getInjectable({ return getTimestampSplitLogs(tabId).map(([logTimestamp, log]) => ( `${logTimestamp && moment.tz(logTimestamp, userStore.localeTimezone).format()}${log}` )); - } - } + }; + }, }); -export default getVisibleLogsInjectable; \ No newline at end of file +export default getVisibleLogsInjectable; diff --git a/src/renderer/components/dock/logs/log-list.tsx b/src/renderer/components/dock/logs/log-list.tsx index d170da5c07..edcf1f7030 100644 --- a/src/renderer/components/dock/logs/log-list.tsx +++ b/src/renderer/components/dock/logs/log-list.tsx @@ -5,12 +5,12 @@ import styles from "./log-list.module.scss"; -import { useVirtualizer } from '@tanstack/react-virtual'; -import { observer } from 'mobx-react'; -import React, { useRef } from 'react'; +import { useVirtualizer } from "@tanstack/react-virtual"; +import { observer } from "mobx-react"; +import React, { useRef } from "react"; import { cssNames } from "../../../utils"; import { LogRow } from "./log-row"; -import type { LogTabViewModel } from './logs-view-model'; +import type { LogTabViewModel } from "./logs-view-model"; import { ToBottom } from "./to-bottom"; import { useInitialScrollToBottom } from "./use-initial-scroll-to-bottom"; import { useOnScrollTop } from "./use-on-scroll-top"; @@ -38,12 +38,12 @@ export const LogList = observer(({ model }: LogListProps) => { }); const scrollTo = (index: number) => { - rowVirtualizer.scrollToIndex(index, { align: 'start', smoothScroll: false }); - } + rowVirtualizer.scrollToIndex(index, { align: "start", smoothScroll: false }); + }; const scrollToBottom = () => { scrollTo(visibleLogs.get().length - 1); - } + }; const onScroll = () => { if (!parentRef.current) return; @@ -94,6 +94,6 @@ export const LogList = observer(({ model }: LogListProps) => { )} - ) + ); }); diff --git a/src/renderer/components/dock/logs/log-row.tsx b/src/renderer/components/dock/logs/log-row.tsx index 521daa4c2f..b3fd56c56d 100644 --- a/src/renderer/components/dock/logs/log-row.tsx +++ b/src/renderer/components/dock/logs/log-row.tsx @@ -1,11 +1,15 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ import styles from "./log-row.module.scss"; -import AnsiUp from 'ansi_up'; -import DOMPurify from 'dompurify'; -import React from 'react'; -import { SearchStore } from '../../../search-store/search-store'; -import { cssNames } from '../../../utils'; -import type { LogTabViewModel } from './logs-view-model'; +import AnsiUp from "ansi_up"; +import DOMPurify from "dompurify"; +import React from "react"; +import { SearchStore } from "../../../search-store/search-store"; +import { cssNames } from "../../../utils"; +import type { LogTabViewModel } from "./logs-view-model"; const colorConverter = new AnsiUp(); @@ -54,4 +58,4 @@ export function LogRow({ rowIndex, model }: { rowIndex: number; model: LogTabVie
); -} \ No newline at end of file +} diff --git a/src/renderer/components/dock/logs/use-initial-scroll-to-bottom.ts b/src/renderer/components/dock/logs/use-initial-scroll-to-bottom.ts index 4593e37a3e..164df8aab6 100644 --- a/src/renderer/components/dock/logs/use-initial-scroll-to-bottom.ts +++ b/src/renderer/components/dock/logs/use-initial-scroll-to-bottom.ts @@ -1,3 +1,7 @@ +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ import { useEffect } from "react"; import type { LogTabViewModel } from "./logs-view-model"; @@ -5,6 +9,6 @@ export function useInitialScrollToBottom(model: LogTabViewModel, callback: () => useEffect(() => { setTimeout(() => { callback(); - }, 300) // Giving some time virtual library to render its rows - }, [model.logTabData.get()?.selectedPodId]) -} \ No newline at end of file + }, 300); // Giving some time virtual library to render its rows + }, [model.logTabData.get()?.selectedPodId]); +} diff --git a/src/renderer/components/dock/logs/use-scroll-to-bottom.ts b/src/renderer/components/dock/logs/use-scroll-to-bottom.ts index ef97b909f9..8a8cb72cc9 100644 --- a/src/renderer/components/dock/logs/use-scroll-to-bottom.ts +++ b/src/renderer/components/dock/logs/use-scroll-to-bottom.ts @@ -1,4 +1,8 @@ -import { useState } from 'react'; +/** + * Copyright (c) OpenLens Authors. All rights reserved. + * Licensed under MIT License. See LICENSE in root directory for more information. + */ +import { useState } from "react"; export function useJumpToBottomButton(scrolledParent: HTMLDivElement | null): [isVisible: boolean, setVisibility: () => void] { const [isVisible, setToBottomVisible] = useState(false); @@ -13,7 +17,7 @@ export function useJumpToBottomButton(scrolledParent: HTMLDivElement | null): [i } else { setToBottomVisible(false); } - } + }; return [isVisible, setVisibility]; -} \ No newline at end of file +}