overview-table.tsx

Overview

overview-table.tsx is a React functional component file that implements a versatile, paginated, and sortable data table to display file and dataset logs in a user interface. The component supports two distinct views (tabs) — File Logs and Dataset Logs — each with customized columns and operations. It leverages the powerful @tanstack/react-table library for table state management, sorting, filtering, pagination, and row selection.

The component provides interactive features such as:

The file exports:


Exports

getFileLogsTableColumns

function getFileLogsTableColumns(
  t: TFunction<'translation', string>,
  setIsModalVisible: Dispatch<SetStateAction<boolean>>,
  navigateToDataflowResult: (id: string, knowledgeId?: string) => () => void,
): ColumnDef<DocumentLog>[]

Description

Generates and returns an array of column definitions tailored for the File Logs table view.

Parameters

Returns

Usage Example

const columns = getFileLogsTableColumns(t, setIsModalVisible, navigateToDataflowResult);

Important Columns


getDatasetLogsTableColumns

function getDatasetLogsTableColumns(
  t: TFunction<'translation', string>,
  setIsModalVisible: Dispatch<SetStateAction<boolean>>
): ColumnDef<DocumentLog>[]

Description

Returns column definitions customized for the Dataset Logs table view.

Parameters

Returns

Usage Example

const columns = getDatasetLogsTableColumns(t, setIsModalVisible);

Important Columns


FileLogsTable

const FileLogsTable: FC<FileLogsTableProps>

Description

The main React functional component that renders a paginated, sortable, and filterable table of logs for files or datasets depending on the active tab. It manages table state, renders the table UI, pagination controls, and process log modal.

Props

Name

Type

Description

data

DocumentLog[]

Array of log entries to display.

pageCount

number

Total number of pages (not used explicitly).

pagination

{ current: number; pageSize: number; total: number }

Pagination state (current page, page size, total items).

setPagination

(pagination: { page: number; pageSize: number }) => void

Callback to update pagination state.

loading

boolean (optional)

Flag indicating if data is loading.

active

typeof LogTabs[keyof typeof LogTabs]

Indicates which tab is active (File Logs or Dataset Logs). Default is File Logs.

Returns

Usage Example

<FileLogsTable
  data={logs}
  pagination={{ current: 1, pageSize: 10, total: 100 }}
  setPagination={({ page, pageSize }) => setPageInfo({ page, pageSize })}
  active={LogTabs.FILE_LOGS}
/>

Implementation Details


Interfaces

DocumentLog

Represents a single log entry.

Property

Type

Description

id

string

Unique identifier of the log.

fileName

string

Name of the file involved.

source

string

Source of the data/file.

pipeline

string

Name of the data pipeline used.

startDate

string

Start date/time of the log entry.

task

string

Task description.

status

`'Success' \

'Failed' \


FileLogsTableProps

Props for the FileLogsTable component.

Property

Type

Description

data

DocumentLog[]

Array of log entries.

pageCount

number

Total pages (not directly used).

pagination

{ current: number; pageSize: number; total: number }

Pagination state.

setPagination

(pagination: { page: number; pageSize: number }) => void

Function to update pagination.

loading

boolean (optional)

Loading indicator.

active

LogTabs (enum value)

Active tab indicator (File or Dataset Logs).


Important Implementation Details and Algorithms


Interaction With Other System Components


Visual Diagram

classDiagram
    class FileLogsTable {
        -data: DocumentLog[]
        -pagination: {current: number; pageSize: number; total: number}
        -loading?: boolean
        -active: LogTabs
        -sorting: SortingState
        -columnFilters: ColumnFiltersState
        -rowSelection: object
        -isModalVisible: boolean
        +render()
    }

    class getFileLogsTableColumns {
        +t: TFunction
        +setIsModalVisible: Dispatch<SetStateAction<boolean>>
        +navigateToDataflowResult(id: string, knowledgeId?: string): () => void
        +returns ColumnDef<DocumentLog>[]
    }

    class getDatasetLogsTableColumns {
        +t: TFunction
        +setIsModalVisible: Dispatch<SetStateAction<boolean>>
        +returns ColumnDef<DocumentLog>[]
    }

    FileLogsTable --> getFileLogsTableColumns : uses
    FileLogsTable --> getDatasetLogsTableColumns : uses
    FileLogsTable --> ProcessLogModal : renders
    FileLogsTable --> RAGFlowPagination : renders
    FileLogsTable --> useReactTable : manages state

Summary

The overview-table.tsx file implements a comprehensive log viewing component for files and datasets. It provides flexible column configurations, rich interactive features (selection, sorting, filtering, pagination), and integrates tightly with the application’s UI components and navigation logic. The clear separation of column definitions for different tabs and the use of @tanstack/react-table for state management make this component both powerful and maintainable.