Skip to content

Commit

Permalink
Fix the updating of the schema browser
Browse files Browse the repository at this point in the history
  • Loading branch information
kimakan committed Jan 21, 2025
1 parent a1588af commit e8b3c9c
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions daiquiri/metadata/assets/js/components/Schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,38 +47,17 @@ const Schemas = ({ schemas, activeItem, setActiveItem, getTooltip, onDoubleClick
setVisibleColumns((isNil(table) || isNil(table.columns)) ? [] : table.columns)

} else if (activeItem.type == 'table') {
// search for the schema and table
const [schema, table] = schemas.reduce((result, schema) => {
// search for the table
const table = schemas.reduce((result, schema) => {
const table = (schema.tables || []).find(t => isEqual(t, activeItem))
return isNil(table) ? result : [schema, table]
}, [])

if (schema) {
setOpenSchema(schema)
setVisibleTables(schema.tables)
}
return isNil(table) ? result : table
}, null )

if (table) {
setOpenTable(table)
setVisibleColumns(table.columns)
}

} else if (activeItem.type == 'column') {
// search for the schema and the table for the column
const [schema, table] = schemas.reduce((result, schema) => {
const table = (schema.tables || []).find(t => (t.columns && t.columns.find(c => isEqual(c, activeItem))))
return isNil(table) ? result : [schema, table]
}, [])

if (schema) {
setOpenSchema(schema)
setVisibleTables(schema.tables)
}

if (table) {
setOpenTable(table)
setVisibleColumns(table.columns)
}
}
}
}
Expand Down

0 comments on commit e8b3c9c

Please sign in to comment.