diff --git a/app/components/FileConfigSetting/index.module.less b/app/components/FileConfigSetting/index.module.less index 470fabf0..f22ec9c4 100644 --- a/app/components/FileConfigSetting/index.module.less +++ b/app/components/FileConfigSetting/index.module.less @@ -96,6 +96,7 @@ } .ant-modal-confirm-btns { + width: 100%; margin-top: 0; padding-bottom: 20px; display: flex; diff --git a/app/pages/Import/DatasourceList/DatasourceConfig/PlatformConfig/index.tsx b/app/pages/Import/DatasourceList/DatasourceConfig/PlatformConfig/index.tsx index d9aceb4a..97484876 100644 --- a/app/pages/Import/DatasourceList/DatasourceConfig/PlatformConfig/index.tsx +++ b/app/pages/Import/DatasourceList/DatasourceConfig/PlatformConfig/index.tsx @@ -20,7 +20,7 @@ interface IProps { } const fomrItemLayout = { - labelCol: { span: 7, offset: 2 }, + labelCol: { span: 8, offset: 1 }, wrapperCol: { span: 10 }, }; diff --git a/app/pages/Import/DatasourceList/LocalFileList/index.tsx b/app/pages/Import/DatasourceList/LocalFileList/index.tsx index cc5769a3..fd8bae86 100644 --- a/app/pages/Import/DatasourceList/LocalFileList/index.tsx +++ b/app/pages/Import/DatasourceList/LocalFileList/index.tsx @@ -43,7 +43,9 @@ const FileList = () => { title: intl.get('common.operation'), key: 'operation', render: (_, file) => { - if(!file.sample) { + // sample could be '' if file is empty + // eslint-disable-next-line eqeqeq + if(file.sample == undefined) { return null; } return ( diff --git a/app/pages/Import/TaskCreate/index.tsx b/app/pages/Import/TaskCreate/index.tsx index 89778169..c26c7028 100644 --- a/app/pages/Import/TaskCreate/index.tsx +++ b/app/pages/Import/TaskCreate/index.tsx @@ -12,6 +12,7 @@ import { ISchemaEnum, ISchemaType } from '@app/interfaces/schema'; import Icon from '@app/components/Icon'; import Instruction from '@app/components/Instruction'; import { isEmpty } from '@app/utils/function'; +import { ImportStore } from '@app/stores/import'; import styles from './index.module.less'; import ConfigConfirmModal from './ConfigConfirmModal'; import SchemaConfig from './SchemaConfig'; @@ -39,7 +40,7 @@ const AddMappingBtn = (props: { type: ISchemaType }) => { }; const TaskCreate = (props: IProps) => { - const { dataImport, schema, files, global } = useStore(); + const { dataImport, schema, files, global, datasource } = useStore(); const { intl, currentLocale } = useI18n(); const { basicConfig, tagConfig, edgeConfig, updateBasicConfig, importTask } = dataImport; const { spaces, getSpaces, updateSpaceInfo, currentSpace } = schema; @@ -70,7 +71,10 @@ const TaskCreate = (props: IProps) => { updateSpaceInfo(currentSpace); } trackPageView('/import/create'); - return () => clearConfig('all'); + return () => { + clearConfig('all'); + datasource.update({ cachedStore: null }); + }; }, []); const checkConfig = () => { @@ -145,9 +149,9 @@ const TaskCreate = (props: IProps) => { const params = { tagConfig: [], edgeConfig: [] - } as any; + } as Partial; if(type === 'all') { - params.basicConfig = { taskName: '', address: address.map(i => i.value) }; + params.basicConfig = { taskName: '', address: [] }; } dataImport.update(params); }, []); diff --git a/app/pages/Import/TaskList/TemplateModal/index.tsx b/app/pages/Import/TaskList/TemplateModal/index.tsx index e760844d..59d7ef27 100644 --- a/app/pages/Import/TaskList/TemplateModal/index.tsx +++ b/app/pages/Import/TaskList/TemplateModal/index.tsx @@ -99,7 +99,7 @@ const TemplateModal = (props: IProps) => { }, [currentLocale, username]); const validatePassword = useCallback((client) => validateEmpty('password', client.password), []); const validateS3 = useCallback((s3) => validateEmpty('s3AccessKey', s3.accessKey) || validateEmpty('s3SecretKey', s3.secretKey), []); - const validateSftp = useCallback((sftp) => validateEmpty('sftpUsername', sftp.username) || validateEmpty('sftpPassword', sftp.password), []); + const validateSftp = useCallback((sftp) => validateEmpty('sftpUsername', sftp.user) || validateEmpty('sftpPassword', sftp.password), []); const validateOSS = useCallback((oss) => validateEmpty('ossAccessKey', oss.accessKey) || validateEmpty('ossSecretKey', oss.secretKey), []); const validateClient = useCallback((content) => { const client = content.client || {}; diff --git a/server/api/studio/internal/service/import.go b/server/api/studio/internal/service/import.go index 4a526054..9bbcc365 100644 --- a/server/api/studio/internal/service/import.go +++ b/server/api/studio/internal/service/import.go @@ -68,7 +68,6 @@ func NewImportService(ctx context.Context, svcCtx *svc.ServiceContext) ImportSer } func (i *importService) updateDatasourceConfig(conf *types.CreateImportTaskRequest) (*types.ImportTaskConfig, error) { - // config := conf.Config var config types.ImportTaskConfig if err := json.Unmarshal([]byte(conf.Config), &config); err != nil { return nil, ecode.WithErrorMessage(ecode.ErrBadRequest, err)