fix(项目设置): 修复文件库文件pull的时候如果文件不存在前台没有报错提示的问题

--bug=1017069 --user=宋天阳 【项目设置】文件管理-PULL文件-git仓库被删除-PULL成功
https://www.tapd.cn/55049933/s/1248383
This commit is contained in:
song-tianyang 2022-09-21 11:01:18 +08:00 committed by 建国
parent d64251d44d
commit b037e175e2
3 changed files with 17 additions and 17 deletions

View File

@ -302,16 +302,18 @@ public class FileMetadataService {
private void checkName(FileMetadata fileMetadata) { private void checkName(FileMetadata fileMetadata) {
//文件库的名字不用判断是否唯一.是根据文件库路径自动解析生成的
if (!StringUtils.equals(StorageConstants.GIT.name(), fileMetadata.getStorage())) {
FileMetadataExample example = new FileMetadataExample(); FileMetadataExample example = new FileMetadataExample();
FileMetadataExample.Criteria criteria = example.createCriteria(); FileMetadataExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(fileMetadata.getName()) criteria.andNameEqualTo(fileMetadata.getName())
.andProjectIdEqualTo(fileMetadata.getProjectId()) .andProjectIdEqualTo(fileMetadata.getProjectId())
.andIdNotEqualTo(fileMetadata.getId()); .andIdNotEqualTo(fileMetadata.getId());
if (fileMetadataMapper.countByExample(example) > 0) { if (fileMetadataMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("project_file_already_exists")); MSException.throwException(Translator.get("project_file_already_exists"));
} }
} }
}
private String getBeforeName(FileMetadata fileMetadata) { private String getBeforeName(FileMetadata fileMetadata) {
return fileMetadataMapper.selectByPrimaryKey(fileMetadata.getId()).getName(); return fileMetadataMapper.selectByPrimaryKey(fileMetadata.getId()).getName();

View File

@ -135,6 +135,7 @@ public class GitRepositoryUtils {
} }
} catch (Exception e) { } catch (Exception e) {
LogUtil.error("获取文件库文件报错!", e); LogUtil.error("获取文件库文件报错!", e);
MSException.throwException("Connect repository error!");
} finally { } finally {
this.closeConnection(repo); this.closeConnection(repo);
} }

View File

@ -41,13 +41,6 @@
<el-main> <el-main>
<el-form :model="data" :rules="rules" label-position="right" label-width="80px" size="small" ref="form"> <el-form :model="data" :rules="rules" label-position="right" label-width="80px" size="small" ref="form">
<!-- 基础信息 --> <!-- 基础信息 -->
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="data.description"
type="textarea"
:rows="2" size="small" @blur="save"/>
</el-form-item>
<el-form-item :label="$t('load_test.file_name')" prop="name"> <el-form-item :label="$t('load_test.file_name')" prop="name">
<el-input <el-input
class="ms-file-item-input" class="ms-file-item-input"
@ -56,11 +49,15 @@
:disabled="isRepositoryFile()" :disabled="isRepositoryFile()"
show-word-limit @blur="save"/> show-word-limit @blur="save"/>
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.description')" prop="description">
<el-input class="ms-http-textarea"
v-model="data.description"
type="textarea"
:rows="2" size="small" @blur="save"/>
</el-form-item>
<el-form-item :label="$t('load_test.file_type')" prop="type"> <el-form-item :label="$t('load_test.file_type')" prop="type">
<span>{{ data.type }}</span> <span>{{ data.type }}</span>
</el-form-item> </el-form-item>
<el-form-item :label="$t('load_test.file_size')" prop="size"> <el-form-item :label="$t('load_test.file_size')" prop="size">
<span>{{ formatFileSize(data.size) }}</span> <span>{{ formatFileSize(data.size) }}</span>
</el-form-item> </el-form-item>