mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
chore: remove generic type (#12003)
* chore: remove generic type * Make resourceName type stricter * Fix type * Fix type * Fix lint
This commit is contained in:
@@ -22,6 +22,7 @@ import configureStore from 'redux-mock-store';
|
||||
import { styledMount as mount } from 'spec/helpers/theming';
|
||||
import { ReactWrapper } from 'enzyme';
|
||||
|
||||
import { ImportResourceName } from 'src/views/CRUD/types';
|
||||
import ImportModelsModal, { StyledIcon } from 'src/components/ImportModal';
|
||||
import Modal from 'src/common/components/Modal';
|
||||
|
||||
@@ -29,8 +30,8 @@ const mockStore = configureStore([thunk]);
|
||||
const store = mockStore({});
|
||||
|
||||
const requiredProps = {
|
||||
resourceName: 'model',
|
||||
resourceLabel: 'model',
|
||||
resourceName: 'database' as ImportResourceName,
|
||||
resourceLabel: 'database',
|
||||
icon: <StyledIcon name="database" />,
|
||||
passwordsNeededMessage: 'Passwords are needed',
|
||||
addDangerToast: () => {},
|
||||
@@ -61,8 +62,8 @@ describe('ImportModelsModal', () => {
|
||||
expect(wrapper.find(Modal)).toExist();
|
||||
});
|
||||
|
||||
it('renders "Import model" header', () => {
|
||||
expect(wrapper.find('h4').text()).toEqual('Import model');
|
||||
it('renders "Import database" header', () => {
|
||||
expect(wrapper.find('h4').text()).toEqual('Import database');
|
||||
});
|
||||
|
||||
it('renders a label and a file input field', () => {
|
||||
|
||||
@@ -22,6 +22,7 @@ import { styled, t } from '@superset-ui/core';
|
||||
import Icon from 'src//components/Icon';
|
||||
import Modal from 'src/common/components/Modal';
|
||||
import { useImportResource } from 'src/views/CRUD/hooks';
|
||||
import { ImportResourceName } from 'src/views/CRUD/types';
|
||||
|
||||
export const StyledIcon = styled(Icon)`
|
||||
margin: auto ${({ theme }) => theme.gridUnit * 2}px auto 0;
|
||||
@@ -97,7 +98,7 @@ const StyledInputContainer = styled.div`
|
||||
`;
|
||||
|
||||
export interface ImportModelsModalProps {
|
||||
resourceName: string;
|
||||
resourceName: ImportResourceName;
|
||||
resourceLabel: string;
|
||||
icon: React.ReactNode;
|
||||
passwordsNeededMessage: string;
|
||||
@@ -145,7 +146,7 @@ const ImportModelsModal: FunctionComponent<ImportModelsModalProps> = ({
|
||||
const {
|
||||
state: { passwordsNeeded },
|
||||
importResource,
|
||||
} = useImportResource<any>(resourceName, resourceLabel, handleErrorMsg);
|
||||
} = useImportResource(resourceName, resourceLabel, handleErrorMsg);
|
||||
|
||||
useEffect(() => {
|
||||
setPasswordFields(passwordsNeeded);
|
||||
|
||||
Reference in New Issue
Block a user