This is an automated email from the ASF dual-hosted git repository. hugh pushed a commit to branch omni-table-query in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
commit c97f58e7b8c61d89cffa4d85d516913d5d578c30 Author: hughhhh <hmi...@lyft.com> AuthorDate: Fri May 10 23:29:47 2019 -0700 add getTable extension --- superset/assets/src/components/OmniContainer.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/superset/assets/src/components/OmniContainer.jsx b/superset/assets/src/components/OmniContainer.jsx index edf33b9..50a0300 100644 --- a/superset/assets/src/components/OmniContainer.jsx +++ b/superset/assets/src/components/OmniContainer.jsx @@ -46,6 +46,18 @@ const getDashboards = query => title: t('An error occurred while fethching Dashboards'), })); +const getTables = query => SupersetClient.get({ + endpoint: `/tablemodelview/api/read?_flt_2_table_name=${query}` }) + .then(({ json }) => json.result.map(item => ({ + title: item.table_name, + ...item, + }), + )) + .catch(() => ({ + title: t('An error occurred while fethching Dashboards'), + })); + + class OmniContainer extends React.Component { constructor(props) { super(props); @@ -84,7 +96,7 @@ class OmniContainer extends React.Component { render() { return ( <Modal show={this.state.showOmni} style={{ marginTop: '25%' }}> - <Omnibar className="Omnibar" placeholder="Search all dashboards" extensions={[getDashboards]} /> + <Omnibar className="Omnibar" placeholder="Search all dashboards" extensions={[getDashboards, getTables]} /> </Modal> ); }