Feat: logs UI fix

This commit is contained in:
Harshith Mullapudi 2025-08-22 21:08:38 +05:30
parent 162a565752
commit cfb0af6d08
4 changed files with 9 additions and 2 deletions

View File

@ -21,9 +21,10 @@ import { redirect, useFetcher } from "@remix-run/react";
interface LogOptionsProps { interface LogOptionsProps {
id: string; id: string;
reset?: () => void;
} }
export const LogOptions = ({ id }: LogOptionsProps) => { export const LogOptions = ({ id, reset }: LogOptionsProps) => {
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
const deleteFetcher = useFetcher<{ success: boolean }>(); const deleteFetcher = useFetcher<{ success: boolean }>();

View File

@ -36,6 +36,7 @@ export function LogTextCollapse({
error, error,
id, id,
log, log,
reset,
}: LogTextCollapseProps) { }: LogTextCollapseProps) {
const [dialogOpen, setDialogOpen] = useState(false); const [dialogOpen, setDialogOpen] = useState(false);

View File

@ -24,6 +24,7 @@ function LogItemRenderer(
props: ListRowProps, props: ListRowProps,
logs: LogItem[], logs: LogItem[],
cache: CellMeasurerCache, cache: CellMeasurerCache,
reset?: () => void,
) { ) {
const { index, key, style, parent } = props; const { index, key, style, parent } = props;
const log = logs[index]; const log = logs[index];
@ -60,6 +61,7 @@ function LogItemRenderer(
logData={log.data} logData={log.data}
log={log} log={log}
id={log.id} id={log.id}
reset={reset}
/> />
</div> </div>
</div> </div>
@ -72,6 +74,7 @@ export function VirtualLogsList({
hasMore, hasMore,
loadMore, loadMore,
isLoading, isLoading,
reset,
}: VirtualLogsListProps) { }: VirtualLogsListProps) {
// Create a CellMeasurerCache instance using useRef to prevent recreation // Create a CellMeasurerCache instance using useRef to prevent recreation
const cacheRef = useRef<CellMeasurerCache | null>(null); const cacheRef = useRef<CellMeasurerCache | null>(null);
@ -100,7 +103,7 @@ export function VirtualLogsList({
}; };
const rowRenderer = (props: ListRowProps) => { const rowRenderer = (props: ListRowProps) => {
return LogItemRenderer(props, logs, cache); return LogItemRenderer(props, logs, cache, reset);
}; };
const rowHeight = ({ index }: Index) => { const rowHeight = ({ index }: Index) => {

View File

@ -20,6 +20,7 @@ export default function LogsAll() {
availableSources, availableSources,
isLoading, isLoading,
isInitialLoad, isInitialLoad,
reset,
} = useLogs({ } = useLogs({
endpoint: "/api/v1/logs", endpoint: "/api/v1/logs",
source: selectedSource, source: selectedSource,
@ -96,6 +97,7 @@ export default function LogsAll() {
loadMore={loadMore} loadMore={loadMore}
isLoading={isLoading} isLoading={isLoading}
height={600} height={600}
reset={reset}
/> />
)} )}
</div> </div>