1111 * @type {object }
1212 * @property {ProjectSummary } project_summary
1313 * @property {string? } connection_id
14+ * @property {string? } table_group_name
1415 * @property {Connection[] } connections
1516 * @property {TableGroup[] } table_groups
1617 * @property {Permissions } permissions
@@ -26,6 +27,7 @@ import { EMPTY_STATE_MESSAGE, EmptyState } from '../components/empty_state.js';
2627import { Select } from '../components/select.js' ;
2728import { Icon } from '../components/icon.js' ;
2829import { withTooltip } from '../components/tooltip.js' ;
30+ import { Input } from '../components/input.js' ;
2931
3032const { div, h4, i, span } = van . tags ;
3133
@@ -49,6 +51,7 @@ const TableGroupList = (props) => {
4951 const permissions = getValue ( props . permissions ) ?? { can_edit : false } ;
5052 const connections = getValue ( props . connections ) ?? [ ] ;
5153 const connectionId = getValue ( props . connection_id ) ;
54+ const tableGroupNameFilter = getValue ( props . table_group_name ) ;
5255 const tableGroups = getValue ( props . table_groups ) ?? [ ] ;
5356 const projectSummary = getValue ( props . project_summary ) ;
5457
@@ -68,7 +71,7 @@ const TableGroupList = (props) => {
6871
6972 return projectSummary . table_group_count > 0
7073 ? div (
71- Toolbar ( permissions , connections , connectionId ) ,
74+ Toolbar ( permissions , connections , connectionId , tableGroupNameFilter ) ,
7275 tableGroups . length
7376 ? tableGroups . map ( ( tableGroup ) => Card ( {
7477 testId : 'table-group-card' ,
@@ -211,25 +214,49 @@ const TableGroupList = (props) => {
211214 * @param {Permissions } permissions
212215 * @param {Connection[] } connections
213216 * @param {string? } selectedConnection
217+ * @param {string? } tableGroupNameFilter
214218 * @returns
215219 */
216- const Toolbar = ( permissions , connections , selectedConnection ) => {
220+ const Toolbar = ( permissions , connections , selectedConnection , tableGroupNameFilter ) => {
221+ const connection = van . state ( selectedConnection || null ) ;
222+ const tableGroupFilter = van . state ( tableGroupNameFilter || null ) ;
223+
224+ van . derive ( ( ) => {
225+ if ( connection . val !== selectedConnection || tableGroupFilter . val !== tableGroupNameFilter ) {
226+ emitEvent ( 'TableGroupsFiltered' , { payload : { connection_id : connection . val || null , table_group_name : tableGroupFilter . val || null } } ) ;
227+ }
228+ } ) ;
229+
217230 return div (
218231 { class : 'flex-row fx-align-flex-end fx-justify-space-between mb-4' } ,
219- ( getValue ( connections ) ?? [ ] ) ?. length > 1
220- ? Select ( {
221- testId : 'connection-select' ,
222- label : 'Connection' ,
223- allowNull : true ,
232+ div (
233+ { class : 'flex-row fx-gap-4' } ,
234+ ( getValue ( connections ) ?? [ ] ) ?. length > 1
235+ ? Select ( {
236+ testId : 'connection-select' ,
237+ label : 'Connection' ,
238+ allowNull : true ,
239+ height : 38 ,
240+ value : connection ,
241+ options : getValue ( connections ) ?. map ( ( connection ) => ( {
242+ label : connection . connection_name ,
243+ value : String ( connection . connection_id ) ,
244+ } ) ) ?? [ ] ,
245+ onChange : ( value ) => connection . val = value ,
246+ } )
247+ : '' ,
248+ Input ( {
249+ testId : 'table-groups-name-filter' ,
250+ icon : 'search' ,
251+ label : '' ,
252+ placeholder : 'Search table group names' ,
224253 height : 38 ,
225- value : selectedConnection ,
226- options : getValue ( connections ) ?. map ( ( connection ) => ( {
227- label : connection . connection_name ,
228- value : String ( connection . connection_id ) ,
229- } ) ) ?? [ ] ,
230- onChange : ( value ) => emitEvent ( 'ConnectionSelected' , { payload : value } ) ,
231- } )
232- : span ( '' ) ,
254+ width : 300 ,
255+ clearable : true ,
256+ value : tableGroupFilter ,
257+ onChange : ( value ) => tableGroupFilter . val = value || null ,
258+ } ) ,
259+ ) ,
233260 div (
234261 { class : 'flex-row fx-gap-4' } ,
235262 Button ( {
0 commit comments