(null);
const { initialDataSource } = useQueryBuilder();
const { activeLogId } = useCopyLogLink();
const {
activeLog,
onClearActiveLog,
onAddToQuery,
onSetActiveLog,
} = useActiveLog();
const { options } = useOptionsMenu({
storageKey: LOCALSTORAGE.LOGS_LIST_OPTIONS,
dataSource: initialDataSource || DataSource.METRICS,
aggregateOperator:
currentStagedQueryData?.aggregateOperator || StringOperators.NOOP,
});
const activeLogIndex = useMemo(
() => logs.findIndex(({ id }) => id === activeLogId),
[logs, activeLogId],
);
const selectedFields = useMemo(
() => convertKeysToColumnFields(options.selectColumns),
[options],
);
const getItemContent = useCallback(
(_: number, log: ILog): JSX.Element => {
if (options.format === 'raw') {
return (
);
}
return (
);
},
[
activeLog,
onAddToQuery,
onSetActiveLog,
options.format,
options.maxLines,
selectedFields,
],
);
const renderContent = useMemo(() => {
const components = isLoading
? {
Footer,
}
: {};
if (options.format === 'table') {
return (
);
}
return (
);
}, [
isLoading,
options.format,
options.maxLines,
activeLogIndex,
logs,
onEndReached,
getItemContent,
selectedFields,
]);
return (
{(isLoading || (isFetching && logs.length === 0)) && }
{!isLoading &&
!isFetching &&
!isError &&
!isFilterApplied &&
logs.length === 0 && }
{!isLoading &&
!isFetching &&
logs.length === 0 &&
!isError &&
isFilterApplied && (
)}
{isError && !isLoading && !isFetching && }
{!isLoading && !isError && logs.length > 0 && (
<>
{renderContent}
>
)}
);
}
export default memo(LogsExplorerList);