Skip to content
Permalink
Browse files
[HugeGraph-Hubble-fe] Change validations of import Setting (#275)
  • Loading branch information
OshotOkill committed Nov 30, 2020
1 parent aa05111 commit 62abed8a426b5447da505a9bed58b94a4bba6f3b
Showing 2 changed files with 43 additions and 17 deletions.
@@ -322,7 +322,8 @@
},
"validator": {
"no-empty": "该项不能为空",
"need-positive-integer": "请输入非负整数"
"need-integer-with-negative": "请输入-1或大于0的整数",
"need-integer": "请输入大于0的整数"
},
"manipulations": {
"previous": "上一步",
@@ -110,23 +110,48 @@ export class ServerDataImportStore {

@action
validateImportConfigs(key: keyof LoadParameter) {
if (key !== 'check_vertex') {
if (this.importConfigs![key] === '') {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.no-empty'
);

return;
} else if (!isInt(String(this.importConfigs![key]), { min: 0 })) {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.need-positive-integer'
);

return;
}

this.validateImportConfigErrorMessage[key] = '';
switch (key) {
case 'max_parse_errors':
case 'max_insert_errors':
if (this.importConfigs![key] === '') {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.no-empty'
);

return;
} else if (
!isInt(String(this.importConfigs![key]), { min: -1 }) ||
String(this.importConfigs![key]) === '0'
) {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.need-integer-with-negative'
);

return;
}

break;
case 'insert_timeout':
case 'retry_interval':
case 'retry_times':
if (this.importConfigs![key] === '') {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.no-empty'
);

return;
} else if (!isInt(String(this.importConfigs![key]), { min: 1 })) {
this.validateImportConfigErrorMessage[key] = i18next.t(
'server-data-import.validator.need-integer'
);

return;
}

break;
}

this.validateImportConfigErrorMessage[key] = '';
}

@action

0 comments on commit 62abed8

Please sign in to comment.