限制文件必须带.

dev_aliyun_beta
caicai8 6 years ago
parent 804b5aa538
commit 7b41491473

@ -37,6 +37,7 @@ class TPMRepositoryComponent extends Component {
setContentWidth100 = (flag) => { setContentWidth100 = (flag) => {
const newFileContent = flag === false ? '' : this.state.fileContent const newFileContent = flag === false ? '' : this.state.fileContent
this.setState({ this.setState({
// isCodeFile
isContentWidth100: flag, isContentWidth100: flag,
fileContent: newFileContent fileContent: newFileContent
}) })
@ -145,12 +146,18 @@ class TPMRepositoryComponent extends Component {
// this.props.setLoadingContent(false) // this.props.setLoadingContent(false)
const trees = response.data.trees const trees = response.data.trees
const treeIsFileMap = {}
if (!trees || !Array.isArray(trees)) { if (!trees || !Array.isArray(trees)) {
// this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!') // this.props.showSnackbar('无法找到对应的资源,请变更地址或联系管理员!')
// return; // return;
} else {
trees.forEach(item => {
treeIsFileMap[item.name] = item.type == 'blob'
})
} }
if(response.status === 200){ if(response.status === 200){
this.setState({ this.setState({
treeIsFileMap,
...response.data, ...response.data,
repositoryLoading: false repositoryLoading: false
}); });

@ -89,10 +89,10 @@ class RepositoryAddFile extends Component {
} }
checkPath= (rule, value, callback) =>{ checkPath= (rule, value, callback) =>{
if (value == "/" ) { if(!value){
callback('请输入正确的文件路径');
}else if(!value){
callback('文件名不能为空'); callback('文件名不能为空');
}else if (value == "/" || value.indexOf('.') == -1 ) {
callback('请输入正确的文件路径');
}else{ }else{
callback(); callback();
} }

Loading…
Cancel
Save