@@ -34,11 +34,20 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
3434
3535 // if(!columnData) return h('div.loading', "Loading...")
3636
37- const filteredGroups = columnGroups . filter ( ( group ) => {
38- const name = group . name . toLowerCase ( ) ;
39- const columns = group . columns . map ( ( col ) => col . col_name . toLowerCase ( ) ) ;
40- const input = columnInput . toLowerCase ( ) ;
41- return name . includes ( input ) || columns . some ( ( col ) => col . includes ( input ) ) ;
37+ const filteredGroups = columnGroups . filter ( ( group ) => {
38+ // Filter the columns of the group based on the input
39+ const filteredColumns = group . columns . filter ( ( col ) => {
40+ const name = col . col_name . toLowerCase ( ) ;
41+ const input = columnInput . toLowerCase ( ) ;
42+ return name . includes ( input ) ;
43+ } ) ;
44+
45+ // If any columns match the input, include the group (with the filtered columns)
46+ if ( filteredColumns . length > 0 || group . name . toLowerCase ( ) . includes ( columnInput . toLowerCase ( ) ) ) {
47+ return { ...group , columns : filteredColumns } ; // Return the group with filtered columns
48+ }
49+
50+ return false ; // Exclude this group if no matching columns or group name
4251 } ) ;
4352
4453 const colArr = filteredGroups . map ( item => item . columns . map ( col => col . col_id ) ) . flat ( ) ;
@@ -63,7 +72,7 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
6372
6473 if ( ! columnData ) return h ( 'div.loading' , "loading..." ) ;
6574
66- const columnFeatures = columnData ?. success . data . features
75+ const columnFeatures = columnData ?. success ? .data . features
6776
6877 return h ( "div.column-list-page" , [
6978 h ( AssistantLinks , [
@@ -72,14 +81,14 @@ function ColumnListPage({ title = "Columns", linkPrefix = "/" }) {
7281 ] ) ,
7382 h ( ContentPage , [
7483 h ( PageHeader , { title } ) ,
75- h ( ColumnMap , {
84+ columnFeatures ? h ( ColumnMap , {
7685 className : "column-map" ,
7786 inProcess : true ,
7887 projectID : null ,
7988 selectedColumn : null ,
8089 onSelectColumn,
8190 columns : columnFeatures ,
82- } ) ,
91+ } ) : null ,
8392 h ( Card , { className : "search-bar" } , [
8493 h ( Icon , { icon : "search" } ) ,
8594 h ( "input" , {
@@ -142,4 +151,5 @@ function ColumnItem({ data, linkPrefix = "/" }) {
142151
143152function UpperCase ( str ) {
144153 return str . charAt ( 0 ) . toUpperCase ( ) + str . slice ( 1 ) ;
145- }
154+ }
155+
0 commit comments