Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod: fix style #527

Merged
merged 5 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/components/FileConfigSetting/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@

}
.ant-modal-confirm-btns {
width: 100%;
margin-top: 0;
padding-bottom: 20px;
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface IProps {
}

const fomrItemLayout = {
labelCol: { span: 7, offset: 2 },
labelCol: { span: 8, offset: 1 },
wrapperCol: { span: 10 },
};

Expand Down
4 changes: 3 additions & 1 deletion app/pages/Import/DatasourceList/LocalFileList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
12 changes: 8 additions & 4 deletions app/pages/Import/TaskCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -145,9 +149,9 @@ const TaskCreate = (props: IProps) => {
const params = {
tagConfig: [],
edgeConfig: []
} as any;
} as Partial<ImportStore>;
if(type === 'all') {
params.basicConfig = { taskName: '', address: address.map(i => i.value) };
params.basicConfig = { taskName: '', address: [] };
}
dataImport.update(params);
}, []);
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Import/TaskList/TemplateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {};
Expand Down
1 change: 0 additions & 1 deletion server/api/studio/internal/service/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down