diff --git a/superset-frontend/spec/fixtures/mockDatasource.js b/superset-frontend/spec/fixtures/mockDatasource.js index 55d95ebde222c..ca60a712b2088 100644 --- a/superset-frontend/spec/fixtures/mockDatasource.js +++ b/superset-frontend/spec/fixtures/mockDatasource.js @@ -168,6 +168,7 @@ export default { id, granularity_sqla: [['ds', 'ds']], name: 'birth_names', + owners: [{ first_name: 'joe', last_name: 'man', id: 1 }], database: { allow_multi_schema_metadata_fetch: null, name: 'main', diff --git a/superset-frontend/spec/javascripts/dashboard/components/FiltersBadge_spec.tsx b/superset-frontend/spec/javascripts/dashboard/components/FiltersBadge_spec.tsx index f24b973199dee..539aa67a69913 100644 --- a/superset-frontend/spec/javascripts/dashboard/components/FiltersBadge_spec.tsx +++ b/superset-frontend/spec/javascripts/dashboard/components/FiltersBadge_spec.tsx @@ -139,7 +139,6 @@ describe('FiltersBadge', () => { wrapper.find('[data-test="incompatible-filter-count"]'), ).toHaveText('1'); // to look at the shape of the wrapper use: - // console.log(wrapper.debug()) expect(wrapper.find(Icons.AlertSolid)).toExist(); }); }); diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx index e502a3e2b22a4..e725cdc238900 100644 --- a/superset-frontend/src/datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/datasource/DatasourceEditor.jsx @@ -17,7 +17,7 @@ * under the License. */ import rison from 'rison'; -import React from 'react'; +import React, { useCallback } from 'react'; import PropTypes from 'prop-types'; import { Row, Col } from 'src/common/components'; import { Radio } from 'src/components/Radio'; @@ -26,6 +26,8 @@ import Alert from 'src/components/Alert'; import Badge from 'src/components/Badge'; import shortid from 'shortid'; import { styled, SupersetClient, t, supersetTheme } from '@superset-ui/core'; +import { Select } from 'src/components'; +import { FormLabel } from 'src/components/Form'; import Button from 'src/components/Button'; import Tabs from 'src/components/Tabs'; import CertifiedIcon from 'src/components/CertifiedIcon'; @@ -40,9 +42,7 @@ import { getClientErrorObject } from 'src/utils/getClientErrorObject'; import CheckboxControl from 'src/explore/components/controls/CheckboxControl'; import TextControl from 'src/explore/components/controls/TextControl'; -import { Select } from 'src/components'; import TextAreaControl from 'src/explore/components/controls/TextAreaControl'; -import SelectAsyncControl from 'src/explore/components/controls/SelectAsyncControl'; import SpatialControl from 'src/explore/components/controls/SpatialControl'; import CollectionTable from 'src/CRUD/CollectionTable'; @@ -374,12 +374,44 @@ const defaultProps = { onChange: () => {}, }; +function OwnersSelector({ datasource, onChange }) { + const loadOptions = useCallback((search = '', page, pageSize) => { + const query = rison.encode({ filter: search, page, page_size: pageSize }); + return SupersetClient.get({ + endpoint: `/api/v1/dataset/related/owners?q=${query}`, + }).then(response => ({ + data: response.json.result.map(item => ({ + value: item.value, + label: item.text, + })), + totalCount: response.json.count, + })); + }, []); + + return ( +