+
+
Project Knowledge
+
+
{/* Search Input Area */}
-
+
-
- {/* Results Area */}
-
-
- {fileResults.length === 0 && !isFetching ? (
-
+ {selectedFile ? (
+ // Show chunks for selected file
+ <>
+
+
+
+ Chunks from {selectedFile}
+
+
+ {fileResults
+ .filter((file) => file.filename === selectedFile)
+ .flatMap((file) => file.chunks)
+ .map((chunk, index) => (
+
+
+
+
+
+ {chunk.filename}
+
+
+
+ {chunk.score.toFixed(2)}
+
+
+
+ {chunk.mimetype} • Page {chunk.page}
+
+
+ {chunk.text}
+
+
+ ))}
+ >
+ ) : (
+
) => {
+ setSelectedFile(params.data?.filename ?? "");
+ }}
+ noRowsOverlayComponent={() => (
+
No documents found
@@ -128,140 +272,9 @@ function SearchPage() {
Try adjusting your search terms
- ) : (
-
- {/* Results Count */}
-
-
- {fileResults.length} file
- {fileResults.length !== 1 ? "s" : ""} found
-
-
-
- {/* Results Display */}
-
- {selectedFile ? (
- // Show chunks for selected file
- <>
-
-
-
- Chunks from {selectedFile}
-
-
- {fileResults
- .filter((file) => file.filename === selectedFile)
- .flatMap((file) => file.chunks)
- .map((chunk, index) => (
-
-
-
-
-
- {chunk.filename}
-
-
-
- {chunk.score.toFixed(2)}
-
-
-
- {chunk.mimetype} • Page {chunk.page}
-
-
- {chunk.text}
-
-
- ))}
- >
- ) : (
- // Show files table
-
-
-
-
- |
- Source
- |
-
- Type
- |
-
- Size
- |
-
- Matching chunks
- |
-
- Average score
- |
-
- Owner
- |
-
-
-
- {fileResults.map((file) => (
- setSelectedFile(file.filename)}
- >
- |
-
- {getSourceIcon(file.connector_type)}
-
- {file.filename}
-
-
- |
-
- {file.mimetype}
- |
-
- {file.size
- ? `${Math.round(file.size / 1024)} KB`
- : "—"}
- |
-
- {file.chunkCount}
- |
-
-
- {file.avgScore.toFixed(2)}
-
- |
-
- {file.owner_name || file.owner || "—"}
- |
-
- ))}
-
-
-
- )}
-
-
)}
-
-
+ />
+ )}
);
diff --git a/frontend/src/components/AgGrid/agGridStyles.css b/frontend/src/components/AgGrid/agGridStyles.css
new file mode 100644
index 00000000..b595e18c
--- /dev/null
+++ b/frontend/src/components/AgGrid/agGridStyles.css
@@ -0,0 +1,21 @@
+body {
+ --ag-text-color: hsl(var(--muted-foreground));
+ --ag-background-color: hsl(var(--background));
+ --ag-header-background-color: hsl(var(--background));
+ --ag-header-text-color: hsl(var(--muted-foreground));
+ --ag-header-column-resize-handle-color: hsl(var(--border));
+ --ag-header-row-border: hsl(var(--border));
+ --ag-header-font-weight: var(--font-medium);
+ --ag-row-border: undefined;
+ --ag-row-hover-color: hsl(var(--muted));
+ --ag-wrapper-border: none;
+ --ag-font-family: var(--font-sans);
+
+ .ag-header {
+ border-bottom: 1px solid hsl(var(--border));
+ margin-bottom: 0.5rem;
+ }
+ .ag-row {
+ cursor: pointer;
+ }
+}
diff --git a/frontend/src/components/AgGrid/registerAgGridModules.ts b/frontend/src/components/AgGrid/registerAgGridModules.ts
new file mode 100644
index 00000000..da2c5280
--- /dev/null
+++ b/frontend/src/components/AgGrid/registerAgGridModules.ts
@@ -0,0 +1,33 @@
+import {
+ ModuleRegistry,
+ ValidationModule,
+ ColumnAutoSizeModule,
+ ColumnApiModule,
+ PaginationModule,
+ CellStyleModule,
+ QuickFilterModule,
+ ClientSideRowModelModule,
+ TextFilterModule,
+ DateFilterModule,
+ EventApiModule,
+ GridStateModule,
+ } from 'ag-grid-community';
+
+ // Importing necessary modules from ag-grid-community
+ // https://www.ag-grid.com/javascript-data-grid/modules/#selecting-modules
+
+ ModuleRegistry.registerModules([
+ ColumnAutoSizeModule,
+ ColumnApiModule,
+ PaginationModule,
+ CellStyleModule,
+ QuickFilterModule,
+ ClientSideRowModelModule,
+ TextFilterModule,
+ DateFilterModule,
+ EventApiModule,
+ GridStateModule,
+ // The ValidationModule adds helpful console warnings/errors that can help identify bad configuration during development.
+ ...(process.env.NODE_ENV !== 'production' ? [ValidationModule] : []),
+ ]);
+
\ No newline at end of file