You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by hu...@apache.org on 2019/05/11 06:30:01 UTC

[incubator-superset] branch omni-table-query created (now c97f58e)

This is an automated email from the ASF dual-hosted git repository.

hugh pushed a change to branch omni-table-query
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git.


      at c97f58e  add getTable extension

This branch includes the following new commits:

     new c97f58e  add getTable extension

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[incubator-superset] 01/01: add getTable extension

Posted by hu...@apache.org.
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 <hm...@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>
       );
   }