feat(objects): search table fields by comment
This commit is contained in:
1 parent
63ea5f1fd8
commit
17747f8a2d
3 files changed
+63
-5
No files matched your search
@@ -0,0 +1,13 @@
|
||||
type SearchableTableInfoColumn = {
|
||||
name: string;
|
||||
data_type: string;
|
||||
comment?: string | null;
|
||||
};
|
||||
|
||||
/** Keep table-info search aligned with the name, type, and comment text visible in the field list. */
|
||||
export function filterObjectBrowserTableColumns<T extends SearchableTableInfoColumn>(columns: T[], query: string): T[] {
|
||||
const normalizedQuery = query.trim().toLocaleLowerCase();
|
||||
if (!normalizedQuery) return columns;
|
||||
|
||||
return columns.filter((column) => [column.name, column.data_type, column.comment].some((value) => typeof value === "string" && value.toLocaleLowerCase().includes(normalizedQuery)));
|
||||
}
|
||||
Reference in new issue
Block a user