LogLineContext: add copy link to log line support (#112632)
* LogLineContext: add copy link to log line * Prettier * InfiniteScroll: prevent ghost infinite scrolling in log context
This commit is contained in:
@@ -786,6 +786,7 @@ const UnthemedLogs: React.FunctionComponent<Props> = (props: Props) => {
|
||||
logOptionsStorageKey={SETTING_KEY_ROOT}
|
||||
timeZone={timeZone}
|
||||
displayedFields={displayedFields}
|
||||
onPermalinkClick={onPermalinkClick}
|
||||
onClickShowField={showField}
|
||||
onClickHideField={hideField}
|
||||
/>
|
||||
|
||||
@@ -75,7 +75,7 @@ export const InfiniteScroll = ({
|
||||
const styles = useStyles2(getStyles, virtualization);
|
||||
const resetStateTimeout = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
const scrollToLogLineRef = useRef<LogListModel | undefined>(undefined);
|
||||
const noScrollRef = useRef(false);
|
||||
const noScrollRef = useRef<undefined | boolean>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
// Logs have not changed, ignore effect
|
||||
@@ -144,7 +144,13 @@ export const InfiniteScroll = ({
|
||||
}
|
||||
|
||||
function handleScroll(event: Event | WheelEvent) {
|
||||
if (!scrollElement || !loadMore || !logs.length) {
|
||||
if (
|
||||
!scrollElement ||
|
||||
!loadMore ||
|
||||
!logs.length ||
|
||||
noScrollRef.current === undefined ||
|
||||
noScrollRef.current === true
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const scrollDirection = shouldLoadMore(event, lastEvent.current, countRef, scrollElement, lastScroll.current);
|
||||
|
||||
@@ -36,6 +36,7 @@ import { ScrollDirection } from '../InfiniteScroll';
|
||||
import { LoadingIndicator } from '../LoadingIndicator';
|
||||
|
||||
import { LogLineDetailsLog } from './LogLineDetailsLog';
|
||||
import { LogLineMenuCustomItem } from './LogLineMenu';
|
||||
import { LogList } from './LogList';
|
||||
import { LogListModel } from './processing';
|
||||
import { ScrollToLogsEvent } from './virtualization';
|
||||
@@ -56,6 +57,8 @@ interface LogLineContextProps {
|
||||
runContextQuery?: () => void;
|
||||
getLogRowContextUi?: DataSourceWithLogsContextSupport['getLogRowContextUi'];
|
||||
displayedFields?: string[];
|
||||
logLineMenuCustomItems?: LogLineMenuCustomItem[];
|
||||
onPermalinkClick?: (row: LogRowModel) => Promise<void>;
|
||||
onClickShowField?: (key: string) => void;
|
||||
onClickHideField?: (key: string) => void;
|
||||
}
|
||||
@@ -77,6 +80,8 @@ export const LogLineContext = memo(
|
||||
onClose,
|
||||
getRowContext,
|
||||
displayedFields = [],
|
||||
logLineMenuCustomItems,
|
||||
onPermalinkClick,
|
||||
onClickShowField,
|
||||
onClickHideField,
|
||||
}: LogLineContextProps) => {
|
||||
@@ -391,9 +396,11 @@ export const LogLineContext = memo(
|
||||
eventBus={eventBusRef.current}
|
||||
infiniteScrollMode="unlimited"
|
||||
loadMore={handleLoadMore}
|
||||
logLineMenuCustomItems={logLineMenuCustomItems}
|
||||
logs={allLogs}
|
||||
loading={aboveState === LoadingState.Loading || belowState === LoadingState.Loading}
|
||||
permalinkedLogId={log.uid}
|
||||
onPermalinkClick={onPermalinkClick}
|
||||
onClickHideField={onClickHideField}
|
||||
onClickShowField={onClickShowField}
|
||||
showControls
|
||||
|
||||
@@ -562,8 +562,10 @@ export const LogsPanel = ({
|
||||
getRowContext={(row, options) => getLogRowContext(row, contextRow, options)}
|
||||
getLogRowContextUi={getLogRowContextUi}
|
||||
logOptionsStorageKey={controlsStorageKey}
|
||||
logLineMenuCustomItems={isLogLineMenuCustomItems(logLineMenuCustomItems) ? logLineMenuCustomItems : undefined}
|
||||
timeZone={timeZone}
|
||||
displayedFields={displayedFields}
|
||||
onPermalinkClick={showPermaLink() ? onPermalinkClick : undefined}
|
||||
onClickShowField={showField}
|
||||
onClickHideField={hideField}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user