This is an automated email from the ASF dual-hosted git repository.
hugh pushed a commit to branch omnibar
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/omnibar by this push:
new acb4709 🚢
acb4709 is described below
commit acb47091ce94b37ed33bff0b880d08bb0b72747d
Author: hughhhh <[email protected]>
AuthorDate: Thu Jan 24 21:26:38 2019 -0800
🚢
---
superset/assets/src/components/OmniContainer.jsx | 17 ++++++++---------
superset/assets/src/dashboard/components/Dashboard.jsx | 4 ++--
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/superset/assets/src/components/OmniContainer.jsx
b/superset/assets/src/components/OmniContainer.jsx
index ffb3ca2..f15020e 100644
--- a/superset/assets/src/components/OmniContainer.jsx
+++ b/superset/assets/src/components/OmniContainer.jsx
@@ -21,8 +21,10 @@ import { SupersetClient } from '@superset-ui/connection';
import Omnibar from 'omnibar';
-function getDashboards(query) {
- return SupersetClient.get({
+const getDashboards = query =>
+ // todo: Build a dedicated endpoint for dashboard searching
+ // i.e. superset/v1/api/dashboards?q=${query}
+ SupersetClient.get({
endpoint:
`/dashboardasync/api/read?_oc_DashboardModelViewAsync=changed_on&_od_DashboardModelViewAsync=desc&_flt_2_dashboard_title=${query}`,
})
.then(({ json }) => json.result.map(item => ({
@@ -31,12 +33,9 @@ function getDashboards(query) {
}),
))
.catch(() => {
- this.props.addDangerToast(t('An error occurred while fethching
Dashboards'));
+ console.log('An error occurred while fethching Dashboards');
});
-}
-export default class OmniContianer extends React.Component {
- render() {
- return <Omnibar placeholder="Search for dashboards.."
extensions={[getDashboards]} />;
- }
-}
+
+const OmniContainer = () => <Omnibar placeholder="Search for dashboards.."
extensions={[getDashboards]} />;
+export default OmniContainer;
diff --git a/superset/assets/src/dashboard/components/Dashboard.jsx
b/superset/assets/src/dashboard/components/Dashboard.jsx
index ed40c7d..18bd5b1 100644
--- a/superset/assets/src/dashboard/components/Dashboard.jsx
+++ b/superset/assets/src/dashboard/components/Dashboard.jsx
@@ -20,7 +20,7 @@ import React from 'react';
import { Modal } from 'react-bootstrap';
import PropTypes from 'prop-types';
import { t } from '@superset-ui/translation';
-import $ from 'jquery'
+import $ from 'jquery';
import getChartIdsFromLayout from '../util/getChartIdsFromLayout';
import DashboardBuilder from '../containers/DashboardBuilder';
@@ -228,7 +228,7 @@ class Dashboard extends React.PureComponent {
const isK = event.key === 'k' || event.keyCode === 83;
if (isK) {
this.setState({ showOmni: !this.state.showOmni });
- console.log($('.modal-dialog:first input').focus());
+ $('.modal-dialog:first input').focus();
}
}
}