Skip to content

Commit

Permalink
fix: Update project error tips
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerwin-L committed May 23, 2022
1 parent 85480f2 commit ffc4793
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const GraphicsPointLimitInput: React.FC<IProps> = ({
}

if (showError) {
message.error('PointsZeroLimitNotify');
message.error(t('PointsZeroLimitNotify'));
}
}

Expand Down
13 changes: 8 additions & 5 deletions src/ProjectPlatform/ProjectList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const icon: any = {

/**
* 获取是否含错误结果
*
* @param tool
* @param fileList
* @param step
Expand All @@ -57,19 +58,21 @@ function isHasWrongResult(tool: EToolName, fileList: IFileInfo[], step = 1) {
return false;
}

const stepName = `step_${step}`;

const isEmpty = fileList.find((file) => {
const result = JSON.parse(file.result);
if (!result) {
return false;
}

const stepResult = result['step_1'];
const stepResult = result[stepName];

if (!stepResult) {
return false;
}

return result['step_1'].toolName !== tool;
return result[stepName].toolName !== tool;
});

return isEmpty;
Expand Down Expand Up @@ -154,12 +157,12 @@ const ProjectList: React.FC<IProps> = ({ createProject }) => {
ipcRenderer.once(EIpcEvent.GetDirectoryImages, function (event: any, fileList: any[]) {
setLoading(false);
if (fileList.length === 0) {
message.error('当前路径没有图片');
message.error(t('NoImgInPath'));
return;
}

if (isHasWrongResult(projectInfo.toolName, fileList)) {
message.error('工具类型不相同,结果无法解析,请选择与项目相同类型的标注结果');
message.error(t('NoSameConfig'));

return;
}
Expand Down
9 changes: 9 additions & 0 deletions src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ const resources = {
CopyProjectConfig: 'Copy project config',
ExportAnnotationResults: 'Export annotation results',
ModifyConfig: 'Modify config',

// data Check
NoImgInPath: 'No images in the current Path',
NoSameConfig: 'The toolType of project configuration does not match result in your resultPath, please check before annotating'

},
},
cn: {
Expand Down Expand Up @@ -193,6 +198,10 @@ const resources = {
CopyProjectConfig: '复制项目配置',
ExportAnnotationResults: '导出标注结果',
ModifyConfig: '修改配置',

// data Check
NoImgInPath: '当前路径没有图片',
NoSameConfig: '项目配置工具类型跟结果不匹配,请检查再进入标注'
},
},
};
Expand Down

0 comments on commit ffc4793

Please sign in to comment.