mirror of
https://github.com/apache/superset.git
synced 2024-09-12 00:29:39 -04:00
fix: Unable to add dataset (#16925)
This commit is contained in:
parent
7f330c9692
commit
c5d23fbcc7
@ -16,7 +16,7 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
import React, { FunctionComponent, useState } from 'react';
|
import React, { FunctionComponent, useState, useEffect } from 'react';
|
||||||
import { styled, t } from '@superset-ui/core';
|
import { styled, t } from '@superset-ui/core';
|
||||||
import { useSingleViewResource } from 'src/views/CRUD/hooks';
|
import { useSingleViewResource } from 'src/views/CRUD/hooks';
|
||||||
import { isEmpty, isNil } from 'lodash';
|
import { isEmpty, isNil } from 'lodash';
|
||||||
@ -60,9 +60,9 @@ const DatasetModal: FunctionComponent<DatasetModalProps> = ({
|
|||||||
addDangerToast,
|
addDangerToast,
|
||||||
);
|
);
|
||||||
|
|
||||||
const setSaveButtonState = () => {
|
useEffect(() => {
|
||||||
setDisableSave(isNil(datasourceId) || isEmpty(currentTableName));
|
setDisableSave(isNil(datasourceId) || isEmpty(currentTableName));
|
||||||
};
|
}, [currentTableName, datasourceId]);
|
||||||
|
|
||||||
const onDbChange = (db: {
|
const onDbChange = (db: {
|
||||||
id: number;
|
id: number;
|
||||||
@ -70,17 +70,14 @@ const DatasetModal: FunctionComponent<DatasetModalProps> = ({
|
|||||||
backend: string;
|
backend: string;
|
||||||
}) => {
|
}) => {
|
||||||
setDatasourceId(db.id);
|
setDatasourceId(db.id);
|
||||||
setSaveButtonState();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSchemaChange = (schema?: string) => {
|
const onSchemaChange = (schema?: string) => {
|
||||||
setSchema(schema);
|
setSchema(schema);
|
||||||
setSaveButtonState();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onTableChange = (tableName: string) => {
|
const onTableChange = (tableName: string) => {
|
||||||
setTableName(tableName);
|
setTableName(tableName);
|
||||||
setSaveButtonState();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSave = () => {
|
const onSave = () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user