mirror of
https://github.com/apache/superset.git
synced 2026-04-27 12:05:24 +00:00
catch collapse onchange (#13927)
This commit is contained in:
committed by
GitHub
parent
541d23bbd1
commit
abd4051f7a
@@ -59,6 +59,7 @@ export default class SqlEditorLeftBar extends React.PureComponent {
|
||||
this.onDbChange = this.onDbChange.bind(this);
|
||||
this.getDbList = this.getDbList.bind(this);
|
||||
this.onTableChange = this.onTableChange.bind(this);
|
||||
this.onToggleTable = this.onToggleTable.bind(this);
|
||||
}
|
||||
|
||||
onSchemaChange(schema) {
|
||||
@@ -91,6 +92,16 @@ export default class SqlEditorLeftBar extends React.PureComponent {
|
||||
this.props.actions.addTable(this.props.queryEditor, tableName, schemaName);
|
||||
}
|
||||
|
||||
onToggleTable(tables) {
|
||||
this.props.tables.forEach(table => {
|
||||
if (!tables.includes(table.id.toString()) && table.expanded) {
|
||||
this.props.actions.collapseTable(table);
|
||||
} else if (tables.includes(table.id.toString()) && !table.expanded) {
|
||||
this.props.actions.expandTable(table);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
getDbList(dbs) {
|
||||
this.props.actions.setDatabases(dbs);
|
||||
}
|
||||
@@ -172,13 +183,13 @@ export default class SqlEditorLeftBar extends React.PureComponent {
|
||||
`}
|
||||
expandIconPosition="right"
|
||||
ghost
|
||||
onChange={this.onToggleTable}
|
||||
>
|
||||
{this.props.tables.map(table => (
|
||||
<TableElement
|
||||
table={table}
|
||||
key={table.id}
|
||||
actions={this.props.actions}
|
||||
onClick={this.toggleTable}
|
||||
/>
|
||||
))}
|
||||
</Collapse>
|
||||
|
||||
Reference in New Issue
Block a user