mirror of
https://github.com/apache/superset.git
synced 2026-05-08 01:15:46 +00:00
refactor: external metadata fetch API (#16193)
* refactor: external metadata api
* fix comments
* fix ut
* fix fe lint
* fix UT
* fix UT
(cherry picked from commit 6cd15d54a0)
This commit is contained in:
committed by
Ville Brofeldt
parent
6d19de8f66
commit
7f799ed00a
@@ -16,6 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
import rison from 'rison';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Row, Col } from 'src/common/components';
|
||||
@@ -485,11 +486,19 @@ class DatasourceEditor extends React.PureComponent {
|
||||
|
||||
syncMetadata() {
|
||||
const { datasource } = this.state;
|
||||
const endpoint = `/datasource/external_metadata_by_name/${
|
||||
datasource.type || datasource.datasource_type
|
||||
}/${datasource.database.database_name || datasource.database.name}/${
|
||||
datasource.schema
|
||||
}/${datasource.table_name}/`;
|
||||
const params = {
|
||||
datasource_type: datasource.type || datasource.datasource_type,
|
||||
database_name:
|
||||
datasource.database.database_name || datasource.database.name,
|
||||
schema_name: datasource.schema,
|
||||
table_name: datasource.table_name,
|
||||
};
|
||||
const endpoint = `/datasource/external_metadata_by_name/?q=${rison.encode(
|
||||
// rison can't encode the undefined value
|
||||
Object.keys(params).map(key =>
|
||||
params[key] === undefined ? null : params[key],
|
||||
),
|
||||
)}`;
|
||||
this.setState({ metadataLoading: true });
|
||||
|
||||
SupersetClient.get({ endpoint })
|
||||
|
||||
Reference in New Issue
Block a user